I give up on retained for now lmao

This commit is contained in:
2025-11-14 14:39:08 -05:00
parent 218b3f14ed
commit b4947db850
5 changed files with 34 additions and 9 deletions

View File

@@ -103,13 +103,13 @@ impl Align {
} }
} }
#[derive(Default, Clone, Copy, PartialEq)] #[derive(Debug, Default, Clone, Copy, PartialEq)]
pub struct Size { pub struct Size {
pub x: Len, pub x: Len,
pub y: Len, pub y: Len,
} }
#[derive(Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub struct Len { pub struct Len {
pub abs: f32, pub abs: f32,
pub rel: f32, pub rel: f32,

View File

@@ -84,6 +84,14 @@ impl<'a> PainterCtx<'a> {
return; return;
}; };
if self.widgets.label(&id) == "debug* area" {
if let Some((id, _)) = &active.resize {
println!("RESIZE: {:?}", self.widgets.label(id));
} else {
println!("RESIZE: NONE");
}
}
if let Some((rid, size)) = active.resize { if let Some((rid, size)) = active.resize {
let checked = &mut HashMap::default(); let checked = &mut HashMap::default();
let mut ctx = SizeCtx { let mut ctx = SizeCtx {
@@ -105,10 +113,18 @@ impl<'a> PainterCtx<'a> {
} }
} }
if self.widgets.label(&id) == "debug* area" {
println!("redraw proceeding");
}
let Some(active) = self.remove(id) else { let Some(active) = self.remove(id) else {
return; return;
}; };
if self.widgets.label(&id) == "debug* area" {
println!("redraw actually");
}
self.draw_inner( self.draw_inner(
active.layer, active.layer,
id, id,
@@ -188,7 +204,7 @@ impl<'a> PainterCtx<'a> {
widgets: painter.ctx.widgets, widgets: painter.ctx.widgets,
checked: &mut Default::default(), checked: &mut Default::default(),
screen_size: painter.ctx.screen_size, screen_size: painter.ctx.screen_size,
px_dependent: painter.ctx.px_dependent, px_dependent: &mut Default::default(),
id: painter.id, id: painter.id,
size: UiVec2::FULL_SIZE, size: UiVec2::FULL_SIZE,
} }

View File

@@ -318,7 +318,13 @@ impl UiRegion {
impl Display for UiRegion { impl Display for UiRegion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{} -> {}", self.top_left, self.bot_right) write!(
f,
"{} -> {} (size: {})",
self.top_left,
self.bot_right,
self.size()
)
} }
} }

View File

@@ -134,11 +134,14 @@ impl Ui {
} }
fn redraw_updates(&mut self) { fn redraw_updates(&mut self) {
let mut ctx = PainterCtx::new(&mut self.data); if self.updates.drain(..).next().is_some() {
for id in self.updates.drain(..) { self.redraw_all();
ctx.redraw(id);
} }
self.free(); // let mut ctx = PainterCtx::new(&mut self.data);
// for id in self.updates.drain(..) {
// ctx.redraw(id);
// }
// self.free();
} }
/// free any resources that don't have references anymore /// free any resources that don't have references anymore

View File

@@ -1,4 +1,4 @@
use crate::layout::{Painter, SizeCtx, StaticWidgetId, Ui, Size, WidgetId, WidgetIdFn}; use crate::layout::{AnyWidget, Painter, Size, SizeCtx, StaticWidgetId, Ui, WidgetId, WidgetIdFn};
use std::{any::Any, marker::PhantomData}; use std::{any::Any, marker::PhantomData};