From ac63e377f91b4b655a0147693a81480c16ca254a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Wed, 5 Jan 2022 18:31:54 +0100 Subject: [PATCH] feat: add a way to pack listbox at their end --- sonic-radiance.love/birb/modules/gui/menus/listbox.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sonic-radiance.love/birb/modules/gui/menus/listbox.lua b/sonic-radiance.love/birb/modules/gui/menus/listbox.lua index b11c39b..41abf2a 100644 --- a/sonic-radiance.love/birb/modules/gui/menus/listbox.lua +++ b/sonic-radiance.love/birb/modules/gui/menus/listbox.lua @@ -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