From 26d71a863015a3af45a41d17bb2f8678b8cde0d0 Mon Sep 17 00:00:00 2001 From: christoph-heinrich Date: Sun, 5 Nov 2023 11:37:32 +0100 Subject: [PATCH] fix: correctly update proximities on mouse enter and record position (#772) Element:update_proximity() checks for cursor.hidden, which is why we have to update that before updating the proximities. Also it doesn't make sense to not record the first cursor position on enter. --- src/uosc/lib/cursor.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/uosc/lib/cursor.lua b/src/uosc/lib/cursor.lua index d576c63b..b255de98 100644 --- a/src/uosc/lib/cursor.lua +++ b/src/uosc/lib/cursor.lua @@ -227,8 +227,6 @@ function cursor:move(x, y) Elements:update_proximities() Elements:trigger('global_mouse_leave') else - Elements:update_proximities() - if self.hidden then -- Cancel potential fadeouts for _, id in ipairs(config.cursor_leave_fadeout_elements) do @@ -236,12 +234,12 @@ function cursor:move(x, y) end self.hidden = false - self.history:clear() Elements:trigger('global_mouse_enter') - else - -- Update history - self.history:insert({x = self.x, y = self.y, time = mp.get_time()}) end + + Elements:update_proximities() + -- Update history + self.history:insert({x = self.x, y = self.y, time = mp.get_time()}) end Elements:proximity_trigger('mouse_move')