Skip to content

Commit

Permalink
fix Geometry event result point2d attribute typo (#2387)
Browse files Browse the repository at this point in the history
* fix Geometry event result point2d attribute typo

* spec
  • Loading branch information
deyihu authored Jul 24, 2024
1 parent 4d8fc1c commit d037ea0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/geometry/ext/Geometry.Edit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Geometry from '../Geometry';
import GeometryEditor from '../editor/GeometryEditor';
import { isNil } from '../../core/util';
// import { isNil } from '../../core/util';
export type GeometryEditSymbolType = {
'markerType': string,
'markerFill': string,
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/ext/Geometry.Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Geometry.include(/** @lends Geometry.prototype */ {
// eventParam['coordinate'] = map.containerPointToCoordinate(containerPoint);
// eventParam['containerPoint'] = containerPoint;
// eventParam['viewPoint'] = map.containerPointToViewPoint(containerPoint);
// eventParam['pont2d'] = map._containerPointToPoint(containerPoint);
// eventParam['point2d'] = map._containerPointToPoint(containerPoint);
// }
// return eventParam;
// }
Expand Down
2 changes: 1 addition & 1 deletion src/map/Map.DomEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ Map.include(/** @lends Map.prototype */ {
eventParam['coordinate'] = map.containerPointToCoordinate(containerPoint);
eventParam['containerPoint'] = containerPoint;
eventParam['viewPoint'] = map.containerPointToViewPoint(containerPoint);
eventParam['pont2d'] = map._containerPointToPoint(containerPoint);
eventParam['point2d'] = map._containerPointToPoint(containerPoint);
}
this._wrapTerrainData(eventParam);
return eventParam;
Expand Down
19 changes: 19 additions & 0 deletions test/geometry/event/GeometryEventSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,4 +564,23 @@ describe('Geometry.Events', function () {

});

it('#2386 Geometry event result point2d attribute typo ', function (done) {
var circle = new maptalks.Circle(map.getCenter(), 10);
circle.addTo(layer);
var domPosition = GET_PAGE_POSITION(container);
var point = map.coordinateToContainerPoint(center).add(domPosition);
// var spy = sinon.spy();
circle.on('click', (e) => {
expect(e).to.have.property('point2d');
expect(e.point2d).to.be.an(maptalks.Point);
done();
});

happen.click(eventContainer, {
'clientX': point.x,
'clientY': point.y
});

});

});

0 comments on commit d037ea0

Please sign in to comment.