summaryrefslogtreecommitdiff
path: root/xmake/core/ui/rect.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-18 22:35:15 +0800
committerruki <[email protected]>2018-01-18 09:31:31 +0800
commitafdb22dcfeb898e051ed360fce04152b861aa3ad (patch)
tree5a8f56a1a527b86b282a1bb726fe1c497c6ef04e /xmake/core/ui/rect.lua
parent921a48f8332381d30c814419bfa05230155d342c (diff)
improve bounds for view
Diffstat (limited to 'xmake/core/ui/rect.lua')
-rw-r--r--xmake/core/ui/rect.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/core/ui/rect.lua b/xmake/core/ui/rect.lua
index 4e91ff702..005385922 100644
--- a/xmake/core/ui/rect.lua
+++ b/xmake/core/ui/rect.lua
@@ -45,6 +45,16 @@ function rect:size()
return point { self.ex - self.sx, self.ey - self.sy }
end
+-- get width
+function rect:width()
+ return self.ex - self.sx
+end
+
+-- get height
+function rect:height()
+ return self.ey - self.sy
+end
+
-- resize rect
function rect:resize(w, h)
self.ex = self.sx + w