dynamic maxDropdown to make dropdowns take up at most 0.75x of your screen

This commit is contained in:
jill 2021-09-19 23:55:54 +03:00
parent bc0bf26289
commit 700e01cc1d
1 changed files with 2 additions and 0 deletions

View File

@ -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)