X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdygraph-interaction-model.js;h=6557b116b6fd826cfb2a5436e7e0711ee2c789c4;hb=HEAD;hp=349fd3e579124f8a75ccc4ab733de36682ce460e;hpb=6e20721120a88fcf451c19559dfc62e2d316dd85;p=dygraphs.git diff --git a/src/dygraph-interaction-model.js b/src/dygraph-interaction-model.js index 349fd3e..6557b11 100644 --- a/src/dygraph-interaction-model.js +++ b/src/dygraph-interaction-model.js @@ -430,7 +430,9 @@ DygraphInteraction.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) { @@ -475,6 +477,9 @@ DygraphInteraction.startTouch = function(event, g, context) { DygraphInteraction.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++) { @@ -581,6 +586,13 @@ DygraphInteraction.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; @@ -706,7 +718,8 @@ DygraphInteraction.defaultModel = { // Give plugins a chance to grab this event. var e = { canvasx: context.dragEndX, - canvasy: context.dragEndY + canvasy: context.dragEndY, + cancelable: true, }; if (g.cascadeEvents_('dblclick', e)) { return;