Skip to content

Commit

Permalink
restore origin when zooming
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Oct 10, 2024
1 parent b1f9ffc commit 7741f35
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/map/Map.Zoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
},
Expand Down

0 comments on commit 7741f35

Please sign in to comment.