pub struct ScrollPanel {}Expand description
Runtime model that makes a band of UI rows scrollable and (optionally) collapsible.
A ScrollPanel is emitted by the build (e.g. by a settings menu) and read
by the UI at runtime; it is not hand-authored. It names a content band (a
fixed rectangle in the menu’s reference canvas), the ordered rows that live
inside it, the collapsible groups some rows belong to, and the scrollbar
thumb/track sprites. The UI lays the rows out each frame: a collapsed group’s
body rows hide and the rows below them move up; when the visible stack is
taller than the band it scrolls (mouse wheel or thumb drag) and rows outside
the band are clipped.
All pixel fields are in the same reference-space coordinates as the Screen’s other UI (see the overlay scaling notes on MainMenu).
Fields§
§screen: Option<AssetId>Screen this panel belongs to. Resolved automatically from
the <screen>_* naming convention; you don’t set this directly. The
panel is only live while its screen is active.
x: f32Left edge of the content band in reference pixels.
y: f32Top edge of the content band in reference pixels.
width: f32Width of the content band in reference pixels.
height: f32Height of the content band (the visible window) in reference pixels.
rows: Vec<ScrollRow>The rows in the band, top to bottom.
groups: Vec<ScrollGroup>Collapsible groups, referenced by index from ScrollRow::group.
thumb: Option<AssetId>Scrollbar thumb Sprite the UI moves and resizes. None for a
panel with no scrollbar.
track: Option<AssetId>Scrollbar track Sprite. Hidden along with the thumb when the content fits the band.
track_x: f32Left edge of the scrollbar track in reference pixels.
track_y: f32Top edge of the scrollbar track in reference pixels.
track_w: f32Width of the scrollbar track in reference pixels.
track_h: f32Height of the scrollbar track in reference pixels (the thumb travels within it).
Trait Implementations§
Source§impl Clone for ScrollPanel
impl Clone for ScrollPanel
Source§fn clone(&self) -> ScrollPanel
fn clone(&self) -> ScrollPanel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for ScrollPanel
impl Component for ScrollPanel
Source§const NAME: &'static str = "ScrollPanel"
const NAME: &'static str = "ScrollPanel"
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for ScrollPanel
impl ComponentSlot for ScrollPanel
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.