Skip to content

Commit b85f6c7

Browse files
nagixbenmccann
authored andcommitted
Fix the calculation of the zoom focal point coordinate when dragging (#161)
1 parent e53ee6e commit b85f6c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/chart.zoom.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ var zoomPlugin = {
413413

414414
if (dragDistanceX > 0 || dragDistanceY > 0) {
415415
doZoom(chartInstance, zoomX, zoomY, {
416-
x: dragDistanceX / 2 + startX,
417-
y: dragDistanceY / 2 + startY,
416+
x: (startX - chartArea.left) / (1 - dragDistanceX / chartDistanceX) + chartArea.left,
417+
y: (startY - chartArea.top) / (1 - dragDistanceY / chartDistanceY) + chartArea.top
418418
});
419419
}
420420
}

0 commit comments

Comments
 (0)