Dragging drawings across the date line does not move them to the target "world"
See original GitHub issue- Leaflet version I’m using: 0.7.2
- Leaflet Draw version I’m using: 0.4.9
- Browser (with version) I’m using: Chrome 60
- OS/Platform (with version) I’m using: Ubuntu 14.04
A user makes a drawing (for example, a polygon) and drags it across the date line in the Pacific:
As soon as they release the mouse, the drawing seems to vanish off the map. In fact it simply stays in the Leaflet “world” it came from, instead of moving to the new one that the user dragged it to. It remains in the right location, but in the wrong copy of the world and probably way outside the viewing area.
I tried worldCopyJump
and other possible solutions from here:
https://github.com/Leaflet/Leaflet/issues/2333
Unfortunately, nothing helps.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
Concept-Development Practice Page
Above left: Use the scale 1 cm:5 m and draw the positions of the dropped ball at 1-second intervals. Neglect air drag and...
Read more >Drawing on Canvas - Eloquent JavaScript
The only way to move a shape on a canvas is to clear the canvas (or the part of the canvas around the...
Read more >Drag and drop - Android Developers
The drag and drop operation ends when the user releases the drag shadow whether or not the drag shadow is over a drop...
Read more >The international date line, explained | Live Science
The international date line is an imaginary line that runs north-south across the Pacific Ocean from the North Pole to the South Pole....
Read more >WHO guidelines on drawing blood best practices in phlebotomy
In no event shall the World Health. Organization be liable for damages arising from its use. Printed by the WHO Document Production Services,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Techn1x oh man, I totally forgot to follow up on this. I bundled my code as a plugin here:
https://github.com/germanjoey/Leaflet.ShadowWrap
I meant to announce it here because I had remembered that there was a lot of requests for this feature for Leaflet.Draw (and in general, for Leaflet to correctly handle shapes spanning the IDL), but then my IRL got very insane the last few months and I totally forgot about this.
Anyways, the demo uses Leaflet v1.2 and is untested with the recent round of Leaflet.Draw PRs included by @ddproxy, but it does include the by-now-forgotten undo/redo PR that I submitted like 14 months ago, lol.
Give it a whirl, lemme know how it goes.
This plugin should be compatible with most Leaflet plugins btw, but I had to add a bunch of special-casing for Leaflet.Draw to make it work outta the box. Lots of special/edge cases, kinda drove me nuts. BUT - it should work with Leaflet.Draw just by including the plugin and hooking in your add-shape callback - see demo2.html.
At any rate, if you find a bug please let me know about it (and exactly how I can reproduce it).