Skip to content

Commit

Permalink
respect geometry events out of map (#2104)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn authored Oct 13, 2023
1 parent d9087f5 commit dfdb231
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/geometry/ext/Geometry.Drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ class GeometryDragHandler extends Handler {

_dragging(param) {
const target = this.target;
const map = target.getMap(),
e = map._parseEvent(param['domEvent']);
const map = target.getMap();
if (map._isEventOutMap(param['domEvent'])) {
return;
}
const e = map._parseEvent(param['domEvent']);

const domEvent = e['domEvent'];
if (domEvent.touches && domEvent.touches.length > 1) {
Expand Down
10 changes: 5 additions & 5 deletions src/map/Map.DomEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Map.include(/** @lends Map.prototype */ {
} else {
this._fireDOMEvent(this, e, 'dom:' + e.type);
}
if (this._ignoreEvent(e)) {
if (this._ignoreEvent(e) || this._isEventOutMap(e)) {
return;
}
let mimicClick = false;
Expand Down Expand Up @@ -252,7 +252,7 @@ Map.include(/** @lends Map.prototype */ {
this._fireDOMEvent(this, e, 'dom:click');
}
}
if (this._ignoreEvent(e)) {
if (this._ignoreEvent(e) || this._isEventOutMap(e)) {
return;
}
this._fireDOMEvent(this, e, type);
Expand All @@ -266,9 +266,9 @@ Map.include(/** @lends Map.prototype */ {
if (!domEvent || !this._panels.control) {
return false;
}
if (this._isEventOutMap(domEvent)) {
return true;
}
// if (this._isEventOutMap(domEvent)) {
// return true;
// }
let target = domEvent.srcElement || domEvent.target;
let preTarget;
if (target) {
Expand Down
2 changes: 1 addition & 1 deletion src/map/handler/Map.Drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MapDragHandler extends Handler {
if (param.domEvent) {
param = param.domEvent;
}
return this.target._ignoreEvent(param);
return this.target._ignoreEvent(param) || this.target._isEventOutMap(param);
}

_onMouseDown(param) {
Expand Down
2 changes: 1 addition & 1 deletion src/map/handler/Map.ScrollWheelZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MapScrollWheelZoomHandler extends Handler {
stopPropagation(evt);
}

if (map._ignoreEvent(evt) || !map.options['zoomable']) {
if (map._ignoreEvent(evt) || map._isEventOutMap(evt) || !map.options['zoomable']) {
return false;
}
const container = map._containerDOM;
Expand Down

0 comments on commit dfdb231

Please sign in to comment.