diff options
author | 2024-01-12 14:41:40 +0100 | |
---|---|---|
committer | 2024-01-12 14:41:40 +0100 | |
commit | 50c310fd9f692eafb2350827636ffbd6d7b6c9b9 (patch) | |
tree | 0f1ab4182a0cce7469e01881c095e0c3988b3f9a /widget/src/svg.rs | |
parent | 63e9adac56e9a4f21ec82137329d7c455fbf630b (diff) | |
parent | 11474bdc3e1a43e6c167d7b98f22d87933dbd2b6 (diff) | |
download | iced-50c310fd9f692eafb2350827636ffbd6d7b6c9b9.tar.gz iced-50c310fd9f692eafb2350827636ffbd6d7b6c9b9.tar.bz2 iced-50c310fd9f692eafb2350827636ffbd6d7b6c9b9.zip |
Merge pull request #2192 from iced-rs/fix/layout-inconsistencies
Layout consistency
Diffstat (limited to 'widget/src/svg.rs')
-rw-r--r-- | widget/src/svg.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/widget/src/svg.rs b/widget/src/svg.rs index 2d01d1ab..830abb0f 100644 --- a/widget/src/svg.rs +++ b/widget/src/svg.rs @@ -96,12 +96,11 @@ where Renderer: svg::Renderer, Renderer::Theme: iced_style::svg::StyleSheet, { - fn width(&self) -> Length { - self.width - } - - fn height(&self) -> Length { - self.height + fn size(&self) -> Size<Length> { + Size { + width: self.width, + height: self.height, + } } fn layout( @@ -115,10 +114,7 @@ where let image_size = Size::new(width as f32, height as f32); // The size to be available to the widget prior to `Shrink`ing - let raw_size = limits - .width(self.width) - .height(self.height) - .resolve(image_size); + let raw_size = limits.resolve(self.width, self.height, image_size); // The uncropped size of the image when fit to the bounds above let full_size = self.content_fit.fit(image_size, raw_size); |