Skip to content

Commit fead83c

Browse files
authored
fix:fix map miss altitude when drag or zoom (#2786)
* fix:fix map miss altitude when drag or zoom * updates * updates
1 parent 9dfc627 commit fead83c

File tree

1 file changed

+9
-0
lines changed
  • packages/maptalks/src/map

1 file changed

+9
-0
lines changed

packages/maptalks/src/map/Map.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,6 +2360,15 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) {
23602360

23612361
//@internal
23622362
_setPrjCenter(pcenter: Coordinate) {
2363+
if (pcenter && this._prjCenter) {
2364+
//Respect the current altitude
2365+
// https://github.com/maptalks/maptalks.js/issues/2724
2366+
// https://github.com/maptalks/issues/issues/913
2367+
if (!isNumber(pcenter.z) && isNumber(this._prjCenter.z)) {
2368+
const altitude = this._prjCenter.z;
2369+
pcenter.z = altitude;
2370+
}
2371+
}
23632372
this._prjCenter = pcenter;
23642373
if (this.isInteracting() && !this.isMoving()) {
23652374
// when map is not moving, map's center is updated but map platform won't

0 commit comments

Comments
 (0)