Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't reduce the size of the window in fullscreen #1509

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

felipeerias
Copy link
Contributor

Update the calculation of the window's current scale to match our resizing logic, so we can prevent making the window smaller when entering fullscreen.

Fixes #1486

Update the calculation of the window's current scale to match
our resizing logic, so we can prevent making the window smaller
when entering fullscreen.

Fixes #1486
@svillar
Copy link
Member

svillar commented Aug 9, 2024

OK so I'm interested in knowing how the behaviour would be from now on. Would it be possible to write down here the how the size calculation changes depending on the scenario?

@svillar
Copy link
Member

svillar commented Aug 9, 2024

BTW it works great 😄

@felipeerias
Copy link
Contributor Author

felipeerias commented Aug 12, 2024

@svillar The calculation for resizing is roughly like this:

  • we have defined the default, minimum, and maximum sizes for the window
  • when we want to resize a window, we begin by identifying its main axis (horizontal or vertical)
  • the scale will determine the size the main axis of the window: 1X is the default, MIN_SCALE is the minimum and MAX_SCALE is the maximum; other values are interpolated between those points
  • the cross axis is calculated so that the dimensions of the window match the desired aspect ratio
  • there are additional checks so the result fits within the minimum and maximum sizes that we have defined

This calculation is only done when we use a pre-defined scale, for example when using the resize buttons, not when the user resizes the window manually.

This PR walks that calculation backwards to find the current scale of the window, so we can prevent making it smaller when it goes to fullscreen.

(The old code was doing the same, but it had not been updated to take into account the new way to do that calculation).

Copy link
Member

@svillar svillar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely and I have no additional comments WRT the code, so let's merge it.

@svillar svillar merged commit d06bdb0 into main Aug 12, 2024
22 checks passed
@svillar svillar deleted the felipeerias/fullscreen-size branch August 12, 2024 11:56
Copy link
Member

@javifernandez javifernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, indeed and it works well.

However, do you think this code is very similar to the one that implements the resizeByMultiplier function ?

I think some refactoring would make the resizing logic clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3x window resets to 2x when going fullscreen
3 participants