X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-interaction-model.js;h=4df67997104dd81e9f37950deb234488c970dbaf;hb=5cc10af9e1ab0201f1108563581b268dada03c64;hp=9b7feb5cc62b43deb8d68265972f04115e3a5735;hpb=d9d48846fc6ed2c773dc95144f0e4e4e68dd6f6f;p=dygraphs.git diff --git a/dygraph-interaction-model.js b/dygraph-interaction-model.js index 9b7feb5..4df6799 100644 --- a/dygraph-interaction-model.js +++ b/dygraph-interaction-model.js @@ -220,6 +220,7 @@ Dygraph.Interaction.endPan = function(event, g, context) { */ Dygraph.Interaction.startZoom = function(event, g, context) { context.isZooming = true; + context.zoomMoved = false; }; /** @@ -236,6 +237,7 @@ Dygraph.Interaction.startZoom = function(event, g, context) { * dragStartX/dragStartY/etc. properties). This function modifies the context. */ Dygraph.Interaction.moveZoom = function(event, g, context) { + context.zoomMoved = true; context.dragEndX = g.dragGetX_(event, context); context.dragEndY = g.dragGetY_(event, context); @@ -335,7 +337,7 @@ Dygraph.Interaction.endZoom = function(event, g, context) { Math.max(context.dragStartY, context.dragEndY)); context.cancelNextDblclick = true; } else { - g.clearZoomRect_(); + if (context.zoomMoved) g.clearZoomRect_(); } context.dragStartX = null; context.dragStartY = null; @@ -483,7 +485,7 @@ Dygraph.Interaction.moveTouch = function(event, g, context) { * @private */ Dygraph.Interaction.endTouch = function(event, g, context) { - if (event.touches.length != 0) { + if (event.touches.length !== 0) { // this is effectively a "reset" Dygraph.Interaction.startTouch(event, g, context); }