`LogView`: Don't draw invisible items
This commit is contained in:
parent
79dd8779c4
commit
caf106be1d
|
@ -154,44 +154,46 @@ function LogView:draw()
|
||||||
|
|
||||||
local tw = style.font:get_width(datestr)
|
local tw = style.font:get_width(datestr)
|
||||||
for _, item, x, y, w, h in self:each_item() do
|
for _, item, x, y, w, h in self:each_item() do
|
||||||
core.push_clip_rect(x, y, w, h)
|
if y + h >= self.position.y and y <= self.position.y + self.size.y then
|
||||||
x = x + style.padding.x
|
core.push_clip_rect(x, y, w, h)
|
||||||
|
x = x + style.padding.x
|
||||||
|
|
||||||
x = common.draw_text(
|
x = common.draw_text(
|
||||||
style.icon_font,
|
style.icon_font,
|
||||||
style.log[item.level].color,
|
style.log[item.level].color,
|
||||||
style.log[item.level].icon,
|
style.log[item.level].icon,
|
||||||
"center",
|
"center",
|
||||||
x, y, iw, lh
|
x, y, iw, lh
|
||||||
)
|
)
|
||||||
x = x + style.padding.x
|
x = x + style.padding.x
|
||||||
|
|
||||||
-- timestamps are always 15% of the width
|
-- timestamps are always 15% of the width
|
||||||
local time = os.date(nil, item.time)
|
local time = os.date(nil, item.time)
|
||||||
common.draw_text(style.font, style.dim, time, "left", x, y, tw, lh)
|
common.draw_text(style.font, style.dim, time, "left", x, y, tw, lh)
|
||||||
x = x + tw + style.padding.x
|
x = x + tw + style.padding.x
|
||||||
|
|
||||||
w = w - (x - self:get_content_offset())
|
w = w - (x - self:get_content_offset())
|
||||||
|
|
||||||
if is_expanded(item) then
|
if is_expanded(item) then
|
||||||
y = y + common.round(style.padding.y / 2)
|
y = y + common.round(style.padding.y / 2)
|
||||||
_, y = draw_text_multiline(style.font, item.text, x, y, style.text)
|
_, y = draw_text_multiline(style.font, item.text, x, y, style.text)
|
||||||
|
|
||||||
local at = "at " .. common.home_encode(item.at)
|
local at = "at " .. common.home_encode(item.at)
|
||||||
_, y = common.draw_text(style.font, style.dim, at, "left", x, y, w, lh)
|
_, y = common.draw_text(style.font, style.dim, at, "left", x, y, w, lh)
|
||||||
|
|
||||||
if item.info then
|
if item.info then
|
||||||
_, y = draw_text_multiline(style.font, item.info, x, y, style.dim)
|
_, y = draw_text_multiline(style.font, item.info, x, y, style.dim)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local line, has_newline = string.match(item.text, "([^\n]+)(\n?)")
|
||||||
|
if has_newline ~= "" then
|
||||||
|
line = line .. " ..."
|
||||||
|
end
|
||||||
|
_, y = common.draw_text(style.font, style.text, line, "left", x, y, w, lh)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
local line, has_newline = string.match(item.text, "([^\n]+)(\n?)")
|
core.pop_clip_rect()
|
||||||
if has_newline ~= "" then
|
|
||||||
line = line .. " ..."
|
|
||||||
end
|
|
||||||
_, y = common.draw_text(style.font, style.text, line, "left", x, y, w, lh)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
core.pop_clip_rect()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue