1
0
Fork 0

Handle releasing shift properly for slider widget

This commit is contained in:
Robbert van der Helm 2022-03-14 20:05:54 +01:00
parent cf1314ce53
commit 8e9583d6d2

View file

@ -204,6 +204,23 @@ impl<'a, P: Param> Widget<ParamMessage, Renderer> for ParamSlider<'a, P> {
}
Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
self.state.keyboard_modifiers = modifiers;
// If this happens while dragging, snap back to reality uh I mean the current screen
// position
if !self.state.ignore_changes
&& self.state.drag_active
&& self.state.granular_drag_start_x.is_some()
&& !modifiers.shift()
{
self.state.granular_drag_start_x = None;
self.set_normalized_value(
shell,
util::remap_rect_x_coordinate(&bounds, cursor_position.x),
);
}
return event::Status::Captured;
}
_ => {}
}