-
-
Notifications
You must be signed in to change notification settings - Fork 717
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
Large screen: unwanted pan-jump as pan action finishes (3d terrain) #3935
Comments
Okay I've found a simple culprit - once this expression is not returning a consistent result, the math ends up wrong: |
Interesting, this sounds like there might be other issues related to assuming these are equal. |
BTW, did you have a chance to look at #3878? I've tested it with latest version and the bug still exists... |
When the map canvas is large - >2048px, probably - the coords canvas stops growing with the map due to web GL limitations. This means that a screen-pixel is no longer 1:1 with a coords-canvas pixel. It needs to be scaled using the ratio of devicePixelRatio and painter.pixelRatio, which are no longer equal when the map is large.
When the map canvas is large - >2048px, probably - the coords canvas stops growing with the map due to web GL limitations. This means that a screen-pixel is no longer 1:1 with a coords-canvas pixel. It needs to be scaled using the ratio of devicePixelRatio and painter.pixelRatio, which are no longer equal when the map is large.
Bounty direction: maplibre/maplibre#189 |
* Fix for #3935 - pan-jump when map is large When the map canvas is large - >2048px, probably - the coords canvas stops growing with the map due to web GL limitations. This means that a screen-pixel is no longer 1:1 with a coords-canvas pixel. It needs to be scaled using the ratio of devicePixelRatio and painter.pixelRatio, which are no longer equal when the map is large. * Fix for #3935 - add test, update CHANGELOG
(This is a separate but somewhat related issue to #3872
That issue was that the map would often snap back to a previous position.
The distance snapped was relatively small in terms of metres, and it didn't depend on screen size.)
For certain screen sizes > 2048px wide (and probably similar issue for height, but will focus on width for the purposes of demonstrating this bug) - when the user has finished panning and lets go the mouse, it will suddenly jump to a new location. This jump can be quite large and obvious, and, is always in the same direction, regardless of which way the user panned.
maplibre-gl-js version: 4.1.2
browser: Brave
devicePixelRatio: 2 (not sure if it's relevant)
Steps to Trigger Behavior
Option A - with a large screen.
You can check the map's size with
map.transform.width
andmap.transform.height
Option B - no large screen available.
Expected Behavior
No pan-jump after panning motion finishes
Actual Behavior
Large pan jump to south-east.
Further debugging
Open a developer console and input the following function
This lets you see what ML believes the latitude and longitude of some point on the screen, using two different methods - first one just uses math (but ignores terrain height) and the second uses the coords buffer of the terrain.
So running
test(0.5, 0.5)
should give you the LngLat for the centre of the screen, calculated in two different ways.They are allowed to differ slightly since they are answering slightly different questions, but that difference shouldn't depend on the screen size.
Observe that these values are very similar if you set the screen-width to be 2048px or less, but that start to get quite different if you set the screen width to be (for example) 3000px.
The text was updated successfully, but these errors were encountered: