From 699655bebfed23a1ab18d1382084a6374885f439 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sun, 20 Mar 2022 04:45:14 +0100 Subject: [PATCH 1/2] Don't specify delta movement when simulating `TreeView:on_mouse_moved` --- data/plugins/treeview.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 39c67907..bb7255b4 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -299,7 +299,7 @@ function TreeView:update() -- we don't want events when the thing is scrolling fast local dy = math.abs(self.scroll.to.y - self.scroll.y) if self.scroll.to.y ~= 0 and dy < self:get_item_height() then - self:on_mouse_moved(self.cursor_pos.x, self.cursor_pos.y, 0, self.scroll.to.y - self.scroll.y) + self:on_mouse_moved(self.cursor_pos.x, self.cursor_pos.y, 0, 0) end TreeView.super.update(self) From 46f9be2960eabf9df23a76900bdeafd238fcb50e Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sun, 20 Mar 2022 04:46:57 +0100 Subject: [PATCH 2/2] Hide hovered `TreeView` item when dragging the scrollbar --- data/plugins/treeview.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index bb7255b4..2f208e95 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -209,10 +209,13 @@ end function TreeView:on_mouse_moved(px, py, ...) if not self.visible then return end TreeView.super.on_mouse_moved(self, px, py, ...) - if self.dragging_scrollbar then return end - self.cursor_pos.x = px self.cursor_pos.y = py + if self.dragging_scrollbar then + self.hovered_item = nil + return + end + local item_changed, tooltip_changed for item, x,y,w,h in self:each_item() do if px > x and py > y and px <= x + w and py <= y + h then