-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean up and add documentation #9
base: support_refactoring
Are you sure you want to change the base?
clean up and add documentation #9
Conversation
# Conflicts: # web/client/map/hooks/use-map-tool.js
@@ -14,15 +22,19 @@ const defaultOpt = { | |||
maxZoom: 18 | |||
} | |||
}; | |||
|
|||
/** | |||
* Common interface shared across multiple map types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an interface, this is a Component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i know, i thought to add special category and not just call it component
going to fix it with "Locate Tool Component shared across multiple map types"
/** | ||
* Common interface shared across multiple map types | ||
* @prop {object} map the map object | ||
* @prop {string} mapType can be openlayers, leaflet or cesium |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we limit this to the actual implementations? There is nothing that prevents having a MapBoxGL api here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no intention to to limit maptypes here, just they are the one currently implemented
going to remove the list
* @prop {object} map the map object | ||
* @prop {string} mapType can be openlayers, leaflet or cesium | ||
* @prop {string} status locate status: DISABLED, FOLLOWING, ENABLED, LOCATING, PERMISSION_DENIED | ||
* @prop {string} message a message to show |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @prop {string} message a message to show | |
* @prop {string} messages message to be shown when location is found |
* @prop {string} mapType can be openlayers, leaflet or cesium | ||
* @prop {string} status locate status: DISABLED, FOLLOWING, ENABLED, LOCATING, PERMISSION_DENIED | ||
* @prop {string} message a message to show | ||
* @prop {function} changeLocateState callback to run when state changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @prop {function} changeLocateState callback to run when state changes | |
* @prop {function} changeLocateState callback to run when status changes |
@@ -34,8 +46,13 @@ const LocateTool = ({map, mapType, status, messages, changeLocateState, onLocate | |||
changeLocateState("DISABLED"); | |||
}; | |||
|
|||
/** | |||
* when loaded do something, use the start method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was thinking it could be useful for new comers but i get your point of no-comment at all 😝
@@ -45,10 +62,23 @@ const LocateTool = ({map, mapType, status, messages, changeLocateState, onLocate | |||
locateInstance.current?.clear(); | |||
}; | |||
}, [loaded]); | |||
|
|||
/** | |||
* when some of the props changes run an update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment needed?
useEffect(() => { | ||
locateInstance.current?.update({status, messages}); | ||
}, [status, messages, loaded]); | ||
|
||
/** | ||
* when there is an error run the callbacks that handles it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment needed?
web/client/map/hooks/use-map-tool.js
Outdated
@@ -8,7 +8,13 @@ | |||
|
|||
import {useEffect, useRef, useState} from "react"; | |||
|
|||
const useMapTool = (mapType, tool) => { | |||
/** | |||
* hook used to load in an asynchronous way a tool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* hook used to load in an asynchronous way a tool | |
* Hook that can be used to load a tool in an asynchronous way |
web/client/map/hooks/use-map-tool.js
Outdated
const useMapTool = (mapType, tool) => { | ||
/** | ||
* hook used to load in an asynchronous way a tool | ||
* @param {string} mapType can be openlayers, leaflet or cesium |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't limit the possible values here
web/client/map/hooks/use-map-tool.js
Outdated
* hook used to load in an asynchronous way a tool | ||
* @param {string} mapType can be openlayers, leaflet or cesium | ||
* @param {string} tool the name of the tool, should match a file in web/client/map/<mapType> folder | ||
* @return {[boolean, object, object]} loaded if the tool has been correctly loaded, impl.current is the reference to the tool, error is an object containing the possible error that can occur while loading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return {[boolean, object, object]} loaded if the tool has been correctly loaded, impl.current is the reference to the tool, error is an object containing the possible error that can occur while loading | |
* @return {[boolean, object, object]} [loaded, tool_implementation, error]: loaded is false until the tool has been correctly loaded, tool_implementation is a ReactJS reference to the tool, error is an object containing an error if the tool implementaion cannot be loaded |
Clean up and documentation