use crate::{ LayerId, Len, MaskIdx, MoveIdx, PrimitiveHandle, Size, TextureHandle, UiRegion, WidgetId, util::Vec2, }; /// important non rendering data for retained drawing #[derive(Debug)] pub struct ActiveData { pub id: WidgetId, pub region: UiRegion, /// What the widget said it used of `region`, the last time it drew. pub size: Size, /// The pixel size of the box it drew against. `region` alone cannot say: /// it is a fraction of a slot's box, and the same fraction of a box that /// has since changed is a different number of pixels. pub px: Vec2, /// The pixel size of the box its parent first asked about it in, before /// knowing what it came to. `px` may be a box derived from that answer, /// and a size measured there is only the same answer asked again. pub offered_px: Vec2, pub parent: Option, /// How far down the tree it was drawn, the root being 1. Carried down a /// draw rather than worked out by walking up, so it is right for every /// widget a frame visits and cannot drift while one is being drawn. pub depth: usize, pub textures: Vec, pub primitives: Vec, pub children: Vec, /// The children whose size this widget read while drawing. pub size_deps: Vec, /// Offered pixel axes which flowed into this widget's reported size, /// directly or through a child size it read. pub size_box_inputs: [bool; 2], /// Output axes read while producing `size`, distinct from the widget's /// own box when that box has a fixed pixel length. pub size_output_inputs: [bool; 2], /// The output dimensions against which those dependencies were observed. pub output_px: Vec2, /// The slot its primitives are positioned through: its own if its parent /// placed it, otherwise the nearest ancestor that has one. pub move_idx: MoveIdx, /// The declared lengths whoever drew this widget resolved into its box. /// A change to one moves a box this widget cannot fix by drawing again, /// and comparing them is what says so. pub declared: [Option; 2], /// The slot `region` is given in, which is whatever its parent drew in. pub parent_move: MoveIdx, pub mask: MaskIdx, pub layer: LayerId, }