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.

Map content moves when zooming

See original GitHub issue

My 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: "&copy; <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:closed
  • Created 8 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

18reactions
tc33133commented, Apr 26, 2017

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.

3reactions
tc33133commented, Jun 29, 2017

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.

Read more comments on GitHub >

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

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