-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ViewPanner
panning-mouse-warp
#100444
Fix ViewPanner
panning-mouse-warp
#100444
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally on Windows 11 after I realized that mouse warping doesn't work on Wayland currenlty (although unrelated to this PR).
Works great! Implementation looks fine too, although I would call the new method Viewport::wrap_mouse_in_rect
instead of Viewport::warp_mouse_into_rect
(wrap not warp, no typo here ;) Since wrapping more accurately/commonly describes the concept of something going out of bounds on one side and appearing on the other; so wrapping the mouse pointer in[side] the rect is done via warping it to specific position at the right time. Besides that, "wrap...into" implies that it just moves the mouse into a rectangle).
4664c64
to
0568cbf
Compare
Makes sense. I have updated the function name. |
Does |
When moving the node to a different location in the scene tree, it's possible, that setting a different viewport is required. So I believe, that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks fine.
Currently the mouse cursor jumps in unexpected ways, when a `ViewPanner` is used in SubViewports or embedded Windows. This is caused by providing wrong coordinate systems to Input::warp_mouse_motion. This PR replaces the use of `Input::warp_mouse_motion` with `Viewport::wrap_mouse_in_rect` and makes sure, that the correct coordinate systems are used. This change makes it necessary, that all classes, that currently use ViewPanner, need to provide the correct Viewport to ViewPanner.
0568cbf
to
4887172
Compare
Thanks! |
Currently the mouse cursor jumps in unexpected ways, when a
ViewPanner
is used in SubViewports or embedded Windows.This is caused by providing wrong coordinate systems to Input::warp_mouse_motion.
This PR replaces the use of
Input::warp_mouse_motion
withViewport::wrap_mouse_in_rect
and makes sure, that the correct coordinate systems are used.This change makes it necessary, that all classes, that currently use ViewPanner, need to provide the correct Viewport to ViewPanner (necessary changes are included in this PR).
The obligatory before and after:
BugViewPannerMouseWarp.mp4
FixViewPannerMouseWarp.mp4
ViewPanner
panning-mouse-warp doesn't work in SubViewports or embedded Windows #100438One long-term goal of this PR is to move
Input::warp_mouse_motion
from Input to Viewport. It doesn't directly require any functionality of theInput
class and so it makes sense to move it to a class that is not in core.Viewport::wrap_mouse_in_rect