From 10d6df73e34e421cbf96d62b26c0c0701d9096ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 18 Dec 2020 11:28:55 +0100 Subject: [PATCH] Remove `max_width` and `max_height` from `image::Viewer` The support for these layout constraints is currently not ideal. We should reintroduce these methods once our layout engine improves. --- native/src/widget/image/viewer.rs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/native/src/widget/image/viewer.rs b/native/src/widget/image/viewer.rs index ba4ee087..4ec3faf6 100644 --- a/native/src/widget/image/viewer.rs +++ b/native/src/widget/image/viewer.rs @@ -8,7 +8,7 @@ use crate::{ Widget, }; -use std::{f32, hash::Hash, u32}; +use std::hash::Hash; /// A frame that displays an image with the ability to zoom in/out and pan. #[allow(missing_debug_implementations)] @@ -17,8 +17,6 @@ pub struct Viewer<'a> { padding: u16, width: Length, height: Length, - max_width: u32, - max_height: u32, min_scale: f32, max_scale: f32, scale_step: f32, @@ -35,8 +33,6 @@ impl<'a> Viewer<'a> { padding: 0, width: Length::Shrink, height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, min_scale: 0.25, max_scale: 10.0, scale_step: 0.10, @@ -62,18 +58,6 @@ impl<'a> Viewer<'a> { self } - /// Sets the max width of the [`Viewer`]. - pub fn max_width(mut self, max_width: u32) -> Self { - self.max_width = max_width; - self - } - - /// Sets the max height of the [`Viewer`]. - pub fn max_height(mut self, max_height: u32) -> Self { - self.max_height = max_height; - self - } - /// Sets the max scale applied to the image of the [`Viewer`]. /// /// Default is `10.0` @@ -315,8 +299,6 @@ where self.width.hash(state); self.height.hash(state); - self.max_width.hash(state); - self.max_height.hash(state); self.padding.hash(state); self.handle.hash(state);