UmbraLuminosa / sickle_ui

A widget library built on top of bevy_ui.
Apache License 2.0
205 stars 24 forks source link

Fix drag behavior on macOS for Draggable #31

Closed physgun closed 1 month ago

physgun commented 1 month ago

Objective

Bevy's default behavior with CursorGrab results in macOS users having stuck, halting dragging behavior. However, even with the CursorGrab removed, the dragging behavior on macOS still felt sticky and gunky. This PR makes some small adjustments to drag_interaction.rs and results in smooth drag behavior on macs. Fixes #9 .

Solution

Removed CursorGrab system from drag_interaction.rs. Added a RelativeCursorPosition component to all widget nodes that have Draggable, and used it as an alternative way to find the cursor position in drag_interaction.rs.

Testing

Tested on a Mac and a Windows machine, on my project and both sickle_ui examples, simple_editor and docking_zone_splits.