"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dom/DomEvent.DoubleTap.js" between
Leaflet-1.8.0.tar.gz and Leaflet-1.9.0.tar.gz

About: Leaflet is a JavaScript library for mobile-friendly interactive maps.

DomEvent.DoubleTap.js  (Leaflet-1.8.0):DomEvent.DoubleTap.js  (Leaflet-1.9.0)
import * as DomEvent from './DomEvent';
/* /*
* Extends the event handling code with double tap support for mobile browsers. * Extends the event handling code with double tap support for mobile browsers.
* *
* Note: currently most browsers fire native dblclick, with only a few exception s * Note: currently most browsers fire native dblclick, with only a few exception s
* (see https://github.com/Leaflet/Leaflet/issues/7012#issuecomment-595087386) * (see https://github.com/Leaflet/Leaflet/issues/7012#issuecomment-595087386)
*/ */
function makeDblclick(event) { function makeDblclick(event) {
// in modern browsers `type` cannot be just overridden: // in modern browsers `type` cannot be just overridden:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Erro rs/Getter_only // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Erro rs/Getter_only
skipping to change at line 47 skipping to change at line 49
detail = e.detail; // keep in sync to avoid false dblclic k in some cases detail = e.detail; // keep in sync to avoid false dblclic k in some cases
return; return;
} }
if (e.pointerType === 'mouse' || if (e.pointerType === 'mouse' ||
(e.sourceCapabilities && !e.sourceCapabilities.firesTouch Events)) { (e.sourceCapabilities && !e.sourceCapabilities.firesTouch Events)) {
return; return;
} }
// When clicking on an <input>, the browser generates a click on
its
// <label> (and vice versa) triggering two clicks in quick succes
sion.
// This ignores clicks on elements which are a label with a 'for'
// attribute (or children of such a label), but not children of
// a <input>.
var path = DomEvent.getPropagationPath(e);
if (path.some(function (el) {
return el instanceof HTMLLabelElement && el.attributes.fo
r;
}) &&
!path.some(function (el) {
return (
el instanceof HTMLInputElement ||
el instanceof HTMLSelectElement
);
})
) {
return;
}
var now = Date.now(); var now = Date.now();
if (now - last <= delay) { if (now - last <= delay) {
detail++; detail++;
if (detail === 2) { if (detail === 2) {
handler(makeDblclick(e)); handler(makeDblclick(e));
} }
} else { } else {
detail = 1; detail = 1;
} }
last = now; last = now;
 End of changes. 2 change blocks. 
0 lines changed or deleted 24 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)