about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-25 15:23:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-25 15:23:01 -0700
commitfe8e4fd9da3d7070dc445c562516cda2511ce94d (patch)
tree8718e30783e631982918f42463765b2028fba879 /main.lua
parent3265abacb42056742803d7e2a42a2757ce7984c0 (diff)
downloadlines.love-fe8e4fd9da3d7070dc445c562516cda2511ce94d.tar.gz
simplify hysteresis logic
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua11
1 files changed, 3 insertions, 8 deletions
diff --git a/main.lua b/main.lua
index 85bfb35..91cb08f 100644
--- a/main.lua
+++ b/main.lua
@@ -17,8 +17,7 @@ function App.initialize_globals()
   -- tests currently mostly clear their own state
 
   -- resize
-  Last_resize_time = nil
-
+  Last_resize_time = App.getTime()
   -- blinking cursor
   Cursor_time = 0
 end
@@ -141,12 +140,8 @@ end
 function App.update(dt)
   Cursor_time = Cursor_time + dt
   -- some hysteresis while resizing
-  if Last_resize_time then
-    if App.getTime() - Last_resize_time < 0.1 then
-      return
-    else
-      Last_resize_time = nil
-    end
+  if App.getTime() < Last_resize_time + 0.1 then
+    return
   end
   edit.update(Editor_state, dt)
 end