aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-05-05 07:43:21 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-05 07:43:21 +0400
commit2dff67447082f3c000b7eb68b4826f5b3db7397b (patch)
tree3351acf6d6ac16af8de951c52c6a43861495ea3f
parent23850e1c60a211965531e341befa419db809bb66 (diff)
downloadniri-2dff67447082f3c000b7eb68b4826f5b3db7397b.tar.gz
niri-2dff67447082f3c000b7eb68b4826f5b3db7397b.tar.bz2
niri-2dff67447082f3c000b7eb68b4826f5b3db7397b.zip
Don't expand zero radius per corner
So that radii like 8 8 0 0 look properly.
-rw-r--r--niri-config/src/lib.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index e5b13a50..39784c4e 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -1129,18 +1129,21 @@ impl CornerRadius {
}
}
- pub fn expanded_by(self, width: f32) -> Self {
- // Preserve zero radius.
- if self == Self::default() {
- return self;
+ pub fn expanded_by(mut self, width: f32) -> Self {
+ if self.top_left > 0. {
+ self.top_left += width;
}
-
- Self {
- top_left: self.top_left + width,
- top_right: self.top_right + width,
- bottom_right: self.bottom_right + width,
- bottom_left: self.bottom_left + width,
+ if self.top_right > 0. {
+ self.top_right += width;
+ }
+ if self.bottom_right > 0. {
+ self.bottom_right += width;
}
+ if self.bottom_left > 0. {
+ self.bottom_left += width;
+ }
+
+ self
}
pub fn scaled_by(self, scale: f32) -> Self {