👎Deprecated since 0.5.0: moved to egui_stack::sections::plan, re-exported as egui_pop_core::sections::plan; this copy goes in the next release
Expand description
The arithmetic of a stack of collapsible sections: how heights share a panel, and what a drag on a boundary between two sections does.
Experimental: may change in any release
(docs/stability.md).
Deprecated: it moved to egui_stack (egui_stack::sections::plan,
re-exported as egui_pop_core::sections::plan), with the section
widget; this copy is kept, unchanged and unused, for one release. It is
not a re-export, as this crate stays free of egui (ADR 0001) and
egui_stack depends on it. Its tests are egui_stack’s. Its types are not egui_stack’s: a
DragMode read from egui_pop_core::sections::laid_out is
egui_pop_core::sections::DragMode.
Heights are in points, a section’s body alone (its title band is the
caller’s); folded sections take no height and are skipped.
fit: the heights a stack shows in the room it has. A height set by hand is kept while it fits; the sections never set by hand share the rest equally, and the last open section takes what is left, less any empty room kept under it.plan_drag: what moving a boundary does, from the heights shown. Nothing gives way in proportion: sections give in turn, the nearest first, each down to its least height, as a code editor’s split view does.DragMode::Pullmoves the sections below as a block instead, opening empty room under the last.resized_above: the section a boundary resizes: under a folded section, the first open one above it.pin_plan: the heights to keep by hand so thatfitshows a plan, the sections it did not touch staying sized by the list.keep_title: what folding or opening a section keeps so that its title stays where it is (held_above: the sections that must not move).rows_least: the least height of a section of rows.
use egui_pop_model::sections::{DragMode, Placed, plan_drag};
let section = |height| Placed { open: true, least: 50.0, height };
let stack = [section(100.0), section(100.0), section(100.0)];
// Down, the section just below gives first, down to its least height;
// the last gives only then.
let plan = plan_drag(&stack, 0, 70.0, 0.0, DragMode::Push);
assert_eq!(plan.heights, [170.0, 50.0, 80.0]);
assert_eq!(plan.moved, 70.0);Structs§
- Asked
Deprecated - A section as a stack asks for it: what
fitlays out. - Drag
Plan Deprecated - What a drag does (
plan_drag). - Fit
Deprecated - The heights a stack shows (
fit). - Kept
Deprecated - What to keep so that folding or opening a section leaves its title where
it is (
keep_title). - Placed
Deprecated - A section as laid out: what a drag starts from.
Enums§
- Drag
Mode Deprecated - How a drag moves the sections around a boundary.
Functions§
- fit
Deprecated - Lays sections out in
roompoints, keepingemptypoints of it under the last section. - held_
above Deprecated - The open sections above
section, with their shown heights: what must not move for its title to stay where it is. - keep_
title Deprecated - What folding or opening the section
sectionkeeps, from theheightsshown and theemptyroom under them, so that its title does not move. - pin_
plan Deprecated - The heights to keep by hand, section by section, so that
fitshowsplaninroom, withemptykept under the last section. - plan_
drag Deprecated - What moving the boundary under the section
abovebydeltadoes (down if positive), from the heights inplaced;emptyis the room under the last section. - resized_
above Deprecated - The section a boundary resizes, the one on the line under the section
line:lineitself when open, else the first open one above it, past any folded ones (they have no height to change);Nonewhen nothing above is open, and the boundary cannot move.open: whether each section is, top first. - rows_
least Deprecated - The least height of a section of
countrows, eachrowtall: two rows, or all of them when it has fewer.