pub struct MenuLayout { /* private fields */ }Expand description
Re-exported for the same reason: menu_skin returns a MenuSkin, and
a caller that can name this crate’s menu art should not have to add a second
dependency to lay out and draw the menu it skins. It is also what lets an
end-to-end suite that depends on this crate take a golden image of the real
menu rather than of a replica.
One frame’s placement of a menu: the panel, the title and every button, in
screen pixels.
Produced by Menu::layout and consumed by Menu::render, for the art
and the text alike. Carrying the MenuStyle it was built with is what
stops the two being measured with different metrics — the failure that puts
a label a scale out of step with the frame around it.
Implementations§
Source§impl MenuLayout
impl MenuLayout
Sourcepub const fn panel(&self) -> (Vec2, Vec2)
pub const fn panel(&self) -> (Vec2, Vec2)
The window frame’s rectangle: (min, max) in screen pixels.
Sourcepub fn panel_size(&self) -> Vec2
pub fn panel_size(&self) -> Vec2
The panel’s size in pixels.
Sourcepub fn panel_centre(&self) -> Vec2
pub fn panel_centre(&self) -> Vec2
The middle of the panel, in screen pixels.
Sourcepub fn items(&self) -> &[MenuItemLayout]
pub fn items(&self) -> &[MenuItemLayout]
Sourcepub fn viewport(&self) -> Option<(Vec2, Vec2)>
pub fn viewport(&self) -> Option<(Vec2, Vec2)>
Where a scrolled item list shows its rows: (min, max) in screen
pixels, inside the panel. None when the list is not scrolled and
every row is in view.
A row is drawn cut at this rectangle’s edges and hit only inside it.
Sourcepub fn scroll(&self) -> f32
pub fn scroll(&self) -> f32
How far the item list is scrolled, in pixels: zero unless it scrolls.
Trait Implementations§
Source§impl Clone for MenuLayout
impl Clone for MenuLayout
Source§fn clone(&self) -> MenuLayout
fn clone(&self) -> MenuLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more