From a2acc6d7702691106062ae05d996b68d6f9d66a4 Mon Sep 17 00:00:00 2001 From: Eric Gaudet Date: Mon, 6 Feb 2023 20:40:04 +0100 Subject: [PATCH] Make mouse scrollwheel hovering tabs scroll the tab bar (#1314) --- data/core/rootview.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 7230e8e1..7ff54a45 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -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