X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-interaction-model.js;h=2af345c7dcf7f4f7fe18d9871dc1db4900bc76af;hb=e43d4d238ae016b477aee3f60f1707fb4effacd3;hp=38e63d941daaabbc277e4909aeef56bf4ee9427b;hpb=745e9e52bf0c9fe1eec18ad64d76787419b033f4;p=dygraphs.git diff --git a/dygraph-interaction-model.js b/dygraph-interaction-model.js index 38e63d9..2af345c 100644 --- a/dygraph-interaction-model.js +++ b/dygraph-interaction-model.js @@ -63,8 +63,8 @@ Dygraph.Interaction.startPan = function(event, g, context) { var boundedTopY = g.toDomYCoord(yExtremes[0], i) + maxYPixelsToDraw; var boundedBottomY = g.toDomYCoord(yExtremes[1], i) - maxYPixelsToDraw; - var boundedTopValue = g.toDataYCoord(boundedTopY); - var boundedBottomValue = g.toDataYCoord(boundedBottomY); + var boundedTopValue = g.toDataYCoord(boundedTopY, i); + var boundedBottomValue = g.toDataYCoord(boundedBottomY, i); boundedValues[i] = [boundedTopValue, boundedBottomValue]; } @@ -136,12 +136,13 @@ Dygraph.Interaction.movePan = function(event, g, context) { // y-axis scaling is automatic unless this is a full 2D pan. if (context.is2DPan) { + + var pixelsDragged = context.dragEndY - context.dragStartY; + // Adjust each axis appropriately. for (var i = 0; i < g.axes_.length; i++) { var axis = g.axes_[i]; var axis_data = context.axes[i]; - - var pixelsDragged = context.dragEndY - context.dragStartY; var unitsDragged = pixelsDragged * axis_data.unitsPerPixel; var boundedValue = context.boundedValues ? context.boundedValues[i] : null;