Skip to content

Commit

Permalink
fix: correctly update proximities on mouse enter and record position (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
christoph-heinrich authored Nov 5, 2023
1 parent a7ee37c commit 26d71a8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/uosc/lib/cursor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,19 @@ 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
if Elements[id] then Elements[id]:tween_stop() end
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')
Expand Down

0 comments on commit 26d71a8

Please # to comment.