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();
|
wxWindow *top = GetParent();
|
||||||
while (!top->IsTopLevel()) top = top->GetParent();
|
while (!top->IsTopLevel()) top = top->GetParent();
|
||||||
|
|
||||||
wxSize cs = GetClientSize();
|
wxSize oldClientSize = GetClientSize();
|
||||||
float csAr = (float)cs.GetWidth() / (float)cs.GetHeight();
|
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();
|
wxSize oldSize = top->GetSize();
|
||||||
top->SetSize(top->GetSize() + wxSize(provider->GetHeight() * csAr, provider->GetHeight()) * windowZoomValue / scale_factor - cs);
|
top->SetSize(oldSize + (newClientSize - oldClientSize));
|
||||||
SetClientSize(cs + top->GetSize() - oldSize);
|
SetClientSize(oldClientSize + (top->GetSize() - oldSize));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wxSize newSize = wxSize(provider->GetWidth(), provider->GetHeight()) * windowZoomValue / scale_factor;
|
wxSize newSize = wxSize(provider->GetWidth(), provider->GetHeight()) * windowZoomValue / scale_factor;
|
||||||
|
|
Loading…
Reference in New Issue