diff options
Diffstat (limited to 'xmake/core/ui/rect.lua')
| -rw-r--r-- | xmake/core/ui/rect.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/core/ui/rect.lua b/xmake/core/ui/rect.lua index 623dc8ee6..c10d54377 100644 --- a/xmake/core/ui/rect.lua +++ b/xmake/core/ui/rect.lua @@ -54,6 +54,17 @@ function rect:move(dx, dy) return self end +-- move rect to the given position +function rect:move2(x, y) + local w = self.ex - self.sx + local h = self.ey - self.sy + self.sx = x + self.sy = y + self.ex = x + w + self.ey = y + h + return self +end + -- move top right corner of the rect function rect:moves(dx, dy) self.sx = self.sx + dx |
