small QOL

This commit is contained in:
2025-12-16 20:24:21 -05:00
parent ac9571b29f
commit ecbb9e56e2
4 changed files with 22 additions and 16 deletions

View File

@@ -83,13 +83,13 @@ widget_trait! {
}
}
fn scroll(self) -> impl WidgetIdFn<State, Scroll<State>> {
fn scrollable(self) -> impl WidgetIdFn<State, Scroll<State>> {
use eventable::*;
move |ui| {
Scroll::new(self.add(ui), Axis::Y)
.on(CursorSense::Scroll, |ctx| {
let s = &mut ctx.state.ui()[ctx.widget];
s.scroll(ctx.data.scroll_delta.y * 50.0);
.on(CursorSense::Scroll, |mut ctx| {
let delta = ctx.data.scroll_delta.y * 50.0;
ctx.widget().scroll(delta);
})
.add(ui)
}