Repaired jumping gui1 sliders.
This commit is contained in:
parent
861242ad4a
commit
cf84e1d8aa
1 changed files with 12 additions and 9 deletions
|
@ -211,16 +211,19 @@ void slider::mouse_down(const SDL_MouseButtonEvent& event)
|
|||
if (event.button != SDL_BUTTON_LEFT || !point_in_rect(event.x, event.y, location()))
|
||||
return;
|
||||
|
||||
state_ = CLICKED;
|
||||
bool prev_change = value_change_;
|
||||
value_change_ = false;
|
||||
set_focus(true);
|
||||
set_slider_position(event.x);
|
||||
if(value_change_) {
|
||||
sound::play_UI_sound(game_config::sounds::slider_adjust);
|
||||
} else {
|
||||
if (point_in_rect(event.x, event.y, slider_area())) {
|
||||
state_ = CLICKED;
|
||||
sound::play_UI_sound(game_config::sounds::button_press);
|
||||
value_change_ = prev_change;
|
||||
} else {
|
||||
bool prev_change = value_change_;
|
||||
value_change_ = false;
|
||||
set_focus(true);
|
||||
set_slider_position(event.x);
|
||||
if(value_change_) {
|
||||
sound::play_UI_sound(game_config::sounds::slider_adjust);
|
||||
} else {
|
||||
value_change_ = prev_change;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue