Skip to content

Commit

Permalink
Ensure slider grabs focus only when it can
Browse files Browse the repository at this point in the history
  • Loading branch information
rsubtil committed Dec 2, 2023
1 parent 6afd320 commit fde51ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scene/gui/slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ void Slider::gui_input(const Ref<InputEvent> &p_event) {
}
} else if (scrollable) {
if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
grab_focus();
if (get_focus_mode() != FOCUS_NONE) {
grab_focus();
}
set_value(get_value() + get_step());
} else if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
grab_focus();
if (get_focus_mode() != FOCUS_NONE) {
grab_focus();
}
set_value(get_value() - get_step());
}
}
Expand Down

0 comments on commit fde51ae

Please sign in to comment.