Fix treeview missing clamp bug

Github issue: https://github.com/franko/lite-xl/issues/44
This commit is contained in:
Francesco Abbate 2021-02-20 20:13:25 +01:00
parent 4f2e38d41f
commit 054350263d
1 changed files with 2 additions and 0 deletions

View File

@ -584,8 +584,10 @@ function RootView:on_mouse_moved(x, y, dx, dy)
if self.dragged_divider then if self.dragged_divider then
local node = self.dragged_divider local node = self.dragged_divider
if node.type == "hsplit" then if node.type == "hsplit" then
x = common.clamp(x, 0, self.root_node.size.x * 0.95)
resize_child_node(node, "x", x, dx) resize_child_node(node, "x", x, dx)
elseif node.type == "vsplit" then elseif node.type == "vsplit" then
y = common.clamp(x, 0, self.root_node.size.y * 0.95)
resize_child_node(node, "y", y, dy) resize_child_node(node, "y", y, dy)
end end
node.divider = common.clamp(node.divider, 0.01, 0.99) node.divider = common.clamp(node.divider, 0.01, 0.99)