question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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: drag

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:open
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
germanjoeycommented, Jan 29, 2018

@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.

0reactions
germanjoeycommented, Jan 29, 2018

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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found