Fix resize behavior of treeview and toolbar
Now toolbarview always compute up-to-date sizes and spacing to adapt to changes in icon big font. For treeview and toolbarview revert the goto_size approach to use the original approach of rxi/lite. In order to make it work when user resizes dragging the divider we use the view optional method set_target_size(). This latter changes the view's target size instead of changing its size right away. The size is only changed by the lite's layout and animation system. Remove the config.treeview_size variable that was no longer working because plugins are loaded before the user's config.
This commit is contained in:
@@ -96,7 +96,8 @@ local type_map = { up="vsplit", down="vsplit", left="hsplit", right="hsplit" }
|
||||
-- and it indicates if the node want to have a fixed size along the axis where the
|
||||
-- boolean is true. If not it will be expanded to take all the available space.
|
||||
-- The "resizable" flag indicates if, along the "locked" axis the node can be resized
|
||||
-- by the user.
|
||||
-- by the user. If the node is marked as resizable their view should provide a
|
||||
-- set_target_size method.
|
||||
function Node:split(dir, view, locked, resizable)
|
||||
assert(self.type == "leaf", "Tried to split non-leaf node")
|
||||
local node_type = assert(type_map[dir], "Invalid direction")
|
||||
@@ -461,9 +462,8 @@ function Node:resize(axis, value)
|
||||
-- resize operation here because for proportional panes the resize is
|
||||
-- done using the "divider" value of the parent node.
|
||||
if (self.locked and self.locked[axis]) and self.resizable then
|
||||
local view = self.active_view
|
||||
view.size[axis] = value
|
||||
return true
|
||||
assert(self.active_view.set_target_size, "internal error: the view of a resizable \"locked\" node do not provide a set_target_size method")
|
||||
return self.active_view:set_target_size(axis, value)
|
||||
end
|
||||
else
|
||||
local a_resizable = self.a:is_resizable(axis)
|
||||
|
||||
Reference in New Issue
Block a user