From: Dan Vanderkam Date: Mon, 23 Jan 2012 18:16:50 +0000 (-0500) Subject: Expose range selector interaction model publicly (removes need for pull request 101). X-Git-Tag: v1.0.0~337 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=3417f017bd94da8dd934e5a60c2807511005e21c;p=dygraphs.git Expose range selector interaction model publicly (removes need for pull request 101). --- diff --git a/dygraph-interaction-model.js b/dygraph-interaction-model.js index 55184ec..a3de6f7 100644 --- a/dygraph-interaction-model.js +++ b/dygraph-interaction-model.js @@ -418,3 +418,21 @@ Dygraph.Interaction.nonInteractiveModel_ = { } } }; + +// Default interaction model when using the range selector. +Dygraph.Interaction.dragIsPanInteractionModel = { + mousedown: function(event, g, context) { + context.initializeMouseDown(event, g, context); + Dygraph.startPan(event, g, context); + }, + mousemove: function(event, g, context) { + if (context.isPanning) { + Dygraph.movePan(event, g, context); + } + }, + mouseup: function(event, g, context) { + if (context.isPanning) { + Dygraph.endPan(event, g, context); + } + } +}; diff --git a/dygraph-range-selector.js b/dygraph-range-selector.js index fe69864..3c76338 100644 --- a/dygraph-range-selector.js +++ b/dygraph-range-selector.js @@ -342,24 +342,8 @@ DygraphRangeSelector.prototype.initInteraction_ = function() { } }; - var interactionModel = { - mousedown: function(event, g, context) { - context.initializeMouseDown(event, g, context); - Dygraph.startPan(event, g, context); - }, - mousemove: function(event, g, context) { - if (context.isPanning) { - Dygraph.movePan(event, g, context); - } - }, - mouseup: function(event, g, context) { - if (context.isPanning) { - Dygraph.endPan(event, g, context); - } - } - }; - - this.dygraph_.attrs_.interactionModel = interactionModel; + this.dygraph_.attrs_.interactionModel = + Dygraph.Interaction.dragIsPanInteractionModel; this.dygraph_.attrs_.panEdgeFraction = 0.0001; var dragStartEvent = window.opera ? 'mousedown' : 'dragstart';