From 7741f355fcc6b5aeacadc3e48ab7da703939ec22 Mon Sep 17 00:00:00 2001 From: fuzhenn Date: Thu, 10 Oct 2024 17:23:08 +0800 Subject: [PATCH] restore origin when zooming --- src/map/Map.Zoom.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/map/Map.Zoom.ts b/src/map/Map.Zoom.ts index 22e3cffd49..5dbdce19c1 100644 --- a/src/map/Map.Zoom.ts +++ b/src/map/Map.Zoom.ts @@ -86,7 +86,7 @@ Map.include(/** @lends Map.prototype */{ delete this.cameraZenithDistance; this._zooming = true; this._startZoomVal = this.getZoom(); - this._startZoomCoord = origin && this.queryPrjCoordAtContainerPoint(origin); + this._startZoomCoord = origin && this._containerPointToPrj(origin); /** * zoomstart event * @event Map#zoomstart @@ -174,12 +174,13 @@ Map.include(/** @lends Map.prototype */{ this._zoomLevel = nextZoom; this._calcMatrices(); if (origin && this._startZoomCoord) { - // const p = this._containerPointToPoint(origin); - // const offset = p._sub(this._prjToPoint(this._getPrjCenter())); - // this._setPrjCoordAtOffsetToCenter(this._startZoomCoord, offset); - const movingPoint = this._containerPointToPoint(origin, undefined, undefined, this._startZoomCoord.z); - const point = this._prjToPoint(this._pointToPrj(movingPoint)); - const offset = point._sub(this._prjToPoint(this._getPrjCenter())); + const p = this._containerPointToPoint(origin); + const offset = p._sub(this._prjToPoint(this._getPrjCenter())); + + // const movingPoint = this._containerPointToPoint(origin, undefined, undefined, this._startZoomCoord.z); + // const point = this._prjToPoint(this._pointToPrj(movingPoint)); + // const offset = point._sub(this._prjToPoint(this._getPrjCenter())); + this._setPrjCoordAtOffsetToCenter(this._startZoomCoord, offset); } },