Lets you keep dragging a control (e.g. a rotary knob) past the window/screen edge and have the value keep changing. While a drag is active, the OS cursor is hidden and pinned, and Slint receives an accumulated "virtual" position so the drag distance grows without bound. On release the cursor reappears (and optionally warps back to where the drag started).
Stock baseview (0.1.x) has no cursor warp/hide/relative-pointer API. Rather than fork it, this adds a small self-contained cursor shim inside slint-baseview, so it works against stock baseview.
Usage
Enable on pointer-down; release disables it automatically (like JUCE's auto-disable on mouse-up):
letmouse=handler.mouse_control();// Clone + Send + Sync handle
handler.component().on_drag_started(move||mouse.enable_unbounded_movement(true));
Demo: cargo run --example unbounded_drag.
Per platform
- macOS — freezes the cursor (
CGAssociateMouseAndMouseCursorPosition), reads motion from CGGetLastMouseDelta. Pure CoreGraphics FFI.
- Windows / X11 — warp cursor back to window center each move; delta measured from center. (haven't tested)
- Other — no-op.
Files
src/cursor.rs — new: the SlintMouseControl handle, state machine, and platform backends.
src/lib.rs — wires it into SlintWindowHandler; auto-disables on pointer release.
build.rs + examples/unbounded_drag/ — the demo.
Lets you keep dragging a control (e.g. a rotary knob) past the window/screen edge and have the value keep changing. While a drag is active, the OS cursor is hidden and pinned, and Slint receives an accumulated "virtual" position so the drag distance grows without bound. On release the cursor reappears (and optionally warps back to where the drag started).
Stock baseview (0.1.x) has no cursor warp/hide/relative-pointer API. Rather than fork it, this adds a small self-contained cursor shim inside `slint-baseview`, so it works against stock baseview.
### Usage
Enable on pointer-down; release disables it automatically (like JUCE's auto-disable on mouse-up):
```rust
let mouse = handler.mouse_control(); // Clone + Send + Sync handle
handler.component().on_drag_started(move || mouse.enable_unbounded_movement(true));
```
Demo: `cargo run --example unbounded_drag`.
### Per platform
- **macOS** — freezes the cursor (`CGAssociateMouseAndMouseCursorPosition`), reads motion from `CGGetLastMouseDelta`. Pure CoreGraphics FFI.
- **Windows / X11** — warp cursor back to window center each move; delta measured from center. (haven't tested)
- **Other** — no-op.
### Files
- `src/cursor.rs` — new: the `SlintMouseControl` handle, state machine, and platform backends.
- `src/lib.rs` — wires it into `SlintWindowHandler`; auto-disables on pointer release.
- `build.rs` + `examples/unbounded_drag/` — the demo.