Merge pull request #472 from danvk/right-edge
authorDan Vanderkam <danvdk@gmail.com>
Sat, 22 Nov 2014 02:19:34 +0000 (21:19 -0500)
committerDan Vanderkam <danvdk@gmail.com>
Sat, 22 Nov 2014 02:19:34 +0000 (21:19 -0500)
Allow zooms to go 200px past the edge.

1  2 
dygraph.js

diff --combined 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();
      }
    };
  
  
    // 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;
 +
 +})();