From 8615cb7edc090e5d2577aefd4b6279d4b687eb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elm=C4=81rs=20=C4=80boli=C5=86=C5=A1?= Date: Wed, 16 Jun 2021 07:05:54 +0300 Subject: [PATCH] bug fixes and updates --- core/element.lua | 11 ++++++++++- core/input.lua | 4 ++-- hooks/onUpdate.lua | 2 +- hooks/setPos.lua | 2 +- hooks/setSize.lua | 4 ++-- layout/grid.lua | 1 - layout/init.lua | 2 +- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/core/element.lua b/core/element.lua index 2c8c42c..52b356a 100644 --- a/core/element.lua +++ b/core/element.lua @@ -18,7 +18,7 @@ setmetatable(element, { self = setmetatable({}, element) self.parentFunc = func - self:new(param,nil, w, h) + self:new(param,nil, w, h, flags) self:createProxies() ---@type Element @@ -213,6 +213,11 @@ function element:setParam(p) self.context:bubbleUpdate() end +function element:setSize(w, h) + self.view.w = w or self.view.w + self.view.h = h or self.view.h +end + function element:setCalculatedSize(w, h) self.view.minW = w or self.view.minW self.view.minH = h or self.view.minH @@ -312,7 +317,9 @@ function element:externalRender() if self.settings.hasCanvas then lg.translate(self.view.x, self.view.y) setColor(1, 1, 1, 1) + lg.setBlendMode('alpha','premultiplied') draw(self.canvas, self.quad, 0, 0) + lg.setBlendMode('alpha','alphamultiply') end lg.setScissor() @@ -320,6 +327,7 @@ function element:externalRender() end function element:externalUpdate() + self.context:set() self.context:zIndex() if not self.settings.failedCanvas and self.settings.testRenderPasses == 0 @@ -355,6 +363,7 @@ function element:externalUpdate() self.deferRepos = false end + self.context:unset() return self.settings.remove end diff --git a/core/input.lua b/core/input.lua index 8c8ae82..3d884d0 100644 --- a/core/input.lua +++ b/core/input.lua @@ -167,11 +167,11 @@ function subscription:emit(...) end function subscription:checkInside(x, y) - return x>self.x and xself.y and yself.stack.absX and xself.stack.absY and yself.x and xself.y and yself.stack.absX and xself.stack.absY and y