Fix to update scroll bar has correct max value in ScrollContainer

This commit is contained in:
volzhs 2020-11-25 05:30:55 +09:00
parent 32b31a5fa4
commit 67c2f2445f

View file

@ -414,12 +414,12 @@ void ScrollContainer::update_scrollbars() {
bool hide_scroll_v = !scroll_v || min.height <= size.height; bool hide_scroll_v = !scroll_v || min.height <= size.height;
bool hide_scroll_h = !scroll_h || min.width <= size.width; bool hide_scroll_h = !scroll_h || min.width <= size.width;
v_scroll->set_max(min.height);
if (hide_scroll_v) { if (hide_scroll_v) {
v_scroll->hide(); v_scroll->hide();
scroll.y = 0; scroll.y = 0;
} else { } else {
v_scroll->show(); v_scroll->show();
v_scroll->set_max(min.height);
if (hide_scroll_h) { if (hide_scroll_h) {
v_scroll->set_page(size.height); v_scroll->set_page(size.height);
} else { } else {
@ -429,12 +429,12 @@ void ScrollContainer::update_scrollbars() {
scroll.y = v_scroll->get_value(); scroll.y = v_scroll->get_value();
} }
h_scroll->set_max(min.width);
if (hide_scroll_h) { if (hide_scroll_h) {
h_scroll->hide(); h_scroll->hide();
scroll.x = 0; scroll.x = 0;
} else { } else {
h_scroll->show(); h_scroll->show();
h_scroll->set_max(min.width);
if (hide_scroll_v) { if (hide_scroll_v) {
h_scroll->set_page(size.width); h_scroll->set_page(size.width);
} else { } else {