Skip to content

Commit 2675a08

Browse files
committed
add :copy method, version 1.1
1 parent 4a38b42 commit 2675a08

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ end
5656
---@return number minX, number minY, number maxX, number maxY
5757
function Rect:unpack() return self.minX, self.minY, self.maxX, self.maxY end
5858

59+
---Returns a copy of this Rect.
60+
---@return Rect
61+
function Rect:copy() return Rect.new(self:unpack()) end
62+
5963
---Returns the components of this Rect, in XYWH format.
6064
---@return number x, number y, number width, number height
6165
function Rect:xywh()

0 commit comments

Comments
 (0)