mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-08 11:39:01 +08:00
ENH: save video ctrl size to reduce layout change
Change-Id: I470f29d7f029d304c9badeeb8f94bed281080b29 Jira: STUDIO-6141
This commit is contained in:
parent
4bb8c6b373
commit
30dc8b3117
@ -772,9 +772,7 @@ void wxMediaCtrl2::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
wxMediaCtrl::DoSetSize(x, y, width, height, sizeFlags);
|
||||
#endif
|
||||
if (sizeFlags & wxSIZE_USE_EXISTING) return;
|
||||
wxSize size = GetVideoSize();
|
||||
if (size.GetWidth() <= 0)
|
||||
size = wxSize{16, 9};
|
||||
wxSize size = m_video_size;
|
||||
int maxHeight = (width * size.GetHeight() + size.GetHeight() - 1) / size.GetWidth();
|
||||
if (maxHeight != GetMaxHeight()) {
|
||||
// BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2::DoSetSize: width: " << width << ", height: " << height << ", maxHeight: " << maxHeight;
|
||||
|
@ -216,7 +216,10 @@ wxSize wxMediaCtrl2::GetVideoSize() const
|
||||
// "Loading...". Fake it out for now.
|
||||
return m_loaded ? wxSize(1280, 720) : wxSize{};
|
||||
#else
|
||||
return m_imp ? m_imp->GetVideoSize() : wxSize(0, 0);
|
||||
wxSize size = m_imp ? m_imp->GetVideoSize() : wxSize(0, 0);
|
||||
if (size.GetWidth() > 0)
|
||||
const_cast<wxSize&>(m_video_size) = size;
|
||||
return size;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ private:
|
||||
void * m_player = nullptr;
|
||||
wxMediaState m_state = wxMEDIASTATE_STOPPED;
|
||||
int m_error = 0;
|
||||
wxSize m_video_size{16, 9};
|
||||
};
|
||||
|
||||
#else
|
||||
@ -86,6 +87,7 @@ private:
|
||||
wxString m_idle_image;
|
||||
int m_error = 0;
|
||||
bool m_loaded = false;
|
||||
wxSize m_video_size{16, 9};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -155,6 +155,8 @@ wxSize wxMediaCtrl2::GetVideoSize() const
|
||||
BambuPlayer * player2 = (BambuPlayer *) m_player;
|
||||
if (player2) {
|
||||
NSSize size = [player2 videoSize];
|
||||
if (size.width > 0)
|
||||
const_cast<wxSize&>(m_video_size) = {(int) size.width, (int) size.height};
|
||||
return {(int) size.width, (int) size.height};
|
||||
} else {
|
||||
return {0, 0};
|
||||
|
Loading…
x
Reference in New Issue
Block a user