farmOS-map
farmOS-map copied to clipboard
Edit interactions remain selected after programatically disabling active state
Right now the edit controls are not fully responsive to the OL interaction's "active" state: https://openlayers.org/en/latest/apidoc/module-ol_interaction_Interaction-Interaction.html#getActive
To see this, open a map with edit controls, and click on a tool to start drawing a polygon. Set the drawInteraction
to inactive, and see that the drawing control is deactivated, but remains selected:
window.farmOS.map.instances[0].edit.drawInteraction.setActive(false)
Right now you can deactivate any of the interactions by calling edit.disableAll()
: https://github.com/farmOS/farmOS-map/blob/65f13b2cd9a36f4b211ec9211e2532b4fcf29d48/src/control/Edit/Edit.js#L423
but I'm curious if our edit control could be refactored to use the Interactions concept of "active" state. The Interaction
objects do seem to fire a change:active
event that could be used to update state within our edit control: https://openlayers.org/en/latest/apidoc/module-ol_interaction_Interaction-Interaction.html
I agree we should probably honor changes to the interactions' active
properties.