From: Dan Vanderkam Date: Sat, 22 Nov 2014 02:19:34 +0000 (-0500) Subject: Merge pull request #472 from danvk/right-edge X-Git-Tag: v1.1.0~18 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=d55a912ad2c97a3a0e4de0144157a761005494b3;hp=-c;p=dygraphs.git Merge pull request #472 from danvk/right-edge Allow zooms to go 200px past the edge. --- d55a912ad2c97a3a0e4de0144157a761005494b3 diff --combined dygraph.js index 49ecc3e,49b13e6..a87695a --- a/dygraph.js +++ b/dygraph.js @@@ -46,7 -46,6 +46,7 @@@ // For "production" code, this gets set to false by uglifyjs. if (typeof(DEBUG) === 'undefined') DEBUG=true; +var Dygraph = (function() { /*jshint globalstrict: true */ /*global DygraphLayout:false, DygraphCanvasRenderer:false, DygraphOptions:false, G_vmlCanvasManager:false,ActiveXObject:false */ "use strict"; @@@ -335,6 -334,7 +335,6 @@@ Dygraph.DEFAULT_ATTRS = axisLineWidth: 0.3, gridLineWidth: 0.3, axisLabelColor: "black", - axisLabelFont: "Arial", // TODO(danvk): is this implemented? axisLabelWidth: 50, drawYGrid: true, drawXGrid: true, @@@ -1489,6 -1489,26 +1489,26 @@@ Dygraph.prototype.createDragInterface_ 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 +1532,13 @@@ // 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); + } }; /** @@@ -3794,7 -3800,3 +3800,7 @@@ Dygraph.addAnnotationRule = function() console.warn("Unable to add default annotation CSS rule; display may be off."); }; + +return Dygraph; + +})();