hUI/hui/src/measure.rs
2024-03-06 17:19:35 +01:00

29 lines
903 B
Rust

//! element measurement, hints and responses
use glam::Vec2;
#[derive(Default)]
#[non_exhaustive]
pub struct Hints {
pub inner_content_size: Option<Vec2>,
pub inner_content_size_cache: Option<Vec<Vec2>>,
}
#[derive(Default)]
pub struct Response {
/// Computed size of the element
pub size: Vec2,
/// Hints for the layout system, can be used to optimize the layout engine.\
/// These will never cause the UI to be rendered differently (assuming the values are correct)
pub hints: Hints,
/// Arbitrary user data, can be used to pass data (for example, cache) between measure and process stages
pub user_data: Option<Box<dyn std::any::Any>>,
/// If true, the element should always cause the content to wrap to the next line\
/// (the element itself gets wrapped to the next line too)
/// You should almost never set this
pub should_wrap: bool,
}