Skip to content

Commit

Permalink
respect altitude in coordinateToContainerPoint, #2486
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Jan 1, 2025
1 parent 3e37808 commit 3e67549
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/map/src/map/Map.CoordTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Map.include(/** @lends Map.prototype */{
const COORD = new Coordinate(0, 0);
return function (coordinate, res, out) {
const pCoordinate = this.getProjection().project(coordinate, COORD);
return this._prjToContainerPointAtRes(pCoordinate, res, out);
return this._prjToContainerPointAtRes(pCoordinate, res, out, pCoordinate.z);
};
}(),

Expand Down
5 changes: 5 additions & 0 deletions packages/map/test/map/MapSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ describe('Map.Spec', function () {
expect(point).to.be.a(maptalks.Point);
});

it('coordinateToContainerPoint with altitude', function () {
var point = map.coordinateToContainerPoint({ x: 118.847825, y: 32.046534, z: 100 });
expect(point.x).to.be.above(300);
});

it('containerPointToCoordinate', function () {
var coord = map.containerPointToCoordinate(new maptalks.Point(0, 0));

Expand Down

0 comments on commit 3e67549

Please sign in to comment.