fix: make widget item colorable

This commit is contained in:
Kazhnuz 2020-08-01 09:29:13 +02:00
parent 227b2bbf1e
commit a3cf5bef63
2 changed files with 1 additions and 2 deletions

View file

@ -126,10 +126,10 @@ function ListBox:draw()
local widgety = self.y local widgety = self.y
for i,v in ipairs(self.widget.list) do for i,v in ipairs(self.widget.list) do
if (i >= self.view.firstSlot) and (i < self.view.firstSlot + self.view.slotNumber) then if (i >= self.view.firstSlot) and (i < self.view.firstSlot + self.view.slotNumber) then
v:draw(self.x, widgety, self.w, self.widget.h)
if self.widget.selected == i and self:haveFocus() == true then if self.widget.selected == i and self:haveFocus() == true then
v:drawSelected(self.x, widgety, self.w, self.widget.h) v:drawSelected(self.x, widgety, self.w, self.widget.h)
else else
utils.graphics.resetColor()
v:draw(self.x, widgety, self.w, self.widget.h) v:draw(self.x, widgety, self.w, self.widget.h)
end end
widgety = widgety + self.widget.h widgety = widgety + self.widget.h

View file

@ -91,7 +91,6 @@ end
function BaseWidget:draw(x, y) function BaseWidget:draw(x, y)
if self.canvas.texture ~= nil then if self.canvas.texture ~= nil then
utils.graphics.resetColor()
love.graphics.draw(self.canvas.texture, x, y) love.graphics.draw(self.canvas.texture, x, y)
end end
end end