Merge pull request #770 from takase1121/treeview-initial-size
add option for treeview initial size
This commit is contained in:
commit
5a63f6dc2e
|
@ -14,7 +14,11 @@ config.plugins.treeview = common.merge({
|
||||||
clicks_to_open = 2
|
clicks_to_open = 2
|
||||||
}, config.plugins.treeview)
|
}, config.plugins.treeview)
|
||||||
|
|
||||||
local default_treeview_size = 200 * SCALE
|
config.plugins.treeview = common.merge({
|
||||||
|
size = 200 * SCALE
|
||||||
|
}, config.plugins.treeview)
|
||||||
|
|
||||||
|
|
||||||
local tooltip_offset = style.font:get_height()
|
local tooltip_offset = style.font:get_height()
|
||||||
local tooltip_border = 1
|
local tooltip_border = 1
|
||||||
local tooltip_delay = 0.5
|
local tooltip_delay = 0.5
|
||||||
|
@ -43,7 +47,7 @@ function TreeView:new()
|
||||||
self.scrollable = true
|
self.scrollable = true
|
||||||
self.visible = true
|
self.visible = true
|
||||||
self.init_size = true
|
self.init_size = true
|
||||||
self.target_size = default_treeview_size
|
self.target_size = config.plugins.treeview.size
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
self.tooltip = { x = 0, y = 0, begin = 0, alpha = 0 }
|
self.tooltip = { x = 0, y = 0, begin = 0, alpha = 0 }
|
||||||
self.cursor_pos = { x = 0, y = 0 }
|
self.cursor_pos = { x = 0, y = 0 }
|
||||||
|
@ -462,7 +466,7 @@ if config.plugins.toolbarview ~= false and toolbar_plugin then
|
||||||
toolbar_view = ToolbarView()
|
toolbar_view = ToolbarView()
|
||||||
treeview_node:split("down", toolbar_view, {y = true})
|
treeview_node:split("down", toolbar_view, {y = true})
|
||||||
local min_toolbar_width = toolbar_view:get_min_width()
|
local min_toolbar_width = toolbar_view:get_min_width()
|
||||||
view:set_target_size("x", math.max(default_treeview_size, min_toolbar_width))
|
view:set_target_size("x", math.max(config.plugins.treeview.size, min_toolbar_width))
|
||||||
command.add(nil, {
|
command.add(nil, {
|
||||||
["toolbar:toggle"] = function()
|
["toolbar:toggle"] = function()
|
||||||
toolbar_view:toggle_visible()
|
toolbar_view:toggle_visible()
|
||||||
|
|
Loading…
Reference in New Issue