Changed TreeView to first initialize its size in :update()
This commit is contained in:
parent
5acc391288
commit
7cdf7dc44f
|
@ -24,6 +24,7 @@ function TreeView:new()
|
||||||
self.scrollable = true
|
self.scrollable = true
|
||||||
self.focusable = false
|
self.focusable = false
|
||||||
self.visible = true
|
self.visible = true
|
||||||
|
self.init_size = true
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -126,7 +127,12 @@ end
|
||||||
function TreeView:update()
|
function TreeView:update()
|
||||||
-- update width
|
-- update width
|
||||||
local dest = self.visible and config.treeview_size or 0
|
local dest = self.visible and config.treeview_size or 0
|
||||||
|
if self.init_size then
|
||||||
|
self.size.x = dest
|
||||||
|
self.init_size = false
|
||||||
|
else
|
||||||
self:move_towards(self.size, "x", dest)
|
self:move_towards(self.size, "x", dest)
|
||||||
|
end
|
||||||
|
|
||||||
TreeView.super.update(self)
|
TreeView.super.update(self)
|
||||||
end
|
end
|
||||||
|
@ -182,7 +188,6 @@ end
|
||||||
-- init
|
-- init
|
||||||
local view = TreeView()
|
local view = TreeView()
|
||||||
local node = core.root_view:get_active_node()
|
local node = core.root_view:get_active_node()
|
||||||
view.size.x = config.treeview_size
|
|
||||||
node:split("left", view, true)
|
node:split("left", view, true)
|
||||||
|
|
||||||
-- register commands and keymap
|
-- register commands and keymap
|
||||||
|
|
Loading…
Reference in a new issue