FeatureHighlighter Class
A class responsible for highlighting points, lines, and shapes on the map upon selection and consequent hover actions. The highlighting is achieved by manipulating svg rendering of the map as follows:
- all existing feature layers are wrapped into a group object
- three more group objects are created:
highlight group
is positioned after thegraphicGroup
zoomlight group
is positioned before thegraphicGroup
hoverlight group
is positioned before thezoomlight group
and changing the opacity of the graphicGroup
while adding shapes to one or more of the additional group objects.
Imports RAMP Modules:
Item Index
Methods
Methods
cloneGraphic
-
graphic
Creates a copy of the given graphic object.
Parameters:
-
graphic
ObjectGraphic object to clone
Returns:
clone A cloned Graphic object
highlightGraphic
-
eventArg
Clones the Graphic object from the event, adds it to the Highlight layer, and lowers the opacity of other map layers to make the cloned Graphic stand out.
Parameters:
-
eventArg
Object???
highlightGraphicHide
()
private
Clears the Highlight layer and restores the opacity of the map layers.
hoverLight
-
eventArg
Clones the Graphic object from the event, adds it to the Hoverlight layer.
Parameters:
-
eventArg
Object???
hoverLightHide
()
private
Clears the Hoverlight layer.
init
()
Initiates the FeatureHighlighter static class.
initListeners
()
private
Initiates various listeners for the class.
repositionInteractive
()
private
If there a Graphic in the Highlihgh layer, resets it's bounding box and repositions an interactive maptip to match the top center of the boudning box of the highlighted graphic.
sortLayers
()
private
Sorts and groups the svg representation of the map layers on the page to make highlighting work. Group all the feature layers and create new groups for highlight, zoomlight, and hoverlight layers.
zoomLight
-
eventArg
Clones the Graphic object from the event, adds it to the Zoomlight layer, and lowers the opacity of other map layers to make the cloned Graphic stand out.
Parameters:
-
eventArg
Object???
zoomLightHide
()
private
Clears the Zoomlight layer and restores the opacity of the map layers if the Highlight layer is empty.
Events
FeatureHighlighter.HIGHLIGHT_HIDE [subscribed]
Dehighlights a currently highlighted feature on the map and restores opacity of the rest of the layers; hides the interactive tooltip.
FeatureHighlighter.HIGHLIGHT_SHOW [subscribed]
Permanently highlights a given feature on the map; display an interactive tooltip for this feature; reduces opacity of the graphicGroup
layers.
Even when the user moves the cursor away, the feature stays highlighted; tooltip stays put.
Only one feature can be highlighted like this at a time.
Event Payload:
-
eventAttr
ObjectESRI feature click even attributes
FeatureHighlighter.HOVERLIGHT_HIDE [subscribed]
Dehighlights a currently highlighted (hoverlighted) feature on the map without restoring opacity of the rest of the layers;
FeatureHighlighter.HOVERLIGHT_SHOW [subscribed]
Temporarilly highlights (hoverlights) a given feature on the map. Intended to be dehighlighted when the user moves the cursor away; to do that, publish HOVERLIGHT_HIDE event. Effect is only visible when another feature is already permanently highlighted. Only one feature can be highlighted like this at a time.
Event Payload:
-
eventAttr
ObjectESRI feature click even attributes
FeatureHighlighter.ZOOMLIGHT_HIDE [subscribed]
Dehighlights a currently highlighted (zoomlighted) feature on the map; Removes the tooltip. Restores the opacity of the graphicGroup layers if no feature is highlighted at present.
FeatureHighlighter.ZOOMLIGHT_SHOW [subscribed]
Temporarilly highlights (zoomlightes) a given feature on the map. Intended to be dehighlighted when the user makes an action like panning or zooming the map, publish ZOOMLIGHT_HIDE event. Displays a temporary tooltip for this feature; Only one feature can be highlighted (zoomlighted) like this at a time.
Event Payload:
-
eventAttr
ObjectESRI feature click even attributes