Permalink
Browse files

Double-tap now seems to work

git-svn-id: https://modestmaps.googlecode.com/svn/trunk/js@914 a23cadb0-8de1-11de-82e5-a1837a67dc72
  • Loading branch information...
1 parent 64a6aa0 commit 058baf44372ad167c2aeaa06c8c2f2207cf15426 migurski committed Jun 14, 2010
Showing with 23 additions and 1 deletion.
  1. +23 −1 examples/touch/index.html
View
@@ -192,8 +192,9 @@
maxTapTime: 150,
maxTapDistance: 10,
- maxDoubleTapDelay: 150,
+ maxDoubleTapDelay: 350,
events: [],
+ taps: [],
getTouchStartMachineHandler: null,
@@ -341,7 +342,28 @@
onTap: function(tap)
{
+ if(this.taps.length && (tap.time - this.taps[0].time) < this.maxDoubleTapDelay)
+ {
+ this.onDoubleTap(tap);
+ return;
+ }
+
stderr('Tap: (' + tap.x + ', ' + tap.y + ')');
+
+ this.taps = [tap];
+ },
+
+ onDoubleTap: function(tap)
+ {
+ stderr('Double-tap: (' + tap.x + ', ' + tap.y + ')');
+
+ // zoom in to a round number
+ var z = Math.floor(this.map.getZoom() + 2);
+ z = z - this.map.getZoom();
+
+ var p = new MM.Point(tap.x, tap.y);
+
+ this.map.zoomByAbout(z, p);
},
onPanning: function(touch)

0 comments on commit 058baf4

Please sign in to comment.