Another blind attemp to work around dblclicks on Edge (#5268)
* Another blind attemp to work around dblclicks on Edge * Make linter happy, do not forget about IE11 & IE11 pointer events
This commit is contained in:
parent
f8bcccc24f
commit
2b5d401976
@ -17,9 +17,7 @@ L.extend(L.DomEvent, {
|
||||
var count;
|
||||
|
||||
if (L.Browser.pointer) {
|
||||
if ((!L.Browser.edge) || e.pointerType === 'mouse') {
|
||||
return;
|
||||
}
|
||||
if ((!L.Browser.edge) || e.pointerType === 'mouse') { return; }
|
||||
count = L.DomEvent._pointersCount;
|
||||
} else {
|
||||
count = e.touches.length;
|
||||
@ -35,9 +33,11 @@ L.extend(L.DomEvent, {
|
||||
last = now;
|
||||
}
|
||||
|
||||
function onTouchEnd() {
|
||||
function onTouchEnd(e) {
|
||||
if (doubleTap && !touch.cancelBubble) {
|
||||
if (L.Browser.pointer) {
|
||||
if ((!L.Browser.edge) || e.pointerType === 'mouse') { return; }
|
||||
|
||||
// work around .type being readonly with MSPointer* events
|
||||
var newTouch = {},
|
||||
prop, i;
|
||||
@ -65,12 +65,11 @@ L.extend(L.DomEvent, {
|
||||
obj.addEventListener(touchstart, onTouchStart, false);
|
||||
obj.addEventListener(touchend, onTouchEnd, false);
|
||||
|
||||
// On some platforms (notably, chrome on win10 + touchscreen + mouse),
|
||||
// On some platforms (notably, chrome<55 on win10 + touchscreen + mouse),
|
||||
// the browser doesn't fire touchend/pointerup events but does fire
|
||||
// native dblclicks. See #4127.
|
||||
if (!L.Browser.edge) {
|
||||
obj.addEventListener('dblclick', handler, false);
|
||||
}
|
||||
// Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180.
|
||||
obj.addEventListener('dblclick', handler, false);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -77,7 +77,10 @@ L.DomEvent = {
|
||||
if (L.Browser.pointer && type.indexOf('touch') === 0) {
|
||||
this.addPointerListener(obj, type, handler, id);
|
||||
|
||||
} else if (L.Browser.touch && (type === 'dblclick') && this.addDoubleTapListener) {
|
||||
} else if (L.Browser.touch && (type === 'dblclick') && this.addDoubleTapListener &&
|
||||
!(L.Browser.pointer && L.Browser.chrome)) {
|
||||
// Chrome >55 does not need the synthetic dblclicks from addDoubleTapListener
|
||||
// See #5180
|
||||
this.addDoubleTapListener(obj, handler, id);
|
||||
|
||||
} else if ('addEventListener' in obj) {
|
||||
|
Loading…
Reference in New Issue
Block a user