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.
This commit is contained in:
christoph-heinrich
2023-11-05 11:37:32 +01:00
committed by GitHub
parent a7ee37c1d7
commit 26d71a8630

View File

@@ -227,8 +227,6 @@ function cursor:move(x, y)
Elements:update_proximities() Elements:update_proximities()
Elements:trigger('global_mouse_leave') Elements:trigger('global_mouse_leave')
else else
Elements:update_proximities()
if self.hidden then if self.hidden then
-- Cancel potential fadeouts -- Cancel potential fadeouts
for _, id in ipairs(config.cursor_leave_fadeout_elements) do for _, id in ipairs(config.cursor_leave_fadeout_elements) do
@@ -236,12 +234,12 @@ function cursor:move(x, y)
end end
self.hidden = false self.hidden = false
self.history:clear()
Elements:trigger('global_mouse_enter') Elements:trigger('global_mouse_enter')
else
-- Update history
self.history:insert({x = self.x, y = self.y, time = mp.get_time()})
end end
Elements:update_proximities()
-- Update history
self.history:insert({x = self.x, y = self.y, time = mp.get_time()})
end end
Elements:proximity_trigger('mouse_move') Elements:proximity_trigger('mouse_move')