You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I want to use ol-context-menu-control and detect when it's open. I should be able to do that with event listener @OPEN, but it doesn't work. I checked what's going on and it's because my items (prop passed to ol-context-menu-control) is computed value - after update whole control is recreated, but events listeners aren't refreshed.
const properties = usePropsAsObjectProperties(props);
const { control } = useControl(ContextMenu, properties, attrs);
const { updateOpenLayersEventHandlers } = useOpenLayersEvents(control, ["beforeopen", "open", "close", "add-menu-entry"]);
watch(properties, updateOpenLayersEvent); // or maybe watch on control?
Also, maybe I don't know how to use it properly, but computed items seems to me as a pretty normal usage - e.g. show extra item if there are some features on pixel where context menu is opened.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello
I want to use ol-context-menu-control and detect when it's open. I should be able to do that with event listener @OPEN, but it doesn't work. I checked what's going on and it's because my items (prop passed to ol-context-menu-control) is computed value - after update whole control is recreated, but events listeners aren't refreshed.
Listeners are applied on mounted:
vue3-openlayers/src/composables/useOpenLayersEvents.ts
Lines 86 to 88 in 47df0a1
Control is refreshed on properties change:
vue3-openlayers/src/composables/useControl.ts
Lines 104 to 106 in 47df0a1
and
vue3-openlayers/src/composables/useControl.ts
Lines 110 to 114 in 47df0a1
But updateOpenLayersEventHandlers is not called on properties change. Maybe this should be resolved as in ol-interaction-draw:
vue3-openlayers/src/components/interaction/OlInteractionDraw.vue
Lines 103 to 124 in 47df0a1
Also, maybe I don't know how to use it properly, but computed items seems to me as a pretty normal usage - e.g. show extra item if there are some features on pixel where context menu is opened.
Beta Was this translation helpful? Give feedback.
All reactions