mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
Fix panic on mouse wheel on a NativeSlider
move the handle instead of panicking
This commit is contained in:
parent
c3ca796b1d
commit
b04581b64e
1 changed files with 7 additions and 0 deletions
|
@ -803,6 +803,13 @@ impl Item for NativeSlider {
|
|||
InputEventResult::EventIgnored
|
||||
}
|
||||
}
|
||||
MouseEvent::MouseWheel { delta, .. } if enabled => {
|
||||
let new_val = value + delta.x + delta.y;
|
||||
let new_val = new_val.max(min).min(max);
|
||||
self.value.set(new_val);
|
||||
Self::FIELD_OFFSETS.changed.apply_pin(self).call(&(new_val,));
|
||||
InputEventResult::EventAccepted
|
||||
}
|
||||
_ => {
|
||||
assert!(!enabled);
|
||||
data.pressed = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue