1 L
.Util
.extend(L
.DomEvent
, {
2 // inspired by Zepto touch code by Thomas Fuchs
3 addDoubleTapListener: function(obj
, handler
, id
) {
9 touchstart
= 'touchstart',
10 touchend
= 'touchend';
12 function onTouchStart(e
) {
13 if (e
.touches
.length
!= 1) return;
16 delta
= now
- (last
|| now
);
19 doubleTap
= (delta
> 0 && delta
<= delay
);
22 function onTouchEnd(e
) {
24 touch
.type
= 'dblclick';
29 obj
[pre
+ touchstart
+ id
] = onTouchStart
;
30 obj
[pre
+ touchend
+ id
] = onTouchEnd
;
32 obj
.addEventListener(touchstart
, onTouchStart
, false);
33 obj
.addEventListener(touchend
, onTouchEnd
, false);
36 removeDoubleTapListener: function(obj
, id
) {
37 var pre
= '_leaflet_';
38 obj
.removeEventListener(obj
, obj
[pre
+ 'touchstart' + id
], false);
39 obj
.removeEventListener(obj
, obj
[pre
+ 'touchend' + id
], false);