Module drag_run
Expand description
DragRun: a run of items — a dock’s icons, a toolbar’s tiles, a row of
cards — in which an item can be picked up and moved to another place, and
a resource from elsewhere (an app, a file, a search result) can be dropped
in.
The gesture is Rust and runs at native refresh: a press starts a candidate,
pointer travel past the drag threshold lifts the item into a ghost, and the
place it would land is shown before it is let go, with an insertion line
across the run. Releasing reports one DragDrop: the key of the item
moved and the item it goes before, or the resource that was dropped and its
place. The owner turns that into one action on its model
(items.move(item, before: next)), so a reorder is attributed, permitted
and undone like every other change; the run then shows the item where the
model puts it.
A host whose run takes drops that start in another widget (a resource
dragged from a search result onto a dock) says what is being dragged with
DragRun::set_foreign; the run then shows the same insertion line, and
DragRun::take_foreign answers where it would land when the host’s drag
ends.
A touchscreen holds an item to lift it and then drags; a drag that begins without the hold scrolls what the run is in. Escape puts a lifted item down where it was.
Structs§
- Drag
Drop - Where a dropped thing goes: the run that took it, what moved, and the place it lands at, counted from the leading edge among the run’s other items.
- DragRun
- See the module docs.
- RunItem
- One item of a run.
Enums§
- RunAxis
- Which way a run goes.
- RunGroup
- The part of a run an item belongs to, as a bar or a dock is built: the items that lead
(a bar’s mark and menus, a dock’s launcher), those in the centre (a bar’s clock), those
that trail (the people and the status), and the ones between groups, which push the groups
apart as a
spacerdoes. A dock is one compact group at the centre of its edge, so its items are allLeadingand its run is packed.
Constants§
- ITEM_
PAYLOAD - The payload kind a run’s item travels as.