Avoid drawing hidden `TreeView` items
This commit is contained in:
parent
4a05dd1683
commit
b918f248cb
|
@ -366,16 +366,19 @@ end
|
||||||
|
|
||||||
function TreeView:draw()
|
function TreeView:draw()
|
||||||
self:draw_background(style.background2)
|
self:draw_background(style.background2)
|
||||||
|
local _y, _h = self.position.y, self.size.y
|
||||||
|
|
||||||
local doc = core.active_view.doc
|
local doc = core.active_view.doc
|
||||||
local active_filename = doc and system.absolute_path(doc.filename or "")
|
local active_filename = doc and system.absolute_path(doc.filename or "")
|
||||||
|
|
||||||
for item, x,y,w,h in self:each_item() do
|
for item, x,y,w,h in self:each_item() do
|
||||||
|
if y + h >= _y and y < _y + _h then
|
||||||
self:draw_item(item,
|
self:draw_item(item,
|
||||||
item.abs_filename == active_filename,
|
item.abs_filename == active_filename,
|
||||||
item == self.hovered_item,
|
item == self.hovered_item,
|
||||||
x, y, w, h)
|
x, y, w, h)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:draw_scrollbar()
|
self:draw_scrollbar()
|
||||||
if self.hovered_item and self.tooltip.alpha > 0 then
|
if self.hovered_item and self.tooltip.alpha > 0 then
|
||||||
|
|
Loading…
Reference in New Issue