From 901d40ba1144290f682d112342da43733477dd1f Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Sat, 28 Jan 2023 22:53:56 -0800 Subject: [PATCH] Fix scroll zooming --- manimlib/scene/scene.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/manimlib/scene/scene.py b/manimlib/scene/scene.py index d9bc273a..ab096b77 100644 --- a/manimlib/scene/scene.py +++ b/manimlib/scene/scene.py @@ -25,6 +25,7 @@ from manimlib.constants import DEFAULT_WAIT_TIME from manimlib.constants import COMMAND_MODIFIER from manimlib.constants import SHIFT_MODIFIER from manimlib.constants import RED +from manimlib.constants import FRAME_HEIGHT from manimlib.event_handler import EVENT_DISPATCHER from manimlib.event_handler.event_type import EventType from manimlib.logger import log @@ -871,14 +872,11 @@ class Scene(object): return frame = self.camera.frame - offset *= self.scroll_sensitivity if self.window.is_key_pressed(ord(ZOOM_KEY)): - frame.scale( - 1 - offset[1] / frame.get_height(), - about_point=point - ) + ff_offset = offset * FRAME_HEIGHT / frame.get_height() + frame.scale(1 - ff_offset[1], about_point=point) else: - frame.shift(-offset) + frame.shift(-self.scroll_sensitivity * offset) def on_key_release( self,