X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=dygraph-interaction-model.js;h=53e2f44d58839a1477e307aca76c81a5e9e7f868;hb=9f3f36f8d64ac0caebac4fa085eb6640f85d8923;hp=e0b7630eb7fcdd2cfa94e98ba39a6e76a03e4560;hpb=3f50dabbb12935605812184bfdd4a1485b1b9530;p=dygraphs.git diff --git a/dygraph-interaction-model.js b/dygraph-interaction-model.js index e0b7630..53e2f44 100644 --- a/dygraph-interaction-model.js +++ b/dygraph-interaction-model.js @@ -19,7 +19,7 @@ * be considered a zoom. This makes it easier to zoom to the exact edge of the * chart, a fairly common operation. */ -var DRAG_EDGE_MARGIN = 200; +var DRAG_EDGE_MARGIN = 100; /** * A collection of functions to facilitate build custom interaction models. @@ -49,7 +49,7 @@ Dygraph.Interaction.maybeTreatMouseOpAsClick = function(event, g, context) { context.regionWidth = regionWidth; context.regionHeight = regionHeight; -} +}; /** * Called in response to an interaction model operation that @@ -371,6 +371,7 @@ Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) { * context. */ Dygraph.Interaction.endZoom = function(event, g, context) { + g.clearZoomRect_(); context.isZooming = false; Dygraph.Interaction.maybeTreatMouseOpAsClick(event, g, context); @@ -398,8 +399,6 @@ Dygraph.Interaction.endZoom = function(event, g, context) { g.doZoomY_(top, bottom); } context.cancelNextDblclick = true; - } else { - if (context.zoomMoved) g.clearZoomRect_(); } context.dragStartX = null; context.dragStartY = null; @@ -652,7 +651,7 @@ Dygraph.Interaction.defaultModel = { if (context.isZooming) { // When the mouse moves >200px from the chart edge, cancel the zoom. var d = distanceFromChart(event, g); - if (d < 200) { + if (d < DRAG_EDGE_MARGIN) { Dygraph.moveZoom(event, g, context); } else { if (context.dragEndX !== null) {