add clipping to drawing log items

This commit is contained in:
takase1121 2021-12-18 20:11:24 +08:00
parent b5dff196f6
commit fd3b4334ce
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
1 changed files with 4 additions and 5 deletions

View File

@ -130,11 +130,8 @@ function LogView:draw()
local th = style.font:get_height()
local lh = th + style.padding.y -- for one line
for _, item, x, y, w in self:each_item() do
x = x + style.padding.x
local time = os.date(nil, item.time)
x = common.draw_text(style.font, style.dim, time, "left", x, y, w, lh)
for _, item, x, y, w, h in self:each_item() do
core.push_clip_rect(x, y, w, h)
x = x + style.padding.x
x = common.draw_text(
@ -164,6 +161,8 @@ function LogView:draw()
end
_, y = common.draw_text(style.font, style.text, line, "left", x, y, w, lh)
end
core.pop_clip_rect()
end
end