Im trying to achieve behaviour where user could drag elements from a leaflet map to other page where there is another map.
To be able to drag out of the map and go hover over link in a navbar which after one second time redirects me to the other page, I did these steps:
1 - The whole page has onmousemove event listener (when dragging is active).
2 - When I want to start dragging some polygon from the map, I actually create a new element (looking similiar to the one in the map) with absolute position and the onmousemove listener is setting its position based on the cursors position.
3 - After hovering over the link and being redirected to the other page, after the reload, I reconstruct the "dragged" element and I re-add the onmousemove event listener (as in step 1). BUT because it should be drag n drop like experience, the user is still holding the left-mouse button down and the re-added onmousemove event listener starts doing its think only after user stop holding the left-mouse button down.
What I'd like to achieve is that the re-added onmouse event listens from the very beginning even if left-mouse button is down all the time during the page load. Or if there is other way how to go around this.
Thank you