We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4edc371 commit 338c78bCopy full SHA for 338c78b
src/ui/handler_manager.ts
@@ -527,7 +527,11 @@ export class HandlerManager {
527
if (this._map.cameraHelper.useGlobeControls && !tr.isPointOnMapSurface(around)) {
528
around = tr.centerPoint;
529
}
530
- const preZoomAroundLoc = tr.screenPointToLocation(panDelta ? around.sub(panDelta) : around);
+ // If we are rotating about the center point, avoid numerical issues near the horizon by using the transform's
531
+ // center directly, instead of computing it from the screen point
532
+ const preZoomAroundLoc = around.distSqr(tr.centerPoint) < 1.0e-2 ?
533
+ tr.center :
534
+ tr.screenPointToLocation(panDelta ? around.sub(panDelta) : around);
535
536
if (!terrain) {
537
// Apply zoom, bearing, pitch, roll
0 commit comments