From 28878e425a5035ba28300f56e072c8893cfa70d4 Mon Sep 17 00:00:00 2001 From: christoph-heinrich Date: Mon, 30 Oct 2023 18:12:46 +0100 Subject: [PATCH] fix: add padding to menu width calculation (#755) --- dist/scripts/uosc/elements/Menu.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/scripts/uosc/elements/Menu.lua b/dist/scripts/uosc/elements/Menu.lua index 5ceb1148..42b734c9 100644 --- a/dist/scripts/uosc/elements/Menu.lua +++ b/dist/scripts/uosc/elements/Menu.lua @@ -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 @@ -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()