Remember the sidebar size (#3700)

Store the current sidebar size using `best_size`
This commit is contained in:
Noisyfox 2024-01-17 23:36:43 +08:00 committed by GitHub
parent 44ad091bf0
commit 418aca7186
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2646,6 +2646,15 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
sidebar_layout.is_collapsed = !sidebar.IsShown();
}
// Keep tracking the current sidebar size, by storing it using `best_size`, which will be stored
// in the config and re-applied when the app is opened again.
this->sidebar->Bind(wxEVT_IDLE, [&sidebar, this](wxIdleEvent& e) {
if (sidebar.IsShown() && sidebar.IsDocked() && sidebar.rect.GetWidth() > 0) {
sidebar.BestSize(sidebar.rect.GetWidth(), sidebar.best_size.GetHeight());
}
e.Skip();
});
// Hide sidebar initially, will re-show it after initialization when we got proper window size
sidebar.Hide();
m_aui_mgr.Update();