Merge pull request #693 from adamharrison/fix-scrollbar-split

Added in check to make sure you can use a scrollbar on a split.
This commit is contained in:
Adam 2021-11-27 11:44:22 -05:00 committed by GitHub
commit 4767ffe58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -877,11 +877,11 @@ end
function RootView:on_mouse_pressed(button, x, y, clicks) function RootView:on_mouse_pressed(button, x, y, clicks)
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 local node = self.root_node:get_child_overlapping_point(x, y)
if div and (node and not node.active_view:scrollbar_overlaps_point(x, y)) then
self.dragged_divider = div self.dragged_divider = div
return true return true
end end
local node = self.root_node:get_child_overlapping_point(x, y)
if node.hovered_scroll_button > 0 then if node.hovered_scroll_button > 0 then
node:scroll_tabs(node.hovered_scroll_button) node:scroll_tabs(node.hovered_scroll_button)
return true return true
@ -1028,7 +1028,7 @@ function RootView:on_mouse_moved(x, y, dx, dy)
local tab_index = self.overlapping_node and self.overlapping_node:get_tab_overlapping_point(x, y) local tab_index = self.overlapping_node and self.overlapping_node:get_tab_overlapping_point(x, y)
if self.overlapping_node and self.overlapping_node:get_scroll_button_index(x, y) then if self.overlapping_node and self.overlapping_node:get_scroll_button_index(x, y) then
core.request_cursor("arrow") core.request_cursor("arrow")
elseif div then elseif div and (self.overlapping_node and not self.overlapping_node.active_view:scrollbar_overlaps_point(x, y)) then
core.request_cursor(div.type == "hsplit" and "sizeh" or "sizev") core.request_cursor(div.type == "hsplit" and "sizeh" or "sizev")
elseif tab_index then elseif tab_index then
core.request_cursor("arrow") core.request_cursor("arrow")
@ -1123,10 +1123,10 @@ function RootView:update_drag_overlay()
if split_type == "tab" and (over ~= self.dragged_node.node or #over.views > 1) then if split_type == "tab" and (over ~= self.dragged_node.node or #over.views > 1) then
local tab_index, tab_x, tab_y, tab_w, tab_h = over:get_drag_overlay_tab_position(self.mouse.x, self.mouse.y) local tab_index, tab_x, tab_y, tab_w, tab_h = over:get_drag_overlay_tab_position(self.mouse.x, self.mouse.y)
self:set_drag_overlay(self.drag_overlay_tab, self:set_drag_overlay(self.drag_overlay_tab,
tab_x + (tab_index and 0 or tab_w), tab_y, tab_x + (tab_index and 0 or tab_w), tab_y,
style.caret_width, tab_h, style.caret_width, tab_h,
-- avoid showing tab overlay moving between nodes -- avoid showing tab overlay moving between nodes
over ~= self.drag_overlay_tab.last_over) over ~= self.drag_overlay_tab.last_over)
self:set_show_overlay(self.drag_overlay, false) self:set_show_overlay(self.drag_overlay, false)
self.drag_overlay_tab.last_over = over self.drag_overlay_tab.last_over = over
else else