Skip to main content

Module drag

Module drag 

Source
Expand description

Drag and drop reordering over gpui’s active drag.

The gesture is gpui’s: a Handle puts on_drag on the host’s element, and the payload is a Carry. Any element can take part in the same drag with on_drag_move::<Carry<I>> and on_drop::<Carry<I>> — crate::docking does.

A Domain adds landing, displacement and edge scrolling for the Regions it builds. The host lays out, scrolls and virtualizes each region’s content; a region measures the handles painted inside it in the frame being drawn, and nothing else. A landing names its neighbours by id, so a list with rows that were not painted still gets an exact place.

Keep one domain on the view that renders all of its regions.

Structs§

Carry
gpui’s drag payload for an item of a Domain.
Domain
Gesture and animation state for the regions items move between.
Drop
Where a released item goes. after and before are its neighbours among the items painted in region at release; either is None at an end of what was painted.
Ghosted
The view gpui paints under the pointer: the domain’s ghost, or nothing.
Handle
An element that can be picked up, measured by the region it is painted in.
Outside
A release over no region that accepts the item. Nothing is committed.
Region
A drop target whose content the host lays out. Style it as the box that holds the content: its visible bounds are where it takes the pointer.

Enums§

Feedback
How a region shows where the item would land.

Traits§

Carried
A dragged item’s floating copy.