uhh stuff

This commit is contained in:
griffi-gh 2024-04-17 15:41:10 +02:00
parent cdaf4c0781
commit 7b671d2f3d
3 changed files with 4 additions and 17 deletions

View file

@ -17,8 +17,8 @@ pub use builtin::*;
/// Context for the `Element::measure` function
pub struct MeasureContext<'a> {
pub state: &'a StateRepo,
pub layout: &'a LayoutInfo,
pub state: &'a StateRepo,
pub text_measure: TextMeasure<'a>,
pub current_font: FontHandle,
pub images: ImageCtx<'a>,
@ -29,9 +29,9 @@ pub struct MeasureContext<'a> {
/// Context for the `Element::process` function
pub struct ProcessContext<'a> {
pub measure: &'a Response,
pub state: &'a mut StateRepo,
pub layout: &'a LayoutInfo,
pub draw: &'a mut UiDrawCommandList,
pub state: &'a mut StateRepo,
pub text_measure: TextMeasure<'a>,
pub current_font: FontHandle,
pub images: ImageCtx<'a>,

View file

@ -444,8 +444,8 @@ impl UiElement for Container {
//measure
let el_measure = element.measure(MeasureContext {
state: ctx.state,
layout: &el_layout,
state: ctx.state,
text_measure: ctx.text_measure,
current_font: ctx.current_font,
images: ctx.images,
@ -486,15 +486,13 @@ impl UiElement for Container {
//process
element.process(ProcessContext {
measure: &el_measure,
state: ctx.state,
layout: &el_layout,
draw: ctx.draw,
state: ctx.state,
text_measure: ctx.text_measure,
current_font: ctx.current_font,
images: ctx.images,
input: ctx.input,
//HACK: i have no idea what to do with this
//this sucks
signal: ctx.signal,
});

View file

@ -57,17 +57,6 @@ impl UiElement for FillRect {
}
fn process(&self, ctx: ProcessContext) {
// if !self.background.is_transparent() {
// ctx.draw.add(UiDrawCommand::Rectangle {
// position: ctx.layout.position,
// size: ctx.measure.size,
// color: self.background.corners(),
// texture: None,
// rounded_corners: (self.corner_radius.max_f32() > 0.).then_some({
// RoundedCorners::from_radius(self.corner_radius)
// }),
// });
// }
self.frame.draw(ctx.draw, ctx.layout.position, ctx.measure.size);
}
}