Show resize cursor only when panes are resizable

This commit is contained in:
Francesco Abbate 2021-02-11 17:15:27 +01:00
parent f482ea318a
commit 9f0abd1a8b
1 changed files with 11 additions and 3 deletions

View File

@ -421,6 +421,16 @@ function Node:close_all_docviews()
end end
function Node:is_resizable()
if self.type == 'leaf' then
return not self.locked or self.resizable
else
local a_resizable = self.a:is_resizable()
local b_resizable = self.b:is_resizable()
return a_resizable and b_resizable
end
end
local RootView = View:extend() local RootView = View:extend()
@ -549,9 +559,7 @@ function RootView:on_mouse_moved(x, y, dx, dy)
local node = self.root_node:get_child_overlapping_point(x, y) local node = self.root_node:get_child_overlapping_point(x, y)
local div = self.root_node:get_divider_overlapping_point(x, y) local div = self.root_node:get_divider_overlapping_point(x, y)
if div then if div then
local a_is_fixed = div.a.locked and not div.a.resizable if div.a:is_resizable() and div.b:is_resizable() then
local b_is_fixed = div.b.locked and not div.b.resizable
if not a_is_fixed and not b_is_fixed then
system.set_cursor(div.type == "hsplit" and "sizeh" or "sizev") system.set_cursor(div.type == "hsplit" and "sizeh" or "sizev")
end end
elseif node:get_tab_overlapping_point(x, y) then elseif node:get_tab_overlapping_point(x, y) then