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

Add pivot to reflow #144

Merged
merged 1 commit into from
Mar 16, 2024
Merged

Conversation

Uriopass
Copy link
Contributor

@Uriopass Uriopass commented Feb 7, 2024

This allows reflowing while taking into account the child size. I personally need this to be able to show a tooltip over a button (when hovered for a bit) that is nicely centered.

I introduced a new "Pivot" type to avoid accidentally swapping the anchor and the pivot arguments in the reflow shorthand.

Another idea: This could be implemented as a separate Pivot widget with the same offset logic.
Could also be added to the Offset widget which would now also take relative (pivot) coordinates.
(Could be worth simplifying Flow::Relative removing offset since the Offset widget can already do this?)

Some screenshots:

Backward compat: Pivot is TOP_LEFT.
Screenshot from 2024-02-07 16-34-21

Pivot is 'CENTER':
Screenshot from 2024-02-07 16-51-56

Pivot is equal to anchor:
Screenshot from 2024-02-07 16-51-11

@Uriopass Uriopass requested a review from LPGhatguy as a code owner February 7, 2024 16:08
allows attaching the reflowed element anywhere from the anchor point
Copy link
Member

@LPGhatguy LPGhatguy left a comment

Choose a reason for hiding this comment

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

This is a good change! I like your rationale for the introduction of the new type.

I'd like to revisit which layout widgets we have and how they're composed soon. I think that'd be good to do as part of a holistic layout pass since I think there's a lot of merging to do.

@LPGhatguy LPGhatguy merged commit 54de82b into SecondHalfGames:main Mar 16, 2024
2 checks passed
Uriopass added a commit to Uriopass/yakui that referenced this pull request Jun 30, 2024
allows attaching the reflowed element anywhere from the anchor point
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.

2 participants