Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: add padding to menu width calculation #755

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/scripts/uosc/elements/Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function Menu:update_content_dimensions()

for _, menu in ipairs(self.all) do
title_opts.bold, title_opts.italic = true, false
local max_width = text_width(menu.title, title_opts) + 2 * self.item_padding
local max_width = text_width(menu.title, title_opts) + 2 * self.padding + 2 * self.item_padding

-- Estimate width of a widest item
for _, item in ipairs(menu.items) do
Expand All @@ -304,7 +304,7 @@ function Menu:update_content_dimensions()
if estimated_width > max_width then max_width = estimated_width end
end

menu.max_width = max_width
menu.max_width = max_width + 2 * self.padding
end

self:update_dimensions()
Expand Down