Skip to content

Commit

Permalink
Slightly more sensible scrollbar positioning on content resize
Browse files Browse the repository at this point in the history
This isn't perfect. Optimally, the scrollbar should never change position at all.
  • Loading branch information
Vultraz committed Aug 16, 2016
1 parent 25c31ed commit 1209a2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/widgets/scrollbar_container.cpp
Expand Up @@ -892,7 +892,7 @@ void tscrollbar_container::show_content_rect(const SDL_Rect& rect)
int distance = wanted_bottom - current_bottom;
if(distance > 0) {
vertical_scrollbar_->set_item_position(
vertical_scrollbar_->get_item_position() + distance);
vertical_scrollbar_->get_item_position() - distance);
}

// right.
Expand All @@ -901,7 +901,7 @@ void tscrollbar_container::show_content_rect(const SDL_Rect& rect)
distance = wanted_right - current_right;
if(distance > 0) {
horizontal_scrollbar_->set_item_position(
horizontal_scrollbar_->get_item_position() + distance);
horizontal_scrollbar_->get_item_position() - distance);
}

// top.
Expand Down

0 comments on commit 1209a2f

Please sign in to comment.