summaryrefslogtreecommitdiffstats
path: root/core/src/rectangle.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-07-27 01:02:28 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-07-27 01:04:18 +0200
commite2ba7ece83f141c149659747977147392df008f4 (patch)
tree5fa04524d0ca95c6289c4d5962af7a97098ec811 /core/src/rectangle.rs
parente29754f32d03efc4b075e9b63cc554d128bc2ccf (diff)
downloadiced-e2ba7ece83f141c149659747977147392df008f4.tar.gz
iced-e2ba7ece83f141c149659747977147392df008f4.tar.bz2
iced-e2ba7ece83f141c149659747977147392df008f4.zip
Introduce `visible_bounds` operation for `Container`
Diffstat (limited to 'core/src/rectangle.rs')
-rw-r--r--core/src/rectangle.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs
index 7ff324cb..db56aa18 100644
--- a/core/src/rectangle.rs
+++ b/core/src/rectangle.rs
@@ -197,3 +197,18 @@ where
}
}
}
+
+impl<T> std::ops::Sub<Vector<T>> for Rectangle<T>
+where
+ T: std::ops::Sub<Output = T>,
+{
+ type Output = Rectangle<T>;
+
+ fn sub(self, translation: Vector<T>) -> Self {
+ Rectangle {
+ x: self.x - translation.x,
+ y: self.y - translation.y,
+ ..self
+ }
+ }
+}