diff options
Diffstat (limited to '')
| -rw-r--r-- | native/src/widget/image/viewer.rs | 22 | 
1 files changed, 10 insertions, 12 deletions
diff --git a/native/src/widget/image/viewer.rs b/native/src/widget/image/viewer.rs index 0f081a1a..605298f1 100644 --- a/native/src/widget/image/viewer.rs +++ b/native/src/widget/image/viewer.rs @@ -371,12 +371,11 @@ impl State {      /// [`Viewer`]: struct.Viewer.html      /// [`State`]: struct.State.html      fn pan(&mut self, x: f32, y: f32, bounds: Rectangle, image_size: Size) { -        let hidden_width = ((image_size.width - bounds.width) as f32 / 2.0) -            .max(0.0) -            .round(); -        let hidden_height = ((image_size.height - bounds.height) as f32 / 2.0) -            .max(0.0) -            .round(); +        let hidden_width = +            (image_size.width - bounds.width / 2.0).max(0.0).round(); + +        let hidden_height = +            (image_size.height - bounds.height / 2.0).max(0.0).round();          let delta_x = x - self.starting_cursor_pos.unwrap().x;          let delta_y = y - self.starting_cursor_pos.unwrap().y; @@ -400,12 +399,11 @@ impl State {      /// [`Viewer`]: struct.Viewer.html      /// [`State`]: struct.State.html      fn offset(&self, bounds: Rectangle, image_size: Size) -> Vector { -        let hidden_width = ((image_size.width - bounds.width) as f32 / 2.0) -            .max(0.0) -            .round(); -        let hidden_height = ((image_size.height - bounds.height) as f32 / 2.0) -            .max(0.0) -            .round(); +        let hidden_width = +            (image_size.width - bounds.width / 2.0).max(0.0).round(); + +        let hidden_height = +            (image_size.height - bounds.height / 2.0).max(0.0).round();          Vector::new(              self.current_offset  | 
