fix typos and functions

This commit is contained in:
lustlion 2022-03-13 10:36:19 +01:00
parent 1039479c47
commit 5bcf25a461

View File

@ -15,7 +15,7 @@ end
-- clone refers to a deep copy
function Rect:clone()
return Rect:fromCoods(self.min.x, self.min.y, self.max.x, self.max.y)
return Rect:fromCoords(self.min.x, self.min.y, self.max.x, self.max.y)
end
-- make sure min and max refer to the correct corners
@ -55,15 +55,17 @@ function Rect:corners()
end
function Rect:containsPoint(pt)
return self.min.x < pt.x and
self.min.y < pt.y and
pt.x < self.max.x and
pt.y < self.max.y
return pt.x >= self.min.x
and pt.y >= self.min.y
and pt.x <= self.max.x
and pt.y <= self.max.y
end
function Rect:overlapsRect(other)
return self.min.x<other.max.x and self.min.x<other.max.x and
self.min.y<other.max.y and self.min.y<other.max.y
return self.min.x < other.max.x
and self.max.x > other.min.x
and self.min.y < other.max.y
and self.max.y > other.min.y
end
function Rect:draw(style)