From 3d879286a401e1fc123e8a5c20e7c87b87bc00e1 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Tue, 1 Mar 2022 22:41:54 +0100 Subject: [PATCH] Use epsilon to compare values in `move_towards` --- data/core/view.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/core/view.lua b/data/core/view.lua index f2c88dc2..a3664a55 100644 --- a/data/core/view.lua +++ b/data/core/view.lua @@ -25,7 +25,8 @@ function View:move_towards(t, k, dest, rate) return self:move_towards(self, t, k, dest, rate) end local val = t[k] - if not config.transitions or math.abs(val - dest) < 0.5 then + local diff = math.abs(val - dest) + if not config.transitions or diff < 0.5 then t[k] = dest else rate = rate or 0.5 @@ -35,7 +36,7 @@ function View:move_towards(t, k, dest, rate) end t[k] = common.lerp(val, dest, rate) end - if val ~= dest then + if diff > 1e-8 then core.redraw = true end end