Skip to content

Commit

Permalink
Repaired jumping gui1 sliders.
Browse files Browse the repository at this point in the history
  • Loading branch information
fendrin committed Mar 30, 2013
1 parent 861242a commit cf84e1d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/widgets/slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit cf84e1d

Please sign in to comment.