Map content moves when zooming
See original GitHub issueMy simple test-app (created with V1 beta2) has some strange zooming behaviour: when zooming out, the drawn polygon moves south-east and returns to its correct postion when the zoom operation ends. When zooming in, the drawn polygon moves north-west and returns to its correct postion when the zoom operation ends.
this is my app:
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: "© <a href='http://openstreetmap.org/copyright'>OpenStreetMap</a> contributors"
}).addTo(map);
var polygon = L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]
]).addTo(map);
I published the app to testmapw.meteor.com, have a look… If I replace V1.0.0 beta2 with V0.7.3 everything is ok again.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
leaflet - point on the map moves when zoom in and out
The map is dynamically changing when you zoom. I believe the points are in the same spot, the road detail is just changing....
Read more >Double Click Zoom moves the map while using the ma...
Double Click Zoom moves the map while using the map in an absolute positioned div. When i move our map's div (which itself...
Read more >Preventing map move on zoom in Leaflet? - GIS Stack Exchange
Set scrollWheelZoom option to 'center' when defining map: var mymap = L.map('spotmap', { dragging: false, scrollWheelZoom: 'center' }).
Read more >Controlling Zoom and Pan | Maps JavaScript API
Users can zoom the map by clicking the zoom controls. They can also zoom and pan by using two-finger movements on the map...
Read more >Map : Pan and Zoom to element - GSAP - GreenSock
It works without issues. But, of course, when I couple that with the scaling, the delta computed initially gets more and more incorrect...
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
Sorry, I know this is closed, but I ran into this problem as well. My problem was due to using the old css file (0.7.3) instead of the current one (1.0.3). Hope this helps someone.
I was using the hosted version, and I didn’t update the stylesheet link. IE I was using
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> running version 1.0.3, so I should have been using <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />If you follow the directions to use the hosted version here http://leafletjs.com/download.html you should be fine.