Skip to content

Commit

Permalink
fix: add padding to menu width calculation (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-heinrich authored Oct 30, 2023
1 parent 55789e1 commit 28878e4
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 28878e4

Please # to comment.