Skip to content

Commit 076a048

Browse files
committed
Added safety set widget and height.
1 parent 4989515 commit 076a048

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/SparrowKit/CoreGraphics/CGRectExtension.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public extension CGRect {
4848
- parameter width: New `width`.
4949
*/
5050
mutating func setWidth(_ width: CGFloat) {
51+
if width == self.width { return }
5152
self = CGRect.init(x: origin.x, y: origin.y, width: width, height: height)
5253
}
5354

@@ -57,6 +58,7 @@ public extension CGRect {
5758
- parameter height: New `height`.
5859
*/
5960
mutating func setHeight(_ height: CGFloat) {
61+
if height == self.height { return }
6062
self = CGRect.init(x: origin.x, y: origin.y, width: width, height: height)
6163
}
6264

@@ -67,6 +69,7 @@ public extension CGRect {
6769
- parameter height: New `height`.
6870
*/
6971
mutating func setWidth(_ width: CGFloat, height: CGFloat) {
72+
if width == self.width && height == self.height { return }
7073
self = CGRect.init(x: origin.x, y: origin.y, width: width, height: height)
7174
}
7275

0 commit comments

Comments
 (0)