Merge pull request #770 from takase1121/treeview-initial-size

add option for treeview initial size
This commit is contained in:
Jefferson González 2022-03-18 04:18:56 -04:00 committed by GitHub
commit 5a63f6dc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -14,7 +14,11 @@ config.plugins.treeview = common.merge({
clicks_to_open = 2
}, 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_border = 1
local tooltip_delay = 0.5
@ -43,7 +47,7 @@ function TreeView:new()
self.scrollable = true
self.visible = true
self.init_size = true
self.target_size = default_treeview_size
self.target_size = config.plugins.treeview.size
self.cache = {}
self.tooltip = { x = 0, y = 0, begin = 0, alpha = 0 }
self.cursor_pos = { x = 0, y = 0 }
@ -462,7 +466,7 @@ if config.plugins.toolbarview ~= false and toolbar_plugin then
toolbar_view = ToolbarView()
treeview_node:split("down", toolbar_view, {y = true})
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, {
["toolbar:toggle"] = function()
toolbar_view:toggle_visible()