Skip to content

Commit

Permalink
feat: remove drawing previous smear to avoid random jumps
Browse files Browse the repository at this point in the history
  • Loading branch information
sphamba committed Dec 26, 2024
1 parent 6763b3f commit 5f885ea
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions lua/smear_cursor/animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ local target_position = { 0, 0 }
local current_corners = {}
local target_corners = {}
local stiffnesses = { 0, 0, 0, 0 }
local previous_ending_drawn = false -- only draw previous smear once

local previous_window_id = -1
local current_window_id = -1
Expand Down Expand Up @@ -169,7 +168,6 @@ local function animate()
end

draw.clear()
previous_ending_drawn = false

if max_distance <= config.distance_stop_animating then
set_corners(current_corners, target_position[1], target_position[2])
Expand Down Expand Up @@ -295,18 +293,6 @@ M.change_target_position = function(row, col)
if target_position[1] == row and target_position[2] == col then return end
draw.clear()

-- Draw end of previous smear
if animating then
if not previous_ending_drawn then
set_stiffnesses(1, 0)
update()
draw.draw_quad(shrink_volume(current_corners), target_position)
vim.cmd.redraw()
previous_ending_drawn = true
end
set_corners(current_corners, target_position[1], target_position[2])
end

target_position = { row, col }
set_corners(target_corners, row, col)
set_stiffnesses(config.stiffness, config.trailing_stiffness)
Expand Down

0 comments on commit 5f885ea

Please sign in to comment.