Small bugfix

Fixed border bug
This commit is contained in:
Robert Jelic
2023-04-30 23:52:25 +02:00
parent 33397b0871
commit fbdc1fa3b0

View File

@@ -5,8 +5,8 @@ return {
local object = { local object = {
setBorder = function(self, ...) setBorder = function(self, ...)
if(...~=nil)then local t = {...}
local t = {...} if(t~=nil)then
for k,v in pairs(t)do for k,v in pairs(t)do
if(v=="left")or(#t==1)then if(v=="left")or(#t==1)then
borderColors["left"] = t[1] borderColors["left"] = t[1]
@@ -29,51 +29,51 @@ return {
draw = function(self) draw = function(self)
base.draw(self) base.draw(self)
self:addDraw("border", function() self:addDraw("border", function()
if(border~=false)then local x, y = self:getPosition()
local x, y = self:getPosition() local w,h = self:getSize()
local w,h = self:getSize() local bgCol = self:getBackground()
local bgCol = self:getBackground() if(inline)then
if(inline)then if(borderColors["left"]~=false)then
if(borderColors["left"]~=false)then self:addTextBox(1, 1, 1, h, "\149")
self:addTextBox(1, 1, 1, h, "\149") if(bgCol~=false)then self:addBackgroundBox(1, 1, 1, h, bgCol) end
if(bgCol~=false)then self:addBackgroundBox(1, 1, 1, h, bgCol) end self:addForegroundBox(1, 1, 1, h, borderColors["left"])
self:addForegroundBox(1, 1, 1, h, borderColors["left"]) end
end
if(borderColors["top"]~=false)then if(borderColors["top"]~=false)then
self:addTextBox(1, 1, w, 1, "\131") self:addTextBox(1, 1, w, 1, "\131")
if(bgCol~=false)then self:addBackgroundBox(1, 1, w, 1, bgCol) end if(bgCol~=false)then self:addBackgroundBox(1, 1, w, 1, bgCol) end
self:addForegroundBox(1, 1, w, 1, borderColors["top"]) self:addForegroundBox(1, 1, w, 1, borderColors["top"])
end end
if(borderColors["left"]~=false)and(borderColors["top"]~=false)then
self:addTextBox(1, 1, 1, 1, "\151") if(borderColors["left"]~=false)and(borderColors["top"]~=false)then
if(bgCol~=false)then self:addBackgroundBox(1, 1, 1, 1, bgCol) end self:addTextBox(1, 1, 1, 1, "\151")
self:drawForegroundBox(1, 1, 1, 1, borderColors["left"]) if(bgCol~=false)then self:addBackgroundBox(1, 1, 1, 1, bgCol) end
end self:addForegroundBox(1, 1, 1, 1, borderColors["left"])
if(borderColors["right"]~=false)then end
self:addTextBox(w, 1, 1, h, "\149") if(borderColors["right"]~=false)then
if(bgCol~=false)then self:addForegroundBox(w, 1, 1, h, bgCol) end self:addTextBox(w, 1, 1, h, "\149")
self:addBackgroundBox(w, 1, 1, h, borderColors["right"]) if(bgCol~=false)then self:addForegroundBox(w, 1, 1, h, bgCol) end
end self:addBackgroundBox(w, 1, 1, h, borderColors["right"])
if(borderColors["bottom"]~=false)then end
self:addTextBox(1, h, w, 1, "\143") if(borderColors["bottom"]~=false)then
if(bgCol~=false)then self:addForegroundBox(1, h, w, 1, bgCol) end self:addTextBox(1, h, w, 1, "\143")
self:addBackgroundBox(1, h, w, 1, borderColors["bottom"]) if(bgCol~=false)then self:addForegroundBox(1, h, w, 1, bgCol) end
end self:addBackgroundBox(1, h, w, 1, borderColors["bottom"])
if(borderColors["top"]~=false)and(borderColors["right"]~=false)then end
self:addTextBox(w, 1, 1, 1, "\148") if(borderColors["top"]~=false)and(borderColors["right"]~=false)then
if(bgCol~=false)then self:addForegroundBox(w, 1, 1, 1, bgCol) end self:addTextBox(w, 1, 1, 1, "\148")
self:addBackgroundBox(w, 1, 1, 1, borderColors["right"]) if(bgCol~=false)then self:addForegroundBox(w, 1, 1, 1, bgCol) end
end self:addBackgroundBox(w, 1, 1, 1, borderColors["right"])
if(borderColors["right"]~=false)and(borderColors["bottom"]~=false)then end
self:addTextBox(w, h, 1, 1, "\133") if(borderColors["right"]~=false)and(borderColors["bottom"]~=false)then
if(bgCol~=false)then self:addForegroundBox(w, h, 1, 1, bgCol) end self:addTextBox(w, h, 1, 1, "\133")
self:addBackgroundBox(w, h, 1, 1, borderColors["right"]) if(bgCol~=false)then self:addForegroundBox(w, h, 1, 1, bgCol) end
end self:addBackgroundBox(w, h, 1, 1, borderColors["right"])
if(borderColors["bottom"]~=false)and(borderColors["left"]~=false)then end
self:addTextBox(1, h, 1, 1, "\138") if(borderColors["bottom"]~=false)and(borderColors["left"]~=false)then
if(bgCol~=false)then self:addForegroundBox(0, h, 1, 1, bgCol) end self:addTextBox(1, h, 1, 1, "\138")
self:addBackgroundBox(1, h, 1, 1, borderColors["left"]) if(bgCol~=false)then self:addForegroundBox(0, h, 1, 1, bgCol) end
end self:addBackgroundBox(1, h, 1, 1, borderColors["left"])
end end
end end
end) end)