Skip to content

Commit 9370a7c

Browse files
committed
add map.options.queryTerrainInMapEvents to control whether to query terrain in map's events
1 parent 1048cd0 commit 9370a7c

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/maptalks/src/map/Map.DomEvents.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,10 @@ Map.include(/** @lends Map.prototype */ {
403403
}(),
404404

405405
//@internal
406-
_wrapTerrainData(/* eventParam: MapEventDataType */) {
407-
return;
408-
// if (eventParam.containerPoint && !eventParam.terrain) {
409-
// eventParam.terrain = this._queryTerrainInfo(eventParam.containerPoint);
410-
// }
406+
_wrapTerrainData(eventParam: MapEventDataType) {
407+
if (this.options['queryTerrainInMapEvents'] && eventParam.containerPoint && !eventParam.terrain) {
408+
eventParam.terrain = this._queryTerrainInfo(eventParam.containerPoint);
409+
}
411410
},
412411

413412
//@internal
@@ -515,6 +514,10 @@ Map.include(/** @lends Map.prototype */ {
515514

516515
Map.addOnLoadHook('_registerDomEvents');
517516

517+
Map.mergeOptions({
518+
'queryTerrainInMapEvents': true
519+
});
520+
518521
function isRotatingMap(map) {
519522
if (!map._domMouseDownView) {
520523
return true;

packages/maptalks/src/map/Map.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const REDRAW_OPTIONS_PROPERTIES = ['centerCross', 'fog', 'fogColor', 'debugSky']
9797
* @property {Number} [options.mousemoveThrottleTime=48] - mousemove event interval time(ms)
9898
* @property {Number} [options.maxFPS=0] - 0 means no frame is locked, otherwise the frame is locked
9999
* @property {Number} [options.cameraFarUndergroundInMeter=2000] - camera far distance from underground in meter
100+
* @property {Boolean} [options.queryTerrainInMapEvents=true] - whether to query terrain in map's event
100101
* @memberOf Map
101102
* @instance
102103
*/

0 commit comments

Comments
 (0)