If you want to switch to a different feature style when a user selects or hovers a feature, you have 2 options:
-
The
selected
andhovered
flags of thePaintState
parameter in thepaintBody
orpaintLabel
methods of theFeaturePainter
, indicate that the feature is being rendered in the selected or hovered mode. Based on these flags you can choose to use a different style for selected and hovered features. See the Visualizing and styling feature data tutorial for an illustration. -
Use the
addSelection
andaddHover
functions of theFeaturePainterUtil
module to add selection and hover behavior to yourFeaturePainter
. Although these options limit your choices, it’s a quick and easy way to equip aFeaturePainter
with selection and hover behavior.