godot icon indicating copy to clipboard operation
godot copied to clipboard

`ViewPanner` panning-mouse-warp doesn't work in SubViewports or embedded Windows

Open Sauermann opened this issue 1 year ago • 0 comments

Tested versions

  • reproducible in v4.0.stable.official [92bee43ad] and v4.4.dev.custom_build [b9437c393]

System information

Debian Linux X11

Issue description

Using a GraphEdit in a SubViewport or in an embedded Window has currently the problem, that panning doesn't work, when moving the mouse out of the GraphEdit area. In that case, the mouse cursor jumps in unexpected ways:

  • In a SubViewport, this leads the mouse to be shifted by the distance from the top-left corner of the root window to the top-left corner of the SubViewportContainer.
  • In an embedded Window, this leads the mouse to be constantly jumping around.

I would expect, that the mouse reappears on the other side of the GraphEdit area without lateral movement.

https://github.com/user-attachments/assets/7a4fd227-fe27-44d3-ba62-ecf53f240c45

I have tracked this to:

https://github.com/godotengine/godot/blob/b9437c393871c377b5ece131afaf831e78dfb6f8/scene/gui/view_panner.cpp#L113

Input::get_singleton()->warp_mouse_motion assumes, that its argument are in root-viewport coordinates, which they are not.

Steps to reproduce

  1. Load and run MRP
  2. Try panning with the middle mouse button as shown in the video above

Minimal reproduction project (MRP)

viewpanner-in-subviewport.zip

Sauermann avatar Dec 15 '24 16:12 Sauermann