Option<Id>.duplicate
This commit is contained in:
@@ -6,7 +6,7 @@ use crate::{
|
||||
UiVec2, Vec2, WidgetId, Widgets,
|
||||
},
|
||||
render::{Primitive, PrimitiveHandle, Primitives},
|
||||
util::{HashMap, HashSet, Id},
|
||||
util::{HashMap, HashSet, Id, IdUtil},
|
||||
};
|
||||
|
||||
pub struct Painter<'a, 'c> {
|
||||
@@ -77,12 +77,16 @@ impl<'a> PainterCtx<'a> {
|
||||
return;
|
||||
};
|
||||
|
||||
let parent = active.parent();
|
||||
drop(active.textures);
|
||||
self.textures.free();
|
||||
|
||||
self.primitives.set_pos(active.span.start);
|
||||
self.draw_inner(id, active.region, parent, Some(active.children));
|
||||
self.draw_inner(
|
||||
id,
|
||||
active.region,
|
||||
active.parent.duplicate(),
|
||||
Some(active.children),
|
||||
);
|
||||
self.active.widgets.get_mut(id).unwrap().resize = active.resize;
|
||||
|
||||
let delta = self.primitives.apply(active.span.clone());
|
||||
@@ -204,7 +208,7 @@ impl<'a> PainterCtx<'a> {
|
||||
let instance = self.active.widgets.get_mut(&parent).unwrap();
|
||||
let end = &mut instance.span.end;
|
||||
*end = end.strict_add_signed(delta);
|
||||
let parent_parent = instance.parent();
|
||||
let parent_parent = instance.parent.duplicate();
|
||||
for child in instance
|
||||
.children
|
||||
.iter()
|
||||
@@ -346,9 +350,3 @@ impl SizeCtx<'_> {
|
||||
self.text.draw(buffer, attrs, self.textures)
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetInstance {
|
||||
pub fn parent(&self) -> Option<Id> {
|
||||
self.parent.as_ref().map(|p| p.duplicate())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user