FINALLY FIXED STUPID TEST UI ISSUES (true painter.rs moment) + scrolling

This commit is contained in:
2025-11-21 01:40:13 -05:00
parent e3b1ddc993
commit 172e7157be
7 changed files with 122 additions and 67 deletions

View File

@@ -3,7 +3,7 @@ use image::DynamicImage;
use crate::{
core::{TextEdit, TextEditCtx},
layout::{
IdLike, PainterCtx, PainterData, PixelRegion, StaticWidgetId, TextureHandle, Vec2, Widget,
IdLike, PainterData, PixelRegion, StaticWidgetId, TextureHandle, Vec2, Widget,
WidgetId, WidgetInstance, WidgetLike,
},
util::{HashSet, Id},
@@ -109,9 +109,8 @@ impl Ui {
}
// free before bc nothing should exist
self.free();
let mut ctx = PainterCtx::new(&mut self.data);
if let Some(root) = &self.root {
ctx.draw(root.id);
self.data.draw(root.id);
}
}
@@ -138,13 +137,7 @@ impl Ui {
}
fn redraw_updates(&mut self) {
// if self.updates.drain(..).next().is_some() {
// self.redraw_all();
// }
let mut ctx = PainterCtx::new(&mut self.data);
for id in self.updates.drain() {
ctx.redraw(id);
}
self.data.redraw(std::mem::take(&mut self.updates));
self.free();
}