Skip to content
Merged
20 changes: 10 additions & 10 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,20 +212,20 @@ impl<'b, 'f, A> Builder<'b, 'f, A> {
pub fn div_id(&mut self, key: K, tw: Tw, body: impl FnOnce(&mut S)) -> NodeHandle; // children scoped under key

// ---- identified leaves
pub fn custom(&mut self, key: K, tw: Tw) -> CustomChain; // [.measure(f)] [.named(n)] [.tooltip(t)] [.on_response(f)] .ui(|app, ui| …)
pub fn custom(&mut self, key: K, tw: Tw) -> custom::Chain; // [.measure(f)] [.named(n)] [.tooltip(t)] [.on_response(f)] .ui(|app, ui| …)
pub fn span(&mut self, key: K, tw: Tw, text: impl Into<String>) -> NodeHandle; // library measures/paints the text
pub fn icon(&mut self, key: K, tw: Tw, icon: Icon) -> NodeHandle; // library measures/paints the icon

// ---- owned widgets: each returns a #[must_use] builder; options, then the terminator
pub fn button(&mut self, key: K, face: impl Into<Face>) -> ButtonChain; // .on_click(f) | .add()
pub fn toggle(&mut self, key: K, face: impl Into<Face>, current: T) -> ToggleChain<T>; // [.values(off, on)] .on_change(|app, T|)
pub fn checkbox(&mut self, key: K, label: impl Into<String>, current: T) -> CheckboxChain<T>; // [.values(off, on)] .on_change(|app, T|)
pub fn switch(&mut self, key: K, label: impl Into<String>, current: T) -> SwitchChain<T>; // [.values(off, on)] .on_change(|app, T|)
pub fn radio_group<T>(&mut self, key: K, current: T, options: impl IntoIterator<Item: IntoChoice<T>>) -> RadioGroupChain; // .on_change(f)
pub fn segmented<T>(&mut self, key: K, current: T, options: impl IntoIterator<Item: IntoChoice<T>>) -> SegmentedChain; // .on_change(f) | .on_change_with(f): f also gets &egui::Context
pub fn slider(&mut self, key: K, value: f64, range: RangeInclusive<f64>) -> SliderChain; // .on_change(f)
pub fn select<T>(&mut self, key: K, current: T, options: impl IntoIterator<Item: IntoChoice<T>>) -> SelectChain; // .on_change(f) | .on_change_with(f)
pub fn stepper(&mut self, key: K, value: f64, range: RangeInclusive<f64>) -> StepperChain; // .on_change(f)
pub fn button(&mut self, key: K, face: impl Into<Face>) -> button::Chain; // .on_click(f) | .add()
pub fn toggle(&mut self, key: K, face: impl Into<Face>, current: T) -> toggle::Chain<T>; // [.values(off, on)] .on_change(|app, T|)
pub fn checkbox(&mut self, key: K, label: impl Into<String>, current: T) -> checkbox::Chain<T>; // [.values(off, on)] .on_change(|app, T|)
pub fn switch(&mut self, key: K, label: impl Into<String>, current: T) -> switch::Chain<T>; // [.values(off, on)] .on_change(|app, T|)
pub fn radio_group<T>(&mut self, key: K, current: T, options: impl IntoIterator<Item: IntoChoice<T>>) -> radio::Chain; // .on_change(f)
pub fn segmented<T>(&mut self, key: K, current: T, options: impl IntoIterator<Item: IntoChoice<T>>) -> segmented::Chain; // .on_change(f) | .on_change_with(f): f also gets &egui::Context
pub fn slider(&mut self, key: K, value: f64, range: RangeInclusive<f64>) -> slider::Chain; // .on_change(f)
pub fn select<T>(&mut self, key: K, current: T, options: impl IntoIterator<Item: IntoChoice<T>>) -> select::Chain; // .on_change(f) | .on_change_with(f)
pub fn stepper(&mut self, key: K, value: f64, range: RangeInclusive<f64>) -> stepper::Chain; // .on_change(f)
pub fn text_field(&mut self, key: K, text: impl Into<String>) -> TextFieldChain; // .on_change(|app, String|); .when_submitted(f), .when_blurred(|app, Blur|)

// ---- anonymous display content (no key)
Expand Down
2 changes: 1 addition & 1 deletion docs/dnd.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- **The cursor** is `Grab` over whatever starts a drag while none is live (the handle if the source has one, else the whole source) and `Grabbing` for the whole of a live gesture. The rule is one function of the source's activator (`dnd::lifted_by`), which the lift uses too.
- **The source's look while lifted** is the `drag_lifted(|p| ..)` variant. It applies to the live image, or to the node in its slot when the image is a preview or `None`.
- **`DragImage` is `{ Live, None }`.** `NodeHandle::drag_preview(|b| ..)` makes any subtree the image and wins over `Live`. `build` runs only while this source is the one lifted (so the preview first shows the frame after the lift). The library puts the subtree under an absolute (out-of-flow) node that is a sibling of the source, with an id derived from the source's, so neither the siblings' layout nor the target's `index_hint` items change. Its shapes go to the drag layer, unclipped, with its top-left `Shell::drag_grab()` behind the pointer: the live image's anchor, resolved against this frame's layout. A preview that should sit at the pointer offsets its content by `Shell::drag_grab`.
- **The chip lives in the shadcn crate**, not the core: `drag_chip(b, text)` builds shadcn's tooltip look (`primary` background, `primary-foreground` text, `rounded-md`, `text-xs`, `px-3 py-1.5`, from the tokens of the current theme), 12 points down and right of the pointer; the `DragChip` trait gives `with_drag_chip(text)` on a `NodeHandle`, one line over `drag_preview`. The core knows nothing about chips.
- **The chip lives in the shadcn crate**, not the core: `drag_chip(b, text)` builds shadcn's tooltip look (`primary` background, `primary-foreground` text, `rounded-md`, `text-xs`, `px-3 py-1.5`, from the tokens of the current theme), 12 points down and right of the pointer; the `drag_chip::Chip` trait gives `with_drag_chip(text)` on a `NodeHandle`, one line over `drag_preview`. The core knows nothing about chips.
- **Outside drags:** the pointer position counts as known only after `PointerMoved` since the files appeared, or in the drop pass. A position from before the drag entered is never used, and `drag_over` stays off without one. A refused file drop has no callback; the examples route refusals with a page-wide `Files` target (the innermost accepting target wins).
- **A gesture belongs to one `Placed`.** Targets laid out by another `Placed` on the same context don't see it (cross-`Placed` drops are tracked separately). A gesture whose scope is no longer drawn is cleared.
- **Auto-scroll** is done by the scroll containers themselves (M5): while a drag is live and the pointer is near the edge of a `b.scroll(..)` container, it scrolls by `EdgeScroll`'s velocity (the default band and speed unless the chain sets `edge_scroll(..)` or `no_edge_scroll()`) and requests frames. The innermost container that can move in that direction takes the drag. `EdgeScroll` and `Shell::drag_pointer` remain for scroll areas that are not eggshell's.
Expand Down
Loading
Loading