From 33edd696147e551d1a10e9e00714ce6b6bdf4ec0 Mon Sep 17 00:00:00 2001 From: Nik Oleshko Date: Thu, 11 Nov 2021 17:11:19 +1000 Subject: [PATCH] - Fixed the 'handleWheelZoom' function that zoomed in incorrectly --- src/lib/Timeline.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/Timeline.js b/src/lib/Timeline.js index 1355f110a..83906ab5e 100644 --- a/src/lib/Timeline.js +++ b/src/lib/Timeline.js @@ -554,7 +554,8 @@ export default class ReactCalendarTimeline extends Component { } handleWheelZoom = (speed, xPosition, deltaY) => { - this.changeZoom(1.0 + speed * deltaY / 500, xPosition / this.state.width) + const scale = deltaY > 0 ? 1.0 + speed * deltaY / 500 : 1.0 / (1.0 + (speed * deltaY * -1 / 500)) + this.changeZoom(scale, xPosition / this.state.width) } changeZoom = (scale, offset = 0.5) => {