Skip to content

Commit

Permalink
Use current window's aspect for resizing
Browse files Browse the repository at this point in the history
When rescaling a window using presets, we used to do it based on
the default window size. However it'd make much sense to do it
based on the current window size. On example of that is watching
vertical videos.
  • Loading branch information
svillar committed Jan 23, 2024
1 parent f03d460 commit c77cd08
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ private void exitVRVideo() {
}

private void setResizePreset(float aMultiplier) {
final float aspect = SettingsStore.getInstance(getContext()).getWindowAspect();
final float aspect = (float) mAttachedWindow.getWindowWidth() / (float) mAttachedWindow.getWindowHeight();
mAttachedWindow.resizeByMultiplier(aspect, aMultiplier);
}

Expand Down Expand Up @@ -1322,9 +1322,10 @@ private void finishWidgetResize() {

private void startWidgetResize() {
if (mAttachedWindow != null) {
Pair<Float, Float> maxSize = mAttachedWindow.getSizeForScale(mAttachedWindow.getMaxWindowScale());
Pair<Float, Float> minSize = mAttachedWindow.getSizeForScale(0.5f);
mWidgetManager.startWidgetResize(mAttachedWindow, maxSize.first, 4.5f, minSize.first, minSize.second);
final float aspect = (float) mAttachedWindow.getWindowWidth() / (float) mAttachedWindow.getWindowHeight();
Pair<Float, Float> maxSize = mAttachedWindow.getSizeForScale(mAttachedWindow.getMaxWindowScale(), aspect);
Pair<Float, Float> minSize = mAttachedWindow.getSizeForScale(0.5f, aspect);
mWidgetManager.startWidgetResize(mAttachedWindow, maxSize.first, maxSize.second, minSize.first, minSize.second);
}
}

Expand Down

0 comments on commit c77cd08

Please sign in to comment.