diff options
author | 2023-07-27 18:48:06 +0200 | |
---|---|---|
committer | 2023-07-27 18:48:06 +0200 | |
commit | 18f1ab551be6fe9a603eb07dceddf231c01b5c7f (patch) | |
tree | a4fd30a4252c3a1469a618ac4754ee8a6d81a518 /core/src/rectangle.rs | |
parent | e4b75ec9c76402dda7c6b6631918da240bb1c7ed (diff) | |
parent | cbb5fcc8829e6fbe60f97cad8597c86ffd4f5b1a (diff) | |
download | iced-18f1ab551be6fe9a603eb07dceddf231c01b5c7f.tar.gz iced-18f1ab551be6fe9a603eb07dceddf231c01b5c7f.tar.bz2 iced-18f1ab551be6fe9a603eb07dceddf231c01b5c7f.zip |
Merge pull request #1971 from iced-rs/visible-bounds-operation
`visible_bounds` operation for `Container`
Diffstat (limited to 'core/src/rectangle.rs')
-rw-r--r-- | core/src/rectangle.rs | 15 |
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 + } + } +} |