sensor ctx

This commit is contained in:
2025-08-20 13:09:03 -04:00
parent 1482e5d67c
commit b7f83b58a9
4 changed files with 22 additions and 19 deletions

View File

@@ -84,10 +84,9 @@ impl Client {
let main = main.clone();
let to = to.clone().erase_type();
Rect::new(color)
.on(Sense::PressEnd, |_, _| {})
.id_on(Sense::PressStart, move |id, ui, _| {
ui[&main].inner = to.clone();
ui[id].color = color.add_rgb(-0.2);
.id_on(Sense::PressStart, move |id, ctx| {
ctx.ui[&main].inner = to.clone();
ctx.ui[id].color = color.add_rgb(-0.2);
})
.edit_on(Sense::HoverStart, move |r, _| {
r.color = color.add_rgb(0.1);
@@ -110,8 +109,8 @@ impl Client {
);
let test_button = Rect::new(Color::PURPLE)
.radius(30)
.on(Sense::PressStart, move |ui, _| {
println!("{}", ui.num_widgets());
.on(Sense::PressStart, move |ctx| {
println!("{}", ctx.ui.num_widgets());
})
.region(
UiRegion::corner(Corner::BotRight)
@@ -122,8 +121,8 @@ impl Client {
let s = span_add.clone();
let del_button = Rect::new(Color::RED)
.radius(30)
.on(Sense::PressStart, move |ui, _| {
ui[&s].children.pop();
.on(Sense::PressStart, move |ctx| {
ctx.ui[&s].children.pop();
})
.region(
UiRegion::corner(Corner::BotLeft)