Scroll box example
This commit is contained in:
@@ -1556,6 +1556,23 @@ impl Dispatch<wl_pointer::WlPointer, ()> for State {
|
||||
.pending_pointer_events
|
||||
.push(PointerEvent::new(0, position, kind));
|
||||
}
|
||||
wl_pointer::Event::Axis { axis, value, .. } => {
|
||||
let Some(position) = state.pointer_position else {
|
||||
return;
|
||||
};
|
||||
let delta = match axis {
|
||||
WEnum::Value(wl_pointer::Axis::VerticalScroll) => Point::new(0.0, value as f32),
|
||||
WEnum::Value(wl_pointer::Axis::HorizontalScroll) => {
|
||||
Point::new(value as f32, 0.0)
|
||||
}
|
||||
WEnum::Value(_) | WEnum::Unknown(_) => return,
|
||||
};
|
||||
state.pending_pointer_events.push(PointerEvent::new(
|
||||
0,
|
||||
position,
|
||||
PointerEventKind::Scroll { delta },
|
||||
));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user