-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Marker position while zooming #7967
Conversation
@@ -1697,6 +1700,12 @@ export var Map = Evented.extend({ | |||
noUpdate: noUpdate | |||
}); | |||
|
|||
if (!this._tempFireZoomEvent) { | |||
this._tempFireZoomEvent = this._zoom !== this._animateToZoom; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to store if the zoom is different, to fire later the zoom
event.
this._tempFireZoomEvent = this._zoom !== this._animateToZoom; | ||
} | ||
|
||
this._move(this._animateToCenter, this._animateToZoom, undefined, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the necessary call to set the _pixelOrigin
but we need to prevent firing the zoom
event (to keep the current behaviour)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
If a marker is set to a new latlng while zooming the marker jumps around. The problem is that the
this._pixelOrigin
(which is used for the calculation of the marker position) is only set after the zoom (_onZoomTransitionEnd
), so while zooming the old pixelOrigin is used and the marker jumps.I tried to create a test but it was not possible.
New src: link
Fixed:
![marker_jumping_fix](https://user-images.githubusercontent.com/19800037/152519208-4b606a61-90ee-4c25-9aeb-0902efc43df3.gif)