jieter / Leaflet.Sync

Synchronized view of two maps.
http://jieter.github.io/Leaflet.Sync/examples/dual.html
BSD 3-Clause "New" or "Revised" License
235 stars 53 forks source link

plugin loses Sync #37

Closed treecon closed 7 years ago

treecon commented 7 years ago

Here is a simpe jsfiddle demo:

https://jsfiddle.net/91up4tje/

The second map is synced to the first map. However, if you zoom in/out and then drag the map, the second map will be "off". If not with the first try, it will happen for sure, if you try it some more times.

treecon commented 7 years ago

forgot to say that if you sync both maps with each other, the problem seems to disappear.

jieter commented 7 years ago

This is expected behaviour. one way sync = one way, two way sync is two way. Use what you want :)

treecon commented 7 years ago

Hi jieter. Maybe I wasn't clear enough.

mapB is synced to mapA.

I only touch mapA, not mapB.

If I zoom mapA -> mapB is synced. If i drag mapA -> mapB is synced.

If i zoom mapA and then drag mapA -> mapB often loses synchronization. It is synced again when zooming in mapA but after dragging again mapA, mapB often loses synchronization again. I want to make clear again that I only touch mapA and not mabB. Please check fiddle again.

Thank you! :)

[I just said that if you use "two way sync", the bug seems to be fixed. However, you shouldn't have to use "two way sync" if you only touch one map]

jjimenezshaw commented 7 years ago

Hi. If I am not wrong, I realized somehow this issue while I was developing my pull request (https://github.com/turban/Leaflet.Sync/pull/38) I thought it was an error on my code. Finally I fixed it changing the 'zoomend' a bit (applies the setView also to the originalMap, not only to the toSync maps). If you can, try with my branch. I don't know how to use it in jsfiddle. Cheers.

jieter commented 7 years ago

@jjimenezshaw do you mean you think you fixed this issue?

jjimenezshaw commented 7 years ago

@jieter Yes. I think it is fixed in my branch. I copied the file from my branch into the jsfiddle (replacing the L.Map.Sync one), and I guess it works fine.

@treecon Could you check that? See pull/38

jjimenezshaw commented 7 years ago

Now that pull 38 is merged, it is easy to include L.Map.Sync.js in a fiddle. I just replaced it in this one: https://jsfiddle.net/s4d9o4x8/

jieter commented 7 years ago

@treecon seems to be fixed now, I'm closing this. Please comment if it's not fixed in your experience.