Improved editor zoom - #9008
Open
Raiguri wants to merge 4 commits into
Open
Conversation
tried to implement trackpad, mouse wheel, macOS speed zoom, instead of just deltaY need testing for macOS and trackpad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I hated how clunky and slow zoom was in GDevelop, so I tried to fix it and add some other things.
The main change is that zoom no longer jumps instantly. Instead we split the zoom value into a target and a current value. The target changes right away when you scroll or use keyboard shortcuts. Then every frame the current zoom moves towards the target using a logarithmic interpolation. This makes the zoom glide instead of snap, and it feels consistent at any zoom level.
I also fixed the wheel zoom to behave better on different devices (I tried to do it, because it was in ZoomUtils ToDO). A trackpad gives a continuous motion, so the zoom speed follows how fast you flick. A mouse wheel works in discrete clicks, so each click now gives a fixed step and ignores the operating system's extra scaling. But it need testing on laptop and MacOS, unfortunately I don't have access to such devices.
The code now wires everything into the main editor loop. The target zoom is stored separately from the displayed zoom, and the interpolation runs inside the render loop using the real time between frames. The zoom presets and pinch gestures still work instantly, and they reset the target so they do not fight with ongoing animations.
Video Preview
Before
Screencast_20260825_135521.webm
After
Screencast_20260825_135232.webm
#7969