ComponentDragger — drag-to-move helper for any View. More...
Go to the source code of this file.
Classes | |
| class | pulp::view::ComponentDragger |
Namespaces | |
| namespace | pulp |
| namespace | pulp::view |
| Hover-cursor tracking for platform window hosts. | |
ComponentDragger — drag-to-move helper for any View.
A ComponentDragger adds "click and drag to move me within my parent" behavior to any View. It is intentionally a free helper (not a mixin) so that owners stay in control of which mouse phases get forwarded.
Usage:
start_dragging() snapshots the drag origin (in the dragged view's local coordinates) plus the view's bounds at gesture start. drag_view() translates the bounds by the delta between the current pointer position and that snapshot, optionally constraining the new origin so the view stays inside its parent's local bounds.
Headless-friendly: no window host, no scheduler. Pure arithmetic over the dragged view's bounds; tests can call start_dragging / drag_view directly without simulating real mouse events.
License-lineage note: the name is Pulp-native. The behavior mirrors a well-trodden idiom across UI toolkits, but the implementation here is independent.