feat: add a way to pack listbox at their end

This commit is contained in:
Kazhnuz 2022-01-05 18:31:54 +01:00
parent ce1b1044e8
commit ac63e377f9

View file

@ -37,6 +37,7 @@ function ListBox:new(name, x, y, w, h, slotNumber)
self.h = slotNumber * self.widgetSize.h -- On fait en sorte que la hauteur
-- soit un multiple du nombre de slot et de leur hauteur
self.lateralFunc = nil
self.packAtEnd = false
end
-- UPDATE FUNCTIONS
@ -91,6 +92,7 @@ end
-- draw the menu and the rest of content.
function ListBox:getListPart(relativeNumber)
if (self.packAtEnd) then relativeNumber = relativeNumber + math.max(0, self.view.slotNumber - self.widget:lenght()) end
return 0, (relativeNumber) * self.widgetSize.h, self.w, self.widgetSize.h
end