diff --git a/src/core.js b/src/core.js index 04eec15f..56945a0c 100644 --- a/src/core.js +++ b/src/core.js @@ -43,14 +43,14 @@ export function doZoom(chart, zoom, options = {}, useTransition) { storeOriginalScaleLimits(chart); - const xEnalbed = directionEnabled(mode, 'x', chart); - const yEnabled = directionEnabled(mode, 'y', chart); + const xEnalbed = x !== 1 && directionEnabled(mode, 'x', chart); + const yEnabled = y !== 1 && directionEnabled(mode, 'y', chart); const enabledScales = overScaleMode && getEnabledScalesByPoint(overScaleMode, focalPoint, chart); each(enabledScales || chart.scales, function(scale) { - if (x !== 1 && scale.isHorizontal() && xEnalbed) { + if (scale.isHorizontal() && xEnalbed) { zoomScale(scale, x, focalPoint, options); - } else if (y !== 1 && !scale.isHorizontal() && yEnabled) { + } else if (!scale.isHorizontal() && yEnabled) { zoomScale(scale, y, focalPoint, options); } }); @@ -87,13 +87,13 @@ export function doPan(chart, pan, options = {}, enabledScales) { storeOriginalScaleLimits(chart); - const xEnalbed = directionEnabled(mode, 'x', chart); - const yEnabled = directionEnabled(mode, 'y', chart); + const xEnalbed = x !== 0 && directionEnabled(mode, 'x', chart); + const yEnabled = y !== 0 && directionEnabled(mode, 'y', chart); each(enabledScales || chart.scales, function(scale) { - if (x !== 0 && scale.isHorizontal() && xEnalbed) { + if (scale.isHorizontal() && xEnalbed) { panScale(scale, x, options); - } else if (y !== 0 && !scale.isHorizontal() && yEnabled) { + } else if (!scale.isHorizontal() && yEnabled) { panScale(scale, y, options); } }); diff --git a/src/hammer.js b/src/hammer.js index effbd370..c4bf7110 100644 --- a/src/hammer.js +++ b/src/hammer.js @@ -102,7 +102,7 @@ function startPan(chart, state, e) { y: e.center.y - rect.top }; - state.panScales = getEnabledScalesByPoint(panOptions, point, chart); + state.panScales = getEnabledScalesByPoint(panOptions.overScaleMode, point, chart); state.delta = {x: 0, y: 0}; handlePan(chart, state, e); }