bug fixes and updates
This commit is contained in:
parent
43e307295e
commit
8615cb7edc
@ -18,7 +18,7 @@ setmetatable(element, {
|
|||||||
self = setmetatable({}, element)
|
self = setmetatable({}, element)
|
||||||
self.parentFunc = func
|
self.parentFunc = func
|
||||||
|
|
||||||
self:new(param,nil, w, h)
|
self:new(param,nil, w, h, flags)
|
||||||
self:createProxies()
|
self:createProxies()
|
||||||
|
|
||||||
---@type Element
|
---@type Element
|
||||||
@ -213,6 +213,11 @@ function element:setParam(p)
|
|||||||
self.context:bubbleUpdate()
|
self.context:bubbleUpdate()
|
||||||
end
|
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)
|
function element:setCalculatedSize(w, h)
|
||||||
self.view.minW = w or self.view.minW
|
self.view.minW = w or self.view.minW
|
||||||
self.view.minH = h or self.view.minH
|
self.view.minH = h or self.view.minH
|
||||||
@ -312,7 +317,9 @@ function element:externalRender()
|
|||||||
if self.settings.hasCanvas then
|
if self.settings.hasCanvas then
|
||||||
lg.translate(self.view.x, self.view.y)
|
lg.translate(self.view.x, self.view.y)
|
||||||
setColor(1, 1, 1, 1)
|
setColor(1, 1, 1, 1)
|
||||||
|
lg.setBlendMode('alpha','premultiplied')
|
||||||
draw(self.canvas, self.quad, 0, 0)
|
draw(self.canvas, self.quad, 0, 0)
|
||||||
|
lg.setBlendMode('alpha','alphamultiply')
|
||||||
end
|
end
|
||||||
|
|
||||||
lg.setScissor()
|
lg.setScissor()
|
||||||
@ -320,6 +327,7 @@ function element:externalRender()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function element:externalUpdate()
|
function element:externalUpdate()
|
||||||
|
self.context:set()
|
||||||
self.context:zIndex()
|
self.context:zIndex()
|
||||||
if not self.settings.failedCanvas
|
if not self.settings.failedCanvas
|
||||||
and self.settings.testRenderPasses == 0
|
and self.settings.testRenderPasses == 0
|
||||||
@ -355,6 +363,7 @@ function element:externalUpdate()
|
|||||||
self.deferRepos = false
|
self.deferRepos = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.context:unset()
|
||||||
return self.settings.remove
|
return self.settings.remove
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -167,11 +167,11 @@ function subscription:emit(...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function subscription:checkInside(x, y)
|
function subscription:checkInside(x, y)
|
||||||
return x>self.x and x<self.x+self.w and y>self.y and y<self.y+self.h
|
return x>self.stack.absX and x<self.stack.absX+self.w and y>self.stack.absY and y<self.stack.absY+self.h
|
||||||
end
|
end
|
||||||
|
|
||||||
function subscription:checkOutside(x, y)
|
function subscription:checkOutside(x, y)
|
||||||
return not (x>self.x and x<self.x+self.w and y>self.y and y<self.y+self.h)
|
return not (x>self.stack.absX and x<self.stack.absX+self.w and y>self.stack.absY and y<self.stack.absY+self.h)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@alias InputMouseClickSubscriptionCallback fun(x:number, y:number, mouseButton:string)
|
---@alias InputMouseClickSubscriptionCallback fun(x:number, y:number, mouseButton:string)
|
||||||
|
|||||||
@ -11,5 +11,5 @@ return function (callback)
|
|||||||
activeContext.element.callbacks.onUpdate = {}
|
activeContext.element.callbacks.onUpdate = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
activeContext.element.callbacks.onUpdate[activeContext.element.callbacks.onUpdate+1] = callback
|
activeContext.element.callbacks.onUpdate[#activeContext.element.callbacks.onUpdate+1] = callback
|
||||||
end
|
end
|
||||||
@ -1,4 +1,4 @@
|
|||||||
local path = string.sub(..., 1, string.len(...) - string.len(".control.size"))
|
local path = string.sub(..., 1, string.len(...) - string.len(".hooks.setPos"))
|
||||||
local stack = require(path..'.core.stack')
|
local stack = require(path..'.core.stack')
|
||||||
|
|
||||||
--Sets the relative position
|
--Sets the relative position
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
local path = string.sub(..., 1, string.len(...) - string.len(".control.size"))
|
local path = string.sub(..., 1, string.len(...) - string.len(".hooks.setSize"))
|
||||||
local stack = require(path..'.core.stack')
|
local stack = require(path..'.core.stack')
|
||||||
|
|
||||||
--Sets the computed/minimum size of an element to be used with layout calculations and rendering
|
--Sets the computed/minimum size of an element to be used with layout calculations and rendering
|
||||||
return function(w, h)
|
return function(w, h)
|
||||||
local currentStack = stack.getContext()
|
local currentStack = stack.getContext()
|
||||||
currentStack.element:setCalculatedSize(w, h)
|
currentStack.element:setSize(w, h)
|
||||||
end
|
end
|
||||||
@ -187,7 +187,6 @@ function grid:draw(xRoot, yRoot, width, height, children)
|
|||||||
if (not autoRows) and (not autoCols) then
|
if (not autoRows) and (not autoCols) then
|
||||||
|
|
||||||
if self.gridLayout.layout then
|
if self.gridLayout.layout then
|
||||||
|
|
||||||
local layout = {}
|
local layout = {}
|
||||||
--flip layout table
|
--flip layout table
|
||||||
for x = 1, #self.gridLayout.layout[1] do
|
for x = 1, #self.gridLayout.layout[1] do
|
||||||
|
|||||||
@ -147,7 +147,7 @@ function layout:draw()
|
|||||||
height = math.min(stack:normX(self.vars.width), maxW-x)
|
height = math.min(stack:normX(self.vars.width), maxW-x)
|
||||||
x = 0
|
x = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
self.callback(self.binder, x, y, width, height, children, self.vars.hpad, self.vars.vpad)
|
self.callback(self.binder, x, y, width, height, children, self.vars.hpad, self.vars.vpad)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user