Expand description
panel — content that floats over a page and is dragged around it: a
meter, an inspector, a detached preview.
The panel lays a full-size layer over its container and places the box
inside it, because the drag has to be heard somewhere larger than the thing
being dragged: a pointer that outruns a frame lands outside a box-sized
hitbox, and the gesture stalls with the box stranded behind the cursor.
crate::scroll hangs its thumb drag off the track for the same reason.
ⓘ
// The state is a field of the view that mounts it; the panel is one line.
div().relative().size_full()
.child(page)
.child(floating::panel("meter", &self.meter, home, self.stats.clone()))It clamps nothing and remembers nothing across launches. A panel dragged half off the window stays there, and the point it was grabbed by is under the pointer, so it can always be dragged back.
Structs§
- Floating
- Where a panel sits, and where inside it the pointer took hold. A field of
the view that mounts the panel, like
crate::scroll::ScrollbarState— and, for the same reason, carrying its ownPainter: a drag runs in event-dispatch context, where the window cannot resolve which view is asking to be redrawn.