summaryrefslogtreecommitdiffstats
path: root/native/src/widget/image/viewer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2022-12-20 11:45:38 +0100
committerLibravatar GitHub <noreply@github.com>2022-12-20 11:45:38 +0100
commit678de1187994f29e3701740617bb5b1963f80c69 (patch)
tree2971553e7bb3d2b9278b422f33e27c2c5c79e5d0 /native/src/widget/image/viewer.rs
parentd2d18479acd987b4a4f6a125c0dda7b2a6661df4 (diff)
parent6bb01b727611b83592f96b2b89371a12e7ce54d8 (diff)
downloadiced-678de1187994f29e3701740617bb5b1963f80c69.tar.gz
iced-678de1187994f29e3701740617bb5b1963f80c69.tar.bz2
iced-678de1187994f29e3701740617bb5b1963f80c69.zip
Merge pull request #1611 from iced-rs/fix/clippy-lints
Fix `clippy` lints for Rust 1.66
Diffstat (limited to 'native/src/widget/image/viewer.rs')
-rw-r--r--native/src/widget/image/viewer.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/native/src/widget/image/viewer.rs b/native/src/widget/image/viewer.rs
index 9c83287e..fdbd3216 100644
--- a/native/src/widget/image/viewer.rs
+++ b/native/src/widget/image/viewer.rs
@@ -170,8 +170,7 @@ where
} else {
state.scale / (1.0 + self.scale_step)
})
- .max(self.min_scale)
- .min(self.max_scale);
+ .clamp(self.min_scale, self.max_scale);
let image_size = image_size(
renderer,
@@ -251,16 +250,14 @@ where
let x = if bounds.width < image_size.width {
(state.starting_offset.x - delta.x)
- .min(hidden_width)
- .max(-hidden_width)
+ .clamp(-hidden_width, hidden_width)
} else {
0.0
};
let y = if bounds.height < image_size.height {
(state.starting_offset.y - delta.y)
- .min(hidden_height)
- .max(-hidden_height)
+ .clamp(-hidden_height, hidden_height)
} else {
0.0
};
@@ -374,8 +371,8 @@ impl State {
(image_size.height - bounds.height / 2.0).max(0.0).round();
Vector::new(
- self.current_offset.x.min(hidden_width).max(-hidden_width),
- self.current_offset.y.min(hidden_height).max(-hidden_height),
+ self.current_offset.x.clamp(-hidden_width, hidden_width),
+ self.current_offset.y.clamp(-hidden_height, hidden_height),
)
}