mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Fix scroll zooming
This commit is contained in:
parent
0d9bb71d3c
commit
901d40ba11
1 changed files with 4 additions and 6 deletions
|
@ -25,6 +25,7 @@ from manimlib.constants import DEFAULT_WAIT_TIME
|
||||||
from manimlib.constants import COMMAND_MODIFIER
|
from manimlib.constants import COMMAND_MODIFIER
|
||||||
from manimlib.constants import SHIFT_MODIFIER
|
from manimlib.constants import SHIFT_MODIFIER
|
||||||
from manimlib.constants import RED
|
from manimlib.constants import RED
|
||||||
|
from manimlib.constants import FRAME_HEIGHT
|
||||||
from manimlib.event_handler import EVENT_DISPATCHER
|
from manimlib.event_handler import EVENT_DISPATCHER
|
||||||
from manimlib.event_handler.event_type import EventType
|
from manimlib.event_handler.event_type import EventType
|
||||||
from manimlib.logger import log
|
from manimlib.logger import log
|
||||||
|
@ -871,14 +872,11 @@ class Scene(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
frame = self.camera.frame
|
frame = self.camera.frame
|
||||||
offset *= self.scroll_sensitivity
|
|
||||||
if self.window.is_key_pressed(ord(ZOOM_KEY)):
|
if self.window.is_key_pressed(ord(ZOOM_KEY)):
|
||||||
frame.scale(
|
ff_offset = offset * FRAME_HEIGHT / frame.get_height()
|
||||||
1 - offset[1] / frame.get_height(),
|
frame.scale(1 - ff_offset[1], about_point=point)
|
||||||
about_point=point
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
frame.shift(-offset)
|
frame.shift(-self.scroll_sensitivity * offset)
|
||||||
|
|
||||||
def on_key_release(
|
def on_key_release(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Add table
Reference in a new issue