Skip to content

Commit

Permalink
Merge pull request godotengine#85652 from rsubtil/bugfix-can_grab_focus
Browse files Browse the repository at this point in the history
Ensure slider grabs focus only when it can
  • Loading branch information
YuriSizov committed Dec 19, 2023
2 parents 252c462 + fde51ae commit 26834d2
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 26834d2

Please sign in to comment.