GUI fixes; Mesh loader WIP

This commit is contained in:
Nikita Kruglickiy
2021-01-19 14:08:53 +06:00
parent d4dd889bb5
commit ceaada7e2d
16 changed files with 433 additions and 58 deletions

View File

@@ -24,7 +24,7 @@ end
function Element:setWidth(width)
self._width = width
self:performLayout(self:getSize())
self:invalidateLayout()
end
function Element:getWidth()
@@ -34,7 +34,7 @@ end
function Element:setHeight(height)
self._height = height
self:performLayout(self:getSize())
self:invalidateLayout()
end
function Element:getHeight()
@@ -56,7 +56,7 @@ function Element:setPos(x, y)
end
function Element:getPos()
return self._x, self._y
return self:getX(), self:getY()
end
function Element:getAbsolutePos(x, y)
@@ -182,7 +182,7 @@ function Element:cursorIntersect(x, y)
--local self:getAbsoluteBounds()
local aX, aY = self:getAbsolutePos()
if x >= aX and x <= aX + self:getWidth() and y >= aY and y <= aY + self:getHeight() then
if x >= aX and x < aX + self:getWidth() and y >= aY and y < aY + self:getHeight() then
return true
end
@@ -256,10 +256,8 @@ function Element:_postEventToAllReverse(eventKey, ...)
end
function Element:_onThink()
if self:isEnabled() then
if type(self.think) == "function" then
self:think()
end
if self:isEnabled() and self:isVisible() then
self:think()
if self._firstChild then
self._firstChild:_postEventToAllReverse("THINK")
@@ -357,6 +355,13 @@ end
function Element:performLayout()
end
function Element:invalidateLayout()
self:performLayout(self:getSize())
end
function Element:think()
end
function Element:paint()
end