Skip to content

[Editor] Fix AnimationStateMachineEditor pans - #123155

Open
adamscott wants to merge 1 commit into
godotengine:masterfrom
adamscott:fix-pan-animation-state-machine-editor
Open

[Editor] Fix AnimationStateMachineEditor pans#123155
adamscott wants to merge 1 commit into
godotengine:masterfrom
adamscott:fix-pan-animation-state-machine-editor

Conversation

@adamscott

Copy link
Copy Markdown
Member

What problem(s) does this PR solve?

Additional information

It fixes the pan using the mouse and using a pan gesture (with a trackpad).

Mouse fix

It's now fixed for screens with > 100% scale. The mouse cursor now follow the contents that pan.

Before After
Enregistrement.d.ecran.le.2026-09-03.a.16.05.44.webm
Enregistrement.d.ecran.le.2026-09-03.a.16.12.58.webm

Pan gesture fix

It now uses the real difference in pixels instead of relying on a weird formula.

Before After
Enregistrement.d.ecran.le.2026-09-03.a.16.06.04.webm
Enregistrement.d.ecran.le.2026-09-03.a.16.13.22.webm

@GalaxyShard

Copy link
Copy Markdown

I tried this patch out on Linux (Wayland), and it appears that the division by the screen scale actually causes panning to slow down on HiDPI displays rather than becoming screen-scale independent. I updated my PR #111305 (haven't pushed yet) to apply the same fix in this PR to the other uses of pan_gesture.delta(), e.g., in scene/gui/tree.cpp, and scrolling the scene tree and AnimationStateMachineEditor noticeably slows down when testing with a 3x screen scaling factor (I tested with 1x, 2x, and 3x scaling factors, on the same device). Removing the EDSCALE factor seems to fix the issue.

Does MacOS currently have any issues with the scroll speed (especially on 1x scale) in the scene tree? Just wondering if the scale of this problem on MacOS extends past the AnimationStateMachineEditor. If I assume it does, then screens with 1x scale should be slower to scroll the scene tree, and higher screen scales would make it faster (because scene/gui/tree.cpp doesn't account for the screen scale, and if it needs to by dividing the screen scale in the way that AnimationStateMachineEditor does, then that would imply the pan deltas get scaled up by the screen scale, thus faster scrolling on larger scales). If all of this is true, then it may make more sense to factor in the screen scale earlier, in platform-specific code instead, e.g., in platform/macos/godot_content_view.mm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Editor] AnimationTreeStateMachineEditor is now panning way to fast on macOS using pan gestures

2 participants