X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-interaction-model.js;h=6f860c3b8f8a1a4535ad1ddb602b298abd8ff519;hb=214083b469aec7f51223ec5c1532924d75c6eb2f;hp=9b7feb5cc62b43deb8d68265972f04115e3a5735;hpb=6f8f19efb497197dc136647de353368581131634;p=dygraphs.git diff --git a/dygraph-interaction-model.js b/dygraph-interaction-model.js index 9b7feb5..6f860c3 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 (zoomMoved) g.clearZoomRect_(); } context.dragStartX = null; context.dragStartY = null;