uhh stuff

This commit is contained in:
griffi-gh 2024-04-17 15:41:10 +02:00
parent 85ebf67431
commit 0625b91735
3 changed files with 4 additions and 17 deletions

View file

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

View file

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

View file

@ -57,17 +57,6 @@ impl UiElement for FillRect {
} }
fn process(&self, ctx: ProcessContext) { 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); self.frame.draw(ctx.draw, ctx.layout.position, ctx.measure.size);
} }
} }