mirror of https://github.com/odrling/Aegisub
Fix a zooming bug on linux
The preview window would change in width, when the video was being zoomed. Possibly, because on windows, zooming only calls UpdateSize once, but on linux, it gets called multiple, like 8 times. Rounding fixed it.
This commit is contained in:
parent
09ea0f54d3
commit
14d078fb9f
|
@ -330,11 +330,12 @@ void VideoDisplay::UpdateSize() {
|
|||
wxWindow *top = GetParent();
|
||||
while (!top->IsTopLevel()) top = top->GetParent();
|
||||
|
||||
wxSize cs = GetClientSize();
|
||||
float csAr = (float)cs.GetWidth() / (float)cs.GetHeight();
|
||||
wxSize oldClientSize = GetClientSize();
|
||||
double csAr = (double)oldClientSize.GetWidth() / (double)oldClientSize.GetHeight();
|
||||
wxSize newClientSize = wxSize(std::lround(provider->GetHeight() * csAr), provider->GetHeight()) * windowZoomValue / scale_factor;
|
||||
wxSize oldSize = top->GetSize();
|
||||
top->SetSize(top->GetSize() + wxSize(provider->GetHeight() * csAr, provider->GetHeight()) * windowZoomValue / scale_factor - cs);
|
||||
SetClientSize(cs + top->GetSize() - oldSize);
|
||||
top->SetSize(oldSize + (newClientSize - oldClientSize));
|
||||
SetClientSize(oldClientSize + (top->GetSize() - oldSize));
|
||||
}
|
||||
else {
|
||||
wxSize newSize = wxSize(provider->GetWidth(), provider->GetHeight()) * windowZoomValue / scale_factor;
|
||||
|
|
Loading…
Reference in New Issue