redo event fn signature & add event_ctx macro

This commit is contained in:
2025-12-06 20:48:10 -05:00
parent f6b1143665
commit 62aa02847a
10 changed files with 270 additions and 274 deletions

View File

@@ -100,10 +100,13 @@ impl<W: WidgetLike<Tag>, Tag> CoreWidget<W::Widget, Tag> for W {
}
fn scroll(self) -> impl WidgetIdFn<Scroll> {
event_ctx!(());
move |ui| {
Scroll::new(self.add(ui).any(), Axis::Y)
.edit_on(CursorSense::Scroll, |w, data| {
w.scroll(data.scroll_delta.y * 50.0);
.on(CursorSense::Scroll, |ctx| {
let s = &mut ctx.ui[ctx.id];
s.scroll(ctx.data.scroll_delta.y * 50.0);
})
.add(ui)
}