mirror of
https://github.com/vrld/HC.git
synced 2024-11-28 14:04:21 +00:00
Add moveTo
This commit is contained in:
parent
4a24422e54
commit
896f58110e
@ -57,6 +57,11 @@ end
|
|||||||
local Shape = Class{name = 'Shape', function(self, t)
|
local Shape = Class{name = 'Shape', function(self, t)
|
||||||
self._type = t
|
self._type = t
|
||||||
end}
|
end}
|
||||||
|
function Shape:moveTo(x,y)
|
||||||
|
local current = vector( self:center() )
|
||||||
|
local to = vector.isvector(x) and x or vector(x,y)
|
||||||
|
self:move( to-current )
|
||||||
|
end
|
||||||
|
|
||||||
-- supported shapes
|
-- supported shapes
|
||||||
Shape.POLYGON = setmetatable({}, {__tostring = function() return 'POLYGON' end})
|
Shape.POLYGON = setmetatable({}, {__tostring = function() return 'POLYGON' end})
|
||||||
|
Loading…
Reference in New Issue
Block a user