X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fdygraph-interaction-model.js;h=411aae4918bc36ad8afd2991a0039137b7b4d3f0;hb=7a180bd1f113816214c5ed5d90b4a9314658c940;hp=53e2f44d58839a1477e307aca76c81a5e9e7f868;hpb=07cae5dd0adbcee97689ffa6099a6b0e8665011b;p=dygraphs.git diff --git a/src/dygraph-interaction-model.js b/src/dygraph-interaction-model.js index 53e2f44..411aae4 100644 --- a/src/dygraph-interaction-model.js +++ b/src/dygraph-interaction-model.js @@ -429,7 +429,9 @@ Dygraph.Interaction.startTouch = function(event, g, context) { context.initialTouches = touches; if (touches.length == 1) { - // This is just a swipe. + // This is possbily a touchOVER, save the last touch to check + context.lastTouch = event; + // or This is just a swipe. context.initialPinchCenter = touches[0]; context.touchDirections = { x: true, y: true }; } else if (touches.length >= 2) { @@ -474,6 +476,9 @@ Dygraph.Interaction.startTouch = function(event, g, context) { Dygraph.Interaction.moveTouch = function(event, g, context) { // If the tap moves, then it's definitely not part of a double-tap. context.startTimeForDoubleTapMs = null; + + // clear the last touch if it's doing something else + context.lastTouch = null; var i, touches = []; for (i = 0; i < event.touches.length; i++) { @@ -580,6 +585,13 @@ Dygraph.Interaction.endTouch = function(event, g, context) { context.doubleTapY && Math.abs(context.doubleTapY - t.screenY) < 50) { g.resetZoom(); } else { + + if (context.lastTouch !== null){ + // no double-tap, pan or pinch so it's a touchOVER + event.isTouchOver = true; + g.mouseMove(event); + } + context.startTimeForDoubleTapMs = now; context.doubleTapX = t.screenX; context.doubleTapY = t.screenY;