From 700e01cc1d69e1a73f783d040faa14198434ea45 Mon Sep 17 00:00:00 2001 From: jill Date: Sun, 19 Sep 2021 23:55:54 +0300 Subject: [PATCH] dynamic maxDropdown to make dropdowns take up at most 0.75x of your screen --- src/dropdown.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dropdown.lua b/src/dropdown.lua index edf8296..1845416 100644 --- a/src/dropdown.lua +++ b/src/dropdown.lua @@ -200,6 +200,8 @@ function self.createDropdowns() end function self.update(dt) + maxDropdown = math.floor(math.min(16 * (margin + fontHeight), love.graphics.getHeight() * 0.75) / (margin + fontHeight)) + if self.openDropdown ~= 0 then dropdownScroll = math.max(dropdownScroll, -(#self.get(self.openDropdown).options - maxDropdown + 1)) dropdownScroll = math.min(dropdownScroll, 0)