1
0
Fork 0

Allow shift+drag outside of widget bounds

This commit is contained in:
Robbert van der Helm 2022-03-14 16:24:11 +01:00
parent 82c33da022
commit 295fb4b0cb

View file

@ -172,10 +172,7 @@ impl<'a, P: Param> Widget<ParamMessage, Renderer> for ParamSlider<'a, P> {
Event::Mouse(mouse::Event::CursorMoved { .. }) Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => { | Event::Touch(touch::Event::FingerMoved { .. }) => {
// Don't do anything when we just reset the parameter because that would be weird // Don't do anything when we just reset the parameter because that would be weird
if !self.state.ignore_changes if !self.state.ignore_changes && self.state.drag_active {
&& self.state.drag_active
&& bounds.contains(cursor_position)
{
// If shift is being held then the drag should be more granular instead of // If shift is being held then the drag should be more granular instead of
// absolute // absolute
if self.state.keyboard_modifiers.shift() { if self.state.keyboard_modifiers.shift() {
@ -192,7 +189,7 @@ impl<'a, P: Param> Widget<ParamMessage, Renderer> for ParamSlider<'a, P> {
+ (cursor_position.x - drag_start_x) * GRANULAR_DRAG_MULTIPLIER, + (cursor_position.x - drag_start_x) * GRANULAR_DRAG_MULTIPLIER,
), ),
); );
} else { } else if bounds.contains(cursor_position) {
self.state.granular_drag_start_x = None; self.state.granular_drag_start_x = None;
self.set_normalized_value( self.set_normalized_value(