Don't expand zero radius per corner
Browse files at this commit2dff67447082f3c000b7eb68b4826f5b3db7397bParent: 23850e11 changed file +13 -10
- niri-config/src/lib.rs +13 -10
niri-config/src/lib.rsmodified+13 -10
| @@ -1129,18 +1129,21 @@ impl CornerRadius { | ||
| 1129 | 1129 | } |
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | - pub fn expanded_by(self, width: f32) -> Self { | |
| 1133 | - // Preserve zero radius. | |
| 1134 | - if self == Self::default() { | |
| 1135 | - return self; | |
| 1132 | + pub fn expanded_by(mut self, width: f32) -> Self { | |
| 1133 | + if self.top_left > 0. { | |
| 1134 | + self.top_left += width; | |
| 1136 | 1135 | } |
| 1137 | - | |
| 1138 | - Self { | |
| 1139 | - top_left: self.top_left + width, | |
| 1140 | - top_right: self.top_right + width, | |
| 1141 | - bottom_right: self.bottom_right + width, | |
| 1142 | - bottom_left: self.bottom_left + width, | |
| 1136 | + if self.top_right > 0. { | |
| 1137 | + self.top_right += width; | |
| 1138 | + } | |
| 1139 | + if self.bottom_right > 0. { | |
| 1140 | + self.bottom_right += width; | |
| 1143 | 1141 | } |
| 1142 | + if self.bottom_left > 0. { | |
| 1143 | + self.bottom_left += width; | |
| 1144 | + } | |
| 1145 | + | |
| 1146 | + self | |
| 1144 | 1147 | } |
| 1145 | 1148 | |
| 1146 | 1149 | pub fn scaled_by(self, scale: f32) -> Self { |