From 8a173305ded2678619676995cd6e8fa01e2c1329 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 7 Feb 2021 13:14:30 +0500 Subject: [PATCH] Better on end touch events --- druid/base/drag.lua | 6 ++++-- druid/base/scroll.lua | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/druid/base/drag.lua b/druid/base/drag.lua index 2eef901..7625c29 100644 --- a/druid/base/drag.lua +++ b/druid/base/drag.lua @@ -71,8 +71,10 @@ local function end_touch(self) end self.is_drag = false - self.is_touch = false - self.on_touch_end:trigger(self:get_context()) + if self.is_touch then + self.is_touch = false + self.on_touch_end:trigger(self:get_context()) + end self:reset_input_priority() self.touch_id = 0 end diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 8f5cac9..a01b904 100644 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -569,11 +569,11 @@ end function Scroll._check_threshold(self) local is_stopped = false - if self.inertion.x ~= 0 and math.abs(self.inertion.x) < self.style.INERT_THRESHOLD then + if math.abs(self.inertion.x) < self.style.INERT_THRESHOLD then is_stopped = true self.inertion.x = 0 end - if self.inertion.y ~= 0 and math.abs(self.inertion.y) < self.style.INERT_THRESHOLD then + if math.abs(self.inertion.y) < self.style.INERT_THRESHOLD then is_stopped = true self.inertion.y = 0 end