Skip to content
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 vector drifts when zoomAnimation is false and zooming via flyTo or pinch #8794

Merged
merged 2 commits into from Feb 2, 2023

Conversation

plainheart
Copy link
Contributor

@plainheart plainheart commented Jan 13, 2023

Background

First I'd like to thank @mourner for the fix in #8103, which makes it work when zoomAnimation is true.

However, as mentioned in #7466, #8644, and my #8103 (comment), it doesn't work when zoomAnimation is set as false.
You can refer to the test case debug/vector/vector-drift.html added in this PR to reproduce or the online demo provided by #7466.

In this PR, I tried to set the transform-origin as 0 0 for the container of the SVG/Canvas renderer. By default, it might be center. I'm not sure if it is right way to fix this bug but it works indeed and looks simple.

closes #8117

Comparison

Platform Before After
Desktop bug fixed
Mobile bug-mobile fixed-mobile

@mourner
Copy link
Member

mourner commented Jan 13, 2023

@plainheart the fix looks great, thank you for looking into this! Since it's not covered by tests currently, I wonder if it would be covered by #8644 — can you take a look? Let's see if it passes if we turn zoomAnimation off there with this fix applied, and fails without.

@plainheart
Copy link
Contributor Author

I'm not familiar with how to add test cases, so I'd like to ask you to help me to add some appropriate test cases. Thanks!

@mourner
Copy link
Member

mourner commented Jan 13, 2023

@plainheart oh, I mean there's already a test case written in that PR — we just need to check if it still passes with zoomAnimation: false and this fix.

Copy link
Member

@Falke-Design Falke-Design left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mourner I added the test with zoomAnimation: false.

The current lint error in the main will be fixed with this to.

@Falke-Design
Copy link
Member

The reason why this is working is because dragging is prevented:

if (this._element.classList.contains('leaflet-zoom-anim')) { return; }

@veitbjarsch
Copy link

Would love to see this in the next release. +1

@mourner mourner merged commit d101627 into Leaflet:main Feb 2, 2023
@plainheart plainheart deleted the fix-vector-drift branch February 2, 2023 11:29
@Falke-Design Falke-Design added this to the 1.9.x milestone Feb 2, 2023
Raruto added a commit to heyajohnny/leaflet-rotate that referenced this pull request Feb 3, 2023
Raruto added a commit to Raruto/leaflet-rotate that referenced this pull request Feb 13, 2023
* Update Rotate.js and CompassBearing.js

Removed call to non existing function '_unthrottledOnDeviceOrientation'
Higher throttling for smoother rotation on device orientation change.
Preparation for iOS support.

* clean up code + add `deviceorientationabsolute` listener

* wrong `off` method

* restore: `webkitCompassHeading` = 360 - `alpha`

Safari on iOS doesn't implement the spec correctly, because alpha is arbitrary instead of relative to true north. Safari instead offers webkitCompassHeading`, which has the opposite sign to alpha and is also relative to magnetic north instead of true north

* automatically disable compass bearing handler on unsupported device

* Update index.html

This should be 'ondeviceorientation' instead of 'ondeviceorientationabsolute'

* Update CompassBearing.js

This should be 'ondeviceorientation' instead of 'ondeviceorientationabsolute'

* Update Renderer.js

Fix for drifting

* Apply patch from: Leaflet/Leaflet#8794

* missing semicolon

---------

Co-authored-by: Johnny Visser <johnny.visser@spie.com>
Co-authored-by: Raruto <Raruto@users.noreply.github.com>
Falke-Design added a commit that referenced this pull request Apr 10, 2023
…yTo` or pinch (#8794)

Co-authored-by: Florian Bischof <design.falke@gmail.com>
Falke-Design added a commit that referenced this pull request Apr 10, 2023
…yTo` or pinch (#8794)

Co-authored-by: Florian Bischof <design.falke@gmail.com>
Falke-Design added a commit that referenced this pull request Apr 10, 2023
…yTo` or pinch (#8794)

Co-authored-by: Florian Bischof <design.falke@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cover vector drift issue with tests
5 participants