Make mouse scrollwheel hovering tabs scroll the tab bar (#1314)

This commit is contained in:
Eric Gaudet 2023-02-06 20:40:04 +01:00 committed by GitHub
parent 841a456106
commit a2acc6d770
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -323,10 +323,19 @@ function RootView:on_file_dropped(filename, x, y)
end
function RootView:on_mouse_wheel(...)
function RootView:on_mouse_wheel(dy, dx)
local x, y = self.mouse.x, self.mouse.y
local node = self.root_node:get_child_overlapping_point(x, y)
return node.active_view:on_mouse_wheel(...)
local idx = node:get_tab_overlapping_point(x, y)
if idx then
local delta = dx == 0.0 and dy or dx
local button = delta > 0 and 2 or 1
node:scroll_tabs(button)
return true
end
return node.active_view:on_mouse_wheel(dy, dx)
end