fix: behaviors of fit-to-height
and fit-to-width
#131
Merged
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.
This PR addresses the behaviors of the
fit-to-height
andfit-to-width
functions, resolving issues related to #109.Changes
width
andheight
parameters ofmeasure
: Replaced previous hacks using hidden labels withmeasure
's width and height parameters to accurately determine relative sizes within a container.scale
: Eliminated the need for a nested box to handle the size of thescale
by utilizing thereflow
parameter ofscale
.1fr
is determined by otherfr
s in the same container, so only one0.5fr
in the container is equivalent to100%
. To avoid this confusion, I slightly changed the documented examples to use%
instead.Notes
Please review the changes, particularly the updated example and the new implementation using
measure
. Any feedback is welcome!