From becdb99222192a71db2b9c63569f2a635420fbfd Mon Sep 17 00:00:00 2001 From: takase1121 <20792268+takase1121@users.noreply.github.com> Date: Sat, 18 Dec 2021 22:42:33 +0800 Subject: [PATCH] center icons to accomodate for size difference --- data/core/logview.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/core/logview.lua b/data/core/logview.lua index 90ce564f..6485c2f6 100644 --- a/data/core/logview.lua +++ b/data/core/logview.lua @@ -130,6 +130,10 @@ function LogView:draw() local th = style.font:get_height() local lh = th + style.padding.y -- for one line + local iw = math.max( + style.icon_font:get_width(style.log.ERROR.icon), + style.icon_font:get_width(style.log.INFO.icon) + ) for _, item, x, y, w, h in self:each_item() do core.push_clip_rect(x, y, w, h) x = x + style.padding.x @@ -138,8 +142,8 @@ function LogView:draw() style.icon_font, style.log[item.level].color, style.log[item.level].icon, - "left", - x, y, w, lh + "center", + x, y, iw, lh ) x = x + style.padding.x