mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Update scrollbar on resize (and on startup)
This commit is contained in:
@@ -187,6 +187,10 @@ class MessageCtrl : public wxPanel {
|
|||||||
void update_scrollbar() {
|
void update_scrollbar() {
|
||||||
int screen_height = GetClientSize().y;
|
int screen_height = GetClientSize().y;
|
||||||
int total_height = messages.empty() ? 0 : messages.back()->bottom();
|
int total_height = messages.empty() ? 0 : messages.back()->bottom();
|
||||||
|
// update view_start to keep messages in view
|
||||||
|
int bottom = total_height - GetClientSize().y;
|
||||||
|
view_start = min(bottom, view_start);
|
||||||
|
view_start = max(0, view_start);
|
||||||
SetScrollbar(wxVERTICAL, view_start, screen_height, total_height);
|
SetScrollbar(wxVERTICAL, view_start, screen_height, total_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user