From 0a6e42b80bfd586aee6ee1144aa98cf1ea37a844 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 23 Nov 2026 13:30:20 -0500 Subject: [PATCH] fw sync: a Fill picture without a set aspect takes the SVG's own or a square (next 126ec28dc meets the port's optional aspect) --- crates/ui-widgets/src/display/picture.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/ui-widgets/src/display/picture.rs b/crates/ui-widgets/src/display/picture.rs index acb8f1114..4ff636e39 100644 --- a/crates/ui-widgets/src/display/picture.rs +++ b/crates/ui-widgets/src/display/picture.rs @@ -162,8 +162,15 @@ impl Component for Picture<'_> { if self.extent == PictureSize::Fill { // The room less the padding the pipeline adds, so the picture shrinks to a narrower room and never overflows it. // An unbounded room (a horizontal row or scroll) gives no width to fill: the icon side then sets the height. - let width = cx.room.filter(|room| room.is_finite()).map_or_else(|| self.aspect.of(cx.style.height), |room| room.max(0.0)); - return Vec2::new(width, self.aspect.high(width)); + // The aspect is the set one, else the SVG's own, else a square (`width` at a unit height). + let ratio = self.width(1.0); + let width = cx.room.filter(|room| room.is_finite()).map_or_else(|| self.width(cx.style.height), |room| room.max(0.0)); + let height = match self.aspect { + Some(aspect) => aspect.high(width), + None if ratio > 0.0 && ratio.is_finite() => width / ratio, + None => width, + }; + return Vec2::new(width, height); } let height = cx.style.height; Vec2::new(self.width(height), height)