-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Provide align hints to size_rules #350
Merged
Conversation
This file contains 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
Also: don't use invisible bars for main scroll region; they overlap ScrollLabel bars.
Note: the "float" button in the gallery editor needs alignment, which will be handled differently.
Rationale: usage of align(..) within layout does not align *self*, only inner content.
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.
Re-work how alignment is handled: pass through
size_rules
, and do not prevent stretching by default. A new layout specifier,pack
, is used to limit size and set alignment.Motivation: #329 — alignment is now available when calculating
size_rules
, albeit only the input (or parent item's) alignment. The result here is clean enough code.It is also possible to add alignment information to the returned
SizeRules
, thus exposing per-item alignment, however this leads to messier code (e.g. content alignment and widget alignment are not always equal, especially forText
content). Moreover, many widgets will prefer to stretch to all available space, thus making more refined combination of margins ineffective.AxisInfo::align: Option<Align>
for passing an align-hint intoLayout::size_rules
AlignHints
parameter fromLayout::set_rect
pack
layout specifier to size-limit and align contentAlign::Stretch
Stretch::None
does not prevent stretching (see also Stretch model (usage of excess space) #349)AlignPair
, replacingCompleteAlignment
SizeMgr::text_rules
now sets alignment;ConfigMgr::text_set_size
can optionally set alignmentSlider
widget: useConfigMgr::align_feature
Sub
andSubAssign
impls forSize
now use saturating subtraction; removeSize::clamped_sub