Make alignment a widget property

This commit is contained in:
iris-ai committed 2026-09-15 23:12:16 -04:00
1 parent 8220a78d4a
commit d3b0ebf90c
21 files changed
+823 -300

No files matched your search

+13 -2
View File
@@ -1,5 +1,6 @@
use crate::{
Holds, LayerId, Len, MaskIdx, MoveIdx, PrimitiveHandle, Size, TextureHandle, UiRegion, WidgetId,
Holds, LayerId, Len, MaskIdx, MoveIdx, PrimitiveHandle, RegionAlign, Size, TextureHandle,
UiRegion, WidgetId,
};
/// What is kept of a widget its parent has asked about. `drawn` says whether
@@ -8,6 +9,7 @@ use crate::{
#[derive(Debug)]
pub struct ActiveData {
pub id: WidgetId,
/// The box its drawing is in, in `parent_move`'s coordinates.
pub region: UiRegion,
/// The box its parent first asked about it in, as a part of the box the
/// parent was itself asked in. Any later box it was given was decided
@@ -18,7 +20,7 @@ pub struct ActiveData {
pub answer: (Size, [Holds; 2]),
/// What the widget said it used of its box, the last time it drew.
pub size: Size,
/// The pixel lengths of its box, per axis, that its drawing and `size`
/// The pixel lengths of `region`, per axis, that its drawing and `size`
/// hold for.
pub holds: [Holds; 2],
pub drawn: bool,
@@ -39,6 +41,15 @@ pub struct ActiveData {
/// A change to one moves a box this widget cannot fix by drawing again,
/// and comparing them is what says so.
pub declared: [Option<Len>; 2],
/// The alignment its parent asked it with. A local redraw repeats that
/// question, including an override chosen by a container.
pub align: RegionAlign,
/// Whether that alignment was the parent's override rather than the
/// widget's own property.
pub align_override: bool,
/// Its own alignment when it was last drawn. A change to the property is
/// found against this even when its parent overrode the alignment.
pub own_align: RegionAlign,
/// The movable region whose coordinates `region` uses.
pub parent_move: MoveIdx,
pub mask: MaskIdx,