Add Blender-style infinite mouse drag to Engine#10677
Open
themightypooh wants to merge 1 commit intoFacepunch:masterfrom
Open
Add Blender-style infinite mouse drag to Engine#10677themightypooh wants to merge 1 commit intoFacepunch:masterfrom
themightypooh wants to merge 1 commit intoFacepunch:masterfrom
Conversation
|
Thank god this was really needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Thanks for contributing to s&box ❤️
Please fill out the sections below to help us review your change efficiently.
Summary
Adds a "Blender-style" infinite mouse drag feature to the engine and editor. When a user is holding the left mouse button (dragging a slider, rotating a gizmo, etc.) and their cursor hits the edge of the screen, it smoothly wraps to the opposite side of the monitor.
Motivation & Context
This is a massive Quality of Life (QoL) improvement for the Editor. Currently, when tweaking large numeric values (like object transforms, lighting intensities, or cloth physics), users frequently hit the physical edge of their monitor and have to drop the slider, reposition their mouse, and click again.
This brings s&box's input feel up to parity with industry-standard 3D software like Blender, making value-scrubbing feel completely frictionless.
Implementation Details
The logic is injected into the core Sandbox.Mouse class to ensure it works globally across UI elements.
Opt-out functionality: Added a public InfiniteDrag toggle (defaulted to true) so users or developers can disable it if it conflicts with specific project needs.
Drag Detection: The wrap only triggers if Input.Down("mouse1") is true, preventing the mouse from wildly teleporting during normal navigation.
The Delta Fix: Added an internal _isWarping flag. When the cursor is teleported via Game.InputContext.SetMousePosition, this flag intercepts the Delta property for that specific frame and returns Vector2.Zero. This prevents the engine from reading a massive -1920px jump and violently snapping the camera or UI values.
Screenshots / Videos (if applicable)
mousedrag.mp4
Checklist