mistakes were fixed and sins were committed
This commit is contained in:
@@ -6,7 +6,7 @@ use crate::{
|
||||
IdLike, PainterCtx, PainterData, PixelRegion, StaticWidgetId, TextureHandle, Vec2, Widget,
|
||||
WidgetId, WidgetLike,
|
||||
},
|
||||
util::Id,
|
||||
util::{HashSet, Id},
|
||||
};
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
@@ -18,7 +18,7 @@ pub struct Ui {
|
||||
// TODO: make this at least pub(super)
|
||||
pub(crate) data: PainterData,
|
||||
root: Option<WidgetId>,
|
||||
updates: Vec<Id>,
|
||||
updates: HashSet<Id>,
|
||||
recv: Receiver<Id>,
|
||||
pub(super) send: Sender<Id>,
|
||||
full_redraw: bool,
|
||||
@@ -142,7 +142,7 @@ impl Ui {
|
||||
// self.redraw_all();
|
||||
// }
|
||||
let mut ctx = PainterCtx::new(&mut self.data);
|
||||
for id in self.updates.drain(..) {
|
||||
for id in self.updates.drain() {
|
||||
ctx.redraw(id);
|
||||
}
|
||||
self.free();
|
||||
@@ -172,7 +172,7 @@ impl Ui {
|
||||
}
|
||||
|
||||
pub fn text(&mut self, id: &impl IdLike<TextEdit>) -> TextEditCtx<'_> {
|
||||
self.updates.push(id.id());
|
||||
self.updates.insert(id.id());
|
||||
TextEditCtx {
|
||||
text: self.data.widgets.get_mut(id).unwrap(),
|
||||
font_system: &mut self.data.text.font_system,
|
||||
@@ -196,7 +196,6 @@ impl Ui {
|
||||
" pixel region: {}",
|
||||
inst.region.to_px(self.data.output_size)
|
||||
);
|
||||
println!(" desired_size: {}", inst.desired_size);
|
||||
println!("}}");
|
||||
}
|
||||
}
|
||||
@@ -212,7 +211,7 @@ impl<W: Widget> Index<&WidgetId<W>> for Ui {
|
||||
|
||||
impl<W: Widget> IndexMut<&WidgetId<W>> for Ui {
|
||||
fn index_mut(&mut self, id: &WidgetId<W>) -> &mut Self::Output {
|
||||
self.updates.push(id.id);
|
||||
self.updates.insert(id.id);
|
||||
self.get_mut(id).unwrap()
|
||||
}
|
||||
}
|
||||
@@ -227,7 +226,7 @@ impl<W: Widget> Index<StaticWidgetId<W>> for Ui {
|
||||
|
||||
impl<W: Widget> IndexMut<StaticWidgetId<W>> for Ui {
|
||||
fn index_mut(&mut self, id: StaticWidgetId<W>) -> &mut Self::Output {
|
||||
self.updates.push(id.id);
|
||||
self.updates.insert(id.id);
|
||||
self.data.widgets.get_mut(&id).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user