tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 790HTML 742Markdown 12TOML 62540 Definiciones

⎇ e69717ab10539e5abe2f2778a050ba795853f96b src/result.rs Rust · 32 líneas · 929 B Historia Quién tocó qué crudo

Make order field of `Layout` pub (#94) e69717ab1 · Alice Cecile ·

1use crate::algo::ComputeResult;
2use crate::geometry::{Point, Size};
3use crate::number::Number;
4
5/// The final result of a layout algorithm for a single [`Node`](crate::node::Node).
6#[derive(Copy, Debug, Clone)]
7pub struct Layout {
8    /// The relative ordering of the node
9    ///
10    /// Nodes with a higher order should be rendered on top of those with a lower order.
11    /// This is effectively a topological sort of each tree.
12    pub order: u32,
13    // The width and height of the node
14    pub size: Size<f32>,
15    // The bottom-left corner of the node
16    pub location: Point<f32>,
17}
18
19impl Layout {
20    pub(crate) fn new() -> Self {
21        Self { order: 0, size: Size::zero(), location: Point::zero() }
22    }
23}
24
25#[derive(Debug, Clone)]
26pub(crate) struct Cache {
27    pub(crate) node_size: Size<Number>,
28    pub(crate) parent_size: Size<Number>,
29    pub(crate) perform_layout: bool,
30
31    pub(crate) result: ComputeResult,
32}