Struct LayoutDom

Source
pub struct LayoutDom { /* private fields */ }
Expand description

Contains information on how each widget in the DOM is laid out and what events they’re interested in.

Implementations§

Source§

impl LayoutDom

Source

pub fn new() -> Self

Create an empty LayoutDom.

Source

pub fn get(&self, id: WidgetId) -> Option<&LayoutDomNode>

Get a widget’s layout information.

Source

pub fn get_mut(&mut self, id: WidgetId) -> Option<&mut LayoutDomNode>

Get a mutable reference to a widget’s layout information.

Source

pub fn set_unscaled_viewport(&mut self, view: Rect)

Set the viewport of the DOM in unscaled units.

Source

pub fn set_scale_factor(&mut self, scale: f32)

Set the scale factor to use for layout.

Source

pub fn scale_factor(&self) -> f32

Get the currently active scale factor.

Source

pub fn viewport(&self) -> Rect

Get the viewport in scaled units.

Source

pub fn unscaled_viewport(&self) -> Rect

Get the viewport in unscaled units.

Source

pub fn len(&self) -> usize

Tells how many nodes are currently in the LayoutDom.

Source

pub fn is_empty(&self) -> bool

Tells whether the LayoutDom is currently empty.

Source

pub fn calculate_all(&mut self, dom: &Dom, input: &InputState)

Calculate the layout of all elements in the given DOM.

Source

pub fn calculate( &mut self, dom: &Dom, input: &InputState, id: WidgetId, constraints: Constraints, ) -> Vec2

Calculate the layout of a specific widget.

This function must only be called from Widget::layout and should only be called once per widget per layout pass.

Source

pub fn enable_clipping(&mut self, dom: &Dom)

Enables clipping for the currently active widget.

Source

pub fn new_layer(&mut self, dom: &Dom)

Put this widget and its children into a new layer.

Source

pub fn set_pos(&mut self, id: WidgetId, pos: Vec2)

Set the position of a widget.

Trait Implementations§

Source§

impl Debug for LayoutDom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Any for T
where T: Any,

Source§

impl<T> Props for T
where T: Debug,