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

Box title alignment support #371

Merged
merged 1 commit into from
Apr 24, 2021

Conversation

nanodeath
Copy link
Contributor

Add horizontal and "vertical" alignment for box titles by adding an additional enum parameter to box(). Closes #331.

Note, this is currently stacked on top of my other change, #369, because it uses some helpers I introduced there. I'm going to leave this as a draft until that one gets merged, so that this PR will just contain the one actual commit.

adam-arold
adam-arold previously approved these changes Apr 6, 2021
titleAlignment.isLeft() -> 0
titleAlignment.isRight() -> size.width - cleanText.length - 4
titleAlignment.isCenter() -> (size.width - cleanText.length - 4) / 2
else -> throw IllegalStateException("unreachable")
Copy link
Member

Choose a reason for hiding this comment

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

You should have written this should never happen 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You want me to? 😛

Copy link
Member

Choose a reason for hiding this comment

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

Haha, it is OK.

@nanodeath nanodeath force-pushed the box-title-alignment branch from a5a8217 to 153c4f4 Compare April 24, 2021 04:28
@nanodeath nanodeath marked this pull request as ready for review April 24, 2021 04:43
@nanodeath
Copy link
Contributor Author

This is ready for review!

One thing that I'm curious about -- for RTL support, we'd eventually want to say start/end instead of left/right. Do we have anything like that now or planned? Otherwise we can just add them later and deprecate left/right.

@adam-arold
Copy link
Member

adam-arold commented Apr 24, 2021

@nanodeath I have no idea what RTL is or how it is used (I guess it is not the television channel). Can you elaborate? But yes, what we usually do is to introduce the new thing (start/end), deprecate the old one, make a release, and mention in the patch notes that in the next release these will be removed.

@adam-arold adam-arold merged commit 8441af2 into Hexworks:master Apr 24, 2021
@nanodeath
Copy link
Contributor Author

RTL as in right-to-left. In CSS for example the flex-grid alignment is start/end instead of left/right because start is actually on the right side for an RTL locale.

I guess if/when we support RTL more broadly we can revisit this.

@adam-arold
Copy link
Member

Oh, got it. We can revisit this later if we add RTL support.

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.

Box Decoration Title Alignment
2 participants