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

Expanding fr #2221

Merged
merged 12 commits into from
Apr 6, 2023
Merged

Expanding fr #2221

merged 12 commits into from
Apr 6, 2023

Conversation

willmcgugan
Copy link
Collaborator

@willmcgugan willmcgugan commented Apr 5, 2023

Expand "auto" container if any child has a relative dimension (fr or %).

Fix margins not being respected when containers have auto dimensions.

Fixes #2220

@willmcgugan willmcgugan marked this pull request as draft April 5, 2023 17:01
@willmcgugan willmcgugan marked this pull request as ready for review April 6, 2023 09:08
Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao left a comment

Choose a reason for hiding this comment

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

Looking forward to using the new mechanism to handle fr units!

def is_relative_height(self) -> bool:
"""Does the node have a relative width?"""
height = self.height
return height is not None and height.unit in (Unit.FRACTION, Unit.PERCENT)
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't w, h, vh, and vw, relative units too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

w and h become percent units.

vh and vw aren't relative to the container, unless the container happens to be screen. Maybe the name could be clarified?

Copy link
Contributor

Choose a reason for hiding this comment

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

A clarification is always welcome, in my opinion.

src/textual/layouts/horizontal.py Show resolved Hide resolved
src/textual/layouts/horizontal.py Outdated Show resolved Hide resolved
tests/snapshot_tests/snapshot_apps/auto_fr.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@willmcgugan willmcgugan merged commit 44367a7 into main Apr 6, 2023
@willmcgugan willmcgugan deleted the expanding-fr branch April 6, 2023 16:30
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.

Margin and fr don't mix well
3 participants