center icons to accomodate for size difference

This commit is contained in:
takase1121 2021-12-18 22:42:33 +08:00
parent 31df408d93
commit becdb99222
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
1 changed files with 6 additions and 2 deletions

View File

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