jonataswalker/ol-contextmenu

Start draging with menu open

meijer3 opened this issue · 4 comments

Hi,

As UX point of view, I would like to be able to start drag/pan even with the menu open.
Now: open menu > drag outside > menu closes (and hightlight the page...)
Desired: open menu > direct panable (outside the menu ofcourse, and it may close)

2023-04-14 09-00-31

Not clear to me how this "it may close" would work.

Are you able/willing to provide a PR?

I agree with that behavior and i can make a PR for this, but some questions:

Removing the line 307 will allow the popup to be closed on every click (dragging or not) and the event will propagate to the map (allowing dragging it... and maybe select a feature?). If this is ok, the fix it's quite easy.

If instead has to close and propagate only while dragging, i think the listener at 303 could be replaced with a map event (a singleclick), instead of the generic pointerdown. With the ol event it's easy to check the dragging event and allow the propagation only in that case. The only caveat with this is that the singleclick is delayed by 250 ms, so it will no be closed inmediatly.

I find this issue important as well.

I have a similar ask, though in my case the map is tracking an item, when the item moves the map centre co-ordinates are updated to the target position. This seems to trigger the menu to close. Maybe we could add an optional argument defaulted to true named something like 'hideOnMove'. I'll try this on a local copy.

#282