Skip to content

Commit 7347159

Browse files
leoneljdiasfuzhenn
authored andcommitted
close #1139
1 parent 843937f commit 7347159

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/map/handler/Map.Touch.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MapTouchZoomHandler extends Handler {
1515

1616
_onTouchStart(event) {
1717
const map = this.target;
18-
if (!event.touches || event.touches.length !== 2 || map.isInteracting()) {
18+
if (!event.touches || event.touches.length < 2) {
1919
return;
2020
}
2121
const container = map.getContainer();
@@ -30,6 +30,8 @@ class MapTouchZoomHandler extends Handler {
3030
this._startZoom = map.getZoom();
3131
this._startBearing = map.getBearing();
3232

33+
off(document, 'touchmove', this._onTouchMove, this);
34+
off(document, 'touchend', this._onTouchEnd, this);
3335
addDomEvent(document, 'touchmove', this._onTouchMove, this);
3436
addDomEvent(document, 'touchend', this._onTouchEnd, this);
3537
preventDefault(event);
@@ -46,7 +48,7 @@ class MapTouchZoomHandler extends Handler {
4648

4749
_onTouchMove(event) {
4850
const map = this.target;
49-
if (!event.touches || event.touches.length !== 2) {
51+
if (!event.touches || event.touches.length < 2) {
5052
return;
5153
}
5254
const container = map.getContainer(),
@@ -141,11 +143,11 @@ class MapTouchZoomHandler extends Handler {
141143
}
142144

143145
Map.mergeOptions({
144-
'touchGesture' : true,
146+
'touchGesture': true,
145147
'touchZoom': true,
146-
'touchPitch' : true,
147-
'touchRotate' : true,
148-
'touchZoomRotate' : false
148+
'touchPitch': true,
149+
'touchRotate': true,
150+
'touchZoomRotate': false
149151
});
150152

151153
Map.addOnLoadHook('addHandler', 'touchGesture', MapTouchZoomHandler);

0 commit comments

Comments
 (0)