Skip to content

Commit 8326d02

Browse files
committed
very small bugfix
1 parent 3799cf9 commit 8326d02

6 files changed

Lines changed: 15 additions & 11 deletions

File tree

basalt-source.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ local function Object(name)
766766

767767
setSize = function(self, width, height)
768768
self.width, self.height = width, height
769+
eventSystem:sendEvent("basalt_resize", self)
769770
visualsChanged = true
770771
return self
771772
end;
@@ -2060,15 +2061,15 @@ local function Label(name)
20602061
if(self.bgColor~=false)then
20612062
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
20622063
self.parent:drawTextBox(obx, oby, self.width, self.height, " ") end
2063-
if(self.bgColor~=false)then self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor) end
2064+
if(self.fgColor~=false)then self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor) end
20642065
if(fontsize==0)then
20652066
for n = 1, self.height do
20662067
if (n == verticalAlign) then
2067-
self.parent:writeText(obx, oby + (n - 1), getTextHorizontalAlign(self:getValue(), self.width, textHorizontalAlign), self.bgColor, self.fgColor)
2068+
self.parent:setText(obx, oby + (n - 1), getTextHorizontalAlign(self:getValue(), self.width, textHorizontalAlign))
20682069
end
20692070
end
20702071
else
2071-
local tData = makeText(fontsize, self:getValue(), self.fgColor, self.bgColor)
2072+
local tData = makeText(fontsize, self:getValue(), self.fgColor, self.bgColor or colors.black)
20722073
if(autoSize)then
20732074
self.height = #tData[1]-1
20742075
self.width = #tData[1][1]
@@ -2082,7 +2083,7 @@ local function Label(name)
20822083

20832084
for i = 1, cY do
20842085
self.parent:setFG(obx, oby + i + n - 2, getTextHorizontalAlign(tData[2][i], self.width, textHorizontalAlign))
2085-
self.parent:setBG(obx, oby + i + n - 2, getTextHorizontalAlign(tData[3][i], self.width, textHorizontalAlign, tHex[self.bgColor]))
2086+
self.parent:setBG(obx, oby + i + n - 2, getTextHorizontalAlign(tData[3][i], self.width, textHorizontalAlign, tHex[self.bgColor or colors.black]))
20862087
self.parent:setText(obx, oby + i + n - 2, getTextHorizontalAlign(tData[1][i], self.width, textHorizontalAlign))
20872088
end
20882089
end
@@ -3194,7 +3195,7 @@ local function Progressbar(name)
31943195
end;
31953196

31963197
progressDoneHandler = function(self)
3197-
self:sendEvent("progress_done")
3198+
self:sendEvent("progress_done", self)
31983199
end;
31993200

32003201
draw = function(self)
@@ -4290,6 +4291,7 @@ local function Frame(name, parent)
42904291
end
42914292
end
42924293
end
4294+
return self
42934295
end;
42944296

42954297
setOffset = function(self, xO, yO)

basalt.lua

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

source/project/Frame.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ local function Frame(name, parent)
121121
end
122122
end
123123
end
124+
return self
124125
end;
125126

126127
setOffset = function(self, xO, yO)

source/project/Object.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ local function Object(name)
151151

152152
setSize = function(self, width, height)
153153
self.width, self.height = width, height
154+
eventSystem:sendEvent("basalt_resize", self)
154155
visualsChanged = true
155156
return self
156157
end;

source/project/objects/Label.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ local function Label(name)
6060
if(self.bgColor~=false)then
6161
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
6262
self.parent:drawTextBox(obx, oby, self.width, self.height, " ") end
63-
if(self.bgColor~=false)then self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor) end
63+
if(self.fgColor~=false)then self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor) end
6464
if(fontsize==0)then
6565
for n = 1, self.height do
6666
if (n == verticalAlign) then
67-
self.parent:writeText(obx, oby + (n - 1), getTextHorizontalAlign(self:getValue(), self.width, textHorizontalAlign), self.bgColor, self.fgColor)
67+
self.parent:setText(obx, oby + (n - 1), getTextHorizontalAlign(self:getValue(), self.width, textHorizontalAlign))
6868
end
6969
end
7070
else
71-
local tData = makeText(fontsize, self:getValue(), self.fgColor, self.bgColor)
71+
local tData = makeText(fontsize, self:getValue(), self.fgColor, self.bgColor or colors.black)
7272
if(autoSize)then
7373
self.height = #tData[1]-1
7474
self.width = #tData[1][1]
@@ -82,7 +82,7 @@ local function Label(name)
8282

8383
for i = 1, cY do
8484
self.parent:setFG(obx, oby + i + n - 2, getTextHorizontalAlign(tData[2][i], self.width, textHorizontalAlign))
85-
self.parent:setBG(obx, oby + i + n - 2, getTextHorizontalAlign(tData[3][i], self.width, textHorizontalAlign, tHex[self.bgColor]))
85+
self.parent:setBG(obx, oby + i + n - 2, getTextHorizontalAlign(tData[3][i], self.width, textHorizontalAlign, tHex[self.bgColor or colors.black]))
8686
self.parent:setText(obx, oby + i + n - 2, getTextHorizontalAlign(tData[1][i], self.width, textHorizontalAlign))
8787
end
8888
end

source/project/objects/Progressbar.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ local function Progressbar(name)
6262
end;
6363

6464
progressDoneHandler = function(self)
65-
self:sendEvent("progress_done")
65+
self:sendEvent("progress_done", self)
6666
end;
6767

6868
draw = function(self)

0 commit comments

Comments
 (0)