X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-range-selector.js;h=9ae04d0270c2f0c5cff74fdeaa49464ba6c29bb9;hb=38dbac3e0b3c24486d3f548ae63dabd6e1d73bc3;hp=2c55194ed49bdc8159eb7072ebe1e5fb97c30cea;hpb=3810c27a7a6f3e3ac9532afa970ead0e8c7e555c;p=dygraphs.git diff --git a/dygraph-range-selector.js b/dygraph-range-selector.js index 2c55194..9ae04d0 100644 --- a/dygraph-range-selector.js +++ b/dygraph-range-selector.js @@ -255,7 +255,12 @@ DygraphRangeSelector.prototype.initInteraction_ = function() { return e.srcElement == self.iePanOverlay_; } else { // Getting clientX directly from the event is not accurate enough :( - var clientX = self.canvasRect_.x + (e.layerX !== undefined ? e.layerX : e.offsetX); + var clientX; + if (e.offsetX != undefined) { + clientX = self.canvasRect_.x + e.offsetX; + } else { + clientX = e.clientX; + } var zoomHandleStatus = self.getZoomHandleStatus_(); return (clientX > zoomHandleStatus.leftHandlePos && clientX < zoomHandleStatus.rightHandlePos); } @@ -342,24 +347,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'; @@ -477,7 +466,7 @@ DygraphRangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() { if (mutipleValues) { sum = []; count = []; - for (k = 0; k < data[0][1].length; k++) { + for (k = 0; k < data[i][1].length; k++) { sum.push(0); count.push(0); }