Open SoulSharer opened 1 week ago
This seems like a legitimate bug. I think the root of the problem here is that we need to treat "replaced" content such as images specially (how exactly, I'm not quite sure). You might be able to work around it by returning a zero size when the MinContent
size is requested.
Appreciate a timely response!
I tried returning Size::ZERO
when AvailableSpace::MIN_CONTENT
, it now fits perfectly but the whole point of keeping aspect ratio of an image with measure_function
is sadly gone (layout bounds are now stretched).
taffy
version02453b2c47dd639e337294fcc98318232b2e93b4 and fae17c2b2b69282cbf3cef399a56aaca052e7507 (v0.6.1)
Platform
Rust
What you did
I took
examples/measure.rs
and changed:compute_layout_with_measure()
to be fixed 512x512.flex_shrink: 1
to childrenStyle
s in hopes it would fix calculation.size
fills available space withpercent(1.0)
.Modified
measure.rs
follows:Result is:
Second leaf height overflows available space.
What went wrong
what were you expecting? Leaf children should fit into available space.
what actually happened? Second leaf overflows layout.
Additional information
I've tried different style configurations, including
flex-basis
, but all seems to come down to ameasure_function
which does not receive full information from a parent to properly size image content that would fit the layout.