summaryrefslogtreecommitdiffstats
path: root/core/src/rectangle.rs
diff options
context:
space:
mode:
authorLibravatar bungoboingo <shankern@protonmail.com>2022-12-24 21:27:44 -0800
committerLibravatar bungoboingo <shankern@protonmail.com>2022-12-29 18:29:15 -0800
commit9f85e0c721927f1e3bd195a998ec7a80ec0e7455 (patch)
treeed4bc6f1f700f9570cc9c72428188d506951d80f /core/src/rectangle.rs
parentd91f4f6aa74d0693179a02167d626efa3ac4c20b (diff)
downloadiced-9f85e0c721927f1e3bd195a998ec7a80ec0e7455.tar.gz
iced-9f85e0c721927f1e3bd195a998ec7a80ec0e7455.tar.bz2
iced-9f85e0c721927f1e3bd195a998ec7a80ec0e7455.zip
Reworked Scrollable to account for lack of widget order guarantees.
Fixed thumb "snapping" bug on scrollable when cursor is out of bounds.
Diffstat (limited to 'core/src/rectangle.rs')
-rw-r--r--core/src/rectangle.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs
index 4fe91519..c6e6fce4 100644
--- a/core/src/rectangle.rs
+++ b/core/src/rectangle.rs
@@ -111,6 +111,12 @@ impl Rectangle<f32> {
}
}
+impl std::cmp::PartialOrd for Rectangle<f32> {
+ fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
+ (self.width * self.height).partial_cmp(&(other.width * other.height))
+ }
+}
+
impl std::ops::Mul<f32> for Rectangle<f32> {
type Output = Self;