add option for initial size

This commit is contained in:
takase1121 2021-12-24 21:32:28 +08:00
parent 4be8a8b582
commit 16df6d8bce
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
1 changed files with 7 additions and 3 deletions

View File

@ -10,7 +10,11 @@ local ContextMenu = require "core.contextmenu"
local RootView = require "core.rootview"
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
@ -39,7 +43,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 }
@ -405,7 +409,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()