X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=dygraph.js;fp=dygraph.js;h=49b13e6ada0bc2e2e7bc4dfb5329fcff15187782;hb=3f50dabbb12935605812184bfdd4a1485b1b9530;hp=7dbf29fdde56640b87f9399651c5caf455872e9b;hpb=867786ec641724e1e8970f1d5a961e3e9be400df;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 7dbf29f..49b13e6 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1489,6 +1489,26 @@ Dygraph.prototype.createDragInterface_ = function() { contextB.dragStartY = Dygraph.dragGetY_(event, contextB); contextB.cancelNextDblclick = false; contextB.tarp.cover(); + }, + destroy: function() { + var context = this; + if (context.isZooming || context.isPanning) { + context.isZooming = false; + context.dragStartX = null; + context.dragStartY = null; + } + + if (context.isPanning) { + context.isPanning = false; + context.draggingDate = null; + context.dateRange = null; + for (var i = 0; i < self.axes_.length; i++) { + delete self.axes_[i].draggingValue; + delete self.axes_[i].dragValueRange; + } + } + + context.tarp.uncover(); } }; @@ -1512,27 +1532,13 @@ Dygraph.prototype.createDragInterface_ = function() { // If the user releases the mouse button during a drag, but not over the // canvas, then it doesn't count as a zooming action. - var mouseUpHandler = function(event) { - if (context.isZooming || context.isPanning) { - context.isZooming = false; - context.dragStartX = null; - context.dragStartY = null; - } - - if (context.isPanning) { - context.isPanning = false; - context.draggingDate = null; - context.dateRange = null; - for (var i = 0; i < self.axes_.length; i++) { - delete self.axes_[i].draggingValue; - delete self.axes_[i].dragValueRange; - } - } - - context.tarp.uncover(); - }; + if (!interactionModel.willDestroyContextMyself) { + var mouseUpHandler = function(event) { + context.destroy(); + }; - this.addAndTrackEvent(document, 'mouseup', mouseUpHandler); + this.addAndTrackEvent(document, 'mouseup', mouseUpHandler); + } }; /**