summaryrefslogtreecommitdiffstats
path: root/widget/src/image
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--widget/src/image.rs13
-rw-r--r--widget/src/image/viewer.rs20
2 files changed, 16 insertions, 17 deletions
diff --git a/widget/src/image.rs b/widget/src/image.rs
index 67699102..e906ac13 100644
--- a/widget/src/image.rs
+++ b/widget/src/image.rs
@@ -99,7 +99,7 @@ where
};
// The size to be available to the widget prior to `Shrink`ing
- let raw_size = limits.width(width).height(height).resolve(image_size);
+ let raw_size = limits.resolve(width, height, image_size);
// The uncropped size of the image when fit to the bounds above
let full_size = content_fit.fit(image_size, raw_size);
@@ -164,12 +164,11 @@ where
Renderer: image::Renderer<Handle = Handle>,
Handle: Clone + Hash,
{
- 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(
diff --git a/widget/src/image/viewer.rs b/widget/src/image/viewer.rs
index 68015ba8..98080577 100644
--- a/widget/src/image/viewer.rs
+++ b/widget/src/image/viewer.rs
@@ -97,12 +97,11 @@ where
tree::State::new(State::new())
}
- 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(
@@ -113,10 +112,11 @@ where
) -> layout::Node {
let Size { width, height } = renderer.dimensions(&self.handle);
- let mut size = limits
- .width(self.width)
- .height(self.height)
- .resolve(Size::new(width as f32, height as f32));
+ let mut size = limits.resolve(
+ self.width,
+ self.height,
+ Size::new(width as f32, height as f32),
+ );
let expansion_size = if height > width {
self.width