Skip to content

Commit

Permalink
Correctly use aspect ratio constrainer (#6005)
Browse files Browse the repository at this point in the history
This change correctly sets the aspect ratio constrainer for the
juce resize handler.

In standalone it perfectly preserves it
In bitwig mac vst3 it perfectly preserves it
In reaper mac the window is embedded and does not obey the content
aspect ratio
In logic there is no drag to resize

So seems it at least makes it 'better or same'. We should test this
in the daws showing problems in #5211 (which I dont have access to
right now) to see if it helps.
  • Loading branch information
baconpaul authored Apr 2, 2022
1 parent 79108f2 commit 25c14a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/surge-xt/SurgeSynthEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ void SurgeSynthEditor::resized()
auto wR = 1.0 * w / adapter->getWindowSizeX();
auto hR = 1.0 * h / adapter->getWindowSizeY();

auto ar =
1.f * adapter->getWindowSizeX() /
(adapter->getWindowSizeY() + (drawExtendedControls ? extraYSpaceForVirtualKeyboard : 0));
if (getConstrainer())
getConstrainer()->setFixedAspectRatio(ar);

auto zfn = std::min(wR, hR);
if (wR < 1 && hR < 1)
zfn = std::max(wR, hR);
Expand Down

0 comments on commit 25c14a8

Please sign in to comment.