Skip to content

Commit 9939cf7

Browse files
committed
fix touch event's preventDefault in mobile
1 parent 6001e6d commit 9939cf7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/handler/Drag.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class DragHandler extends Handler {
7676
on(this.dom, 'mouseleave', this.onMouseUp, this);
7777
}
7878
this.fire('mousedown', {
79-
'domEvent': actual,
79+
'domEvent': event,
8080
'mousePos': new Point(actual.clientX, actual.clientY)
8181
});
8282
}
@@ -94,13 +94,13 @@ class DragHandler extends Handler {
9494
}
9595
if (!this.moved) {
9696
this.fire('dragstart', {
97-
'domEvent': actual,
97+
'domEvent': event,
9898
'mousePos': this.startPos.copy()
9999
});
100100
this.moved = true;
101101
} else {
102102
this.fire('dragging', {
103-
'domEvent': actual,
103+
'domEvent': event,
104104
'mousePos': new Point(actual.clientX, actual.clientY)
105105
});
106106
}
@@ -110,7 +110,7 @@ class DragHandler extends Handler {
110110
const actual = event.changedTouches ? event.changedTouches[0] : event;
111111
this._offEvents();
112112
const param = {
113-
'domEvent': actual
113+
'domEvent': event
114114
};
115115
if (isNumber(actual.clientX)) {
116116
param['mousePos'] = new Point(parseInt(actual.clientX, 0), parseInt(actual.clientY, 0));

src/map/handler/Map.Drag.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class MapDragHandler extends Handler {
106106
this._start(param);
107107
const map = this.target;
108108
map.onMoveStart(param);
109-
const p = getEventContainerPoint(param.domEvent, map.getContainer());
109+
const p = getEventContainerPoint(map._getActualEvent(param.domEvent), map.getContainer());
110110
this.startPrjCoord = map._containerPointToPrj(p);
111111
}
112112

@@ -115,7 +115,7 @@ class MapDragHandler extends Handler {
115115
return;
116116
}
117117
const map = this.target;
118-
const p = getEventContainerPoint(param.domEvent, map.getContainer());
118+
const p = getEventContainerPoint(map._getActualEvent(param.domEvent), map.getContainer());
119119
map._setPrjCoordAtContainerPoint(this.startPrjCoord, p);
120120
map.onMoving(param);
121121
}

0 commit comments

Comments
 (0)