bevy_rts_camera icon indicating copy to clipboard operation
bevy_rts_camera copied to clipboard

Add option to restrict edge panning to camera viewport

Open Thelonedevil opened this issue 1 month ago • 3 comments

Adds a new configurable option to make edge panning respect a camera's viewport instead of the full window. When enabled, edge pan calculations use the viewport's physical size and position, translate the cursor into viewport space, and ignore edge panning if the cursor lies outside the viewport. The default remains window-wide behavior.

This allows edge panning to behave correctly for cameras with sub-window viewports (e.g., split screens or UI panels) and prevents unintended panning when the cursor is outside a camera's viewport.

Thelonedevil avatar Nov 16 '25 14:11 Thelonedevil

Hey, sorry for delay. I tested this and it doesn't work for me. As in, it still only pans at the edge of the window, not the edge of the viewport. I haven't looked into it yet, but I wanted to let you know I haven't forgotten about this, just been busy.

Plonq avatar Nov 24 '25 09:11 Plonq

I have recorded a short video showing how the new example behaves with the setting on and then off (current behaviour). This is on a Windows 11 machine

Thelonedevil avatar Nov 25 '25 19:11 Thelonedevil

Hmm, so I'm on Mac and this is what it does. It's interesting that the bottom edge doesn't do anything. Might be a clue. Sorry haven't had a chance to properly debug yet.

https://github.com/user-attachments/assets/05b1fb07-f3aa-4256-9aef-a25131f6d4a9

Plonq avatar Nov 29 '25 02:11 Plonq

I can recreate the behavior you see, on a Linux machine I now have access to, I will dig into it further

Thelonedevil avatar Dec 02 '25 18:12 Thelonedevil

Seems unrelated to platform, and instead related to display scaling, my windows machine is at 100% scaling, the linux machine is at 200% scaling. The viewport is always in physical pixels, but the existing panning was all using logical pixels.

Thelonedevil avatar Dec 02 '25 19:12 Thelonedevil