Repaired jumping gui1 sliders.

This commit is contained in:
fendrin 2013-03-30 15:51:28 +01:00
parent 861242ad4a
commit cf84e1d8aa

View file

@ -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;
}
}
}