Repository navigation
Dynamic constraints for resizable components - #13439
Merged
Merged
Conversation
The only time the `||` would come into play is if startWidth is zero (as it relies on loose falsy values) and that's not the intention of the code.
This was referenced Dec 3, 2021
tidy-dev
reviewed
Dec 6, 2021
|
|
||
| function constrain( | ||
| value: IConstrainedValue | number, | ||
| min = -Infinity, |
Contributor
There was a problem hiding this comment.
TIL: You can specify infinity as a number 🤯
Member
Author
There was a problem hiding this comment.
It's the negative infinity that cracks me up! 😄
tidy-dev
approved these changes
Dec 6, 2021
tidy-dev
left a comment
Contributor
There was a problem hiding this comment.
✨ Looks great and tested it out and feels oddly freeing 😸
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2745
Description
Since the very first versions of GitHub Desktop we've enforced a max width for our resizable components (the changes/history list, and the file list in the stashed changes view and in the selected commit view).
These constraints were put in place to ensure that you couldn't resize these components to a point where you could no longer use parts of the UI because they were now being rendered outside of the window bounds.
The constraints we set where based on running the app in the minimum window size such that it wouldn't be possible to maximize the app, resize the panes, and then restore the window size and find yourself in a situation where parts of the UI were being rendered outside of the window bounds.
This was always intended to be a temporary solution until we could get around to implementing a dynamic max-width that got recalculated based on the layout of the app and the window size (see #1588 (comment)). There's been several attempts by community contributors to address this issue that we've unfortunately had to reject since they focused on removing/increasing the constraints, not making the constraints themselves adapt to the window dimensions.
In this PR we're making the resizable panes remember their "desired" value and dynamically calculate their max width depending on the width of other resizable panes that affect the available space and the windows dimensions while making sure the the UI is usable.
By keeping track of the desired width we can support resizing the application in a consistent way where maximizing the app, resizing the panes then restoring its size will cause the panes to shrink to fit their constraints but (unless modified again) they will inflate to their desired size again once the app is maximized again.
Screenshots
Release notes
Notes: