Replace placement calls with region nodes

This commit is contained in:
iris-ai committed 2026-09-15 18:02:28 -04:00
1 parent f437495309
commit 71c9c39523
23 files changed
+374 -170

No files matched your search

+2
View File
@@ -3,6 +3,7 @@ use crate::Widget;
pub struct WidgetData {
pub widget: Box<dyn Widget>,
pub label: String,
pub(super) region_node: bool,
/// dynamic borrow checking
pub borrowed: bool,
}
@@ -16,6 +17,7 @@ impl WidgetData {
Self {
widget: Box::new(widget),
label,
region_node: false,
borrowed: false,
}
}
+18
View File
@@ -100,6 +100,24 @@ impl Widgets {
self.data_mut(id.id()).unwrap().label = label;
}
/// Whether this widget owns a movable retained region.
pub fn is_region_node(&self, id: impl IdLike) -> bool {
self.data(id).unwrap().region_node
}
/// Chooses whether this widget's retained drawing has one movable region
/// of its own. Changing the boundary redraws the subtree once so every
/// primitive names the right coordinate space.
pub fn set_region_node(&mut self, id: impl IdLike, region_node: bool) {
let id = id.id();
let data = self.data_mut(id).unwrap();
if data.region_node == region_node {
return;
}
data.region_node = region_node;
self.needs_redraw.insert(id);
}
pub fn data_mut(&mut self, id: impl IdLike) -> Option<&mut WidgetData> {
self.vec.get_mut(id.id())
}