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

Problem with Google tiles Sync #20

Closed kingstakh closed 10 years ago

kingstakh commented 10 years ago

Hi! Nice plugin, but have one problem. For adding Google tile layer use this Plugin https://github.com/shramov/leaflet-plugins, but Google layer is not draggable in Sync mode. If drag Google layer - OSM layer dragging, if drag OSM - Google layer frized and change position only after change zoom level up/down. Demo here http://1871.by/demo/

jieter commented 10 years ago

Hmm, the difference in implementation between L.TileLayer and L.Google ensures this works in only one direction. I just tested with Leaflet master and small patch to L.Google, which works like expected, I'll make a PR to Leaflet-plugins with the patch later today...

kingstakh commented 10 years ago

It will be cool

jieter commented 10 years ago

Hmm, making L.Google behave nice with Leaflet master is a little harder than I thought... Still working on it...

kingstakh commented 10 years ago

Maybe this example helps to fix this issue http://tianjara.net/leaflet-side-by-side.html, work with little freezes, but works! Here in action http://1871.by/demo2/

jieter commented 10 years ago

Thanks for the suggestion but the problem is L.Google and Leaflet's Layers refactoring... L.Sync works like charm with two regular TileLayers...

kingstakh commented 10 years ago

Hi! fix this problem impossible?

jieter commented 10 years ago

Hmm, the problem is that L.Google is a regular google maps api map in a layer, which just copies interaction on the google map to the leaflet map. It might be possible to mimic Leaflet's TileLayer's dragging behavior in L.Google, but it's not a trivial task. On top of that: it's not really the scope of L.Sync, and I currently do not have the time to fix it...

CrokinoleMaster commented 10 years ago

Not sure if this helps at all but I just used this and it worked

 map2.on('drag zoomend', function(){
     map1.setView(map2.getCenter(), map2.getZoom(), {animate: false, duration: 1});
 })
kingstakh commented 10 years ago

Thank you!