From 2ae0f5e4b9b48a4d600e993c15b40b1c159c2d30 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 1 May 2024 23:40:17 +0800 Subject: [PATCH] Fix: [ALAS] insert_swipe() may return a length=1 list after deleting nearing points (cherry picked from commit 75333193ea561bd1f4241364c8660f6526bb5431) --- module/device/method/minitouch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/device/method/minitouch.py b/module/device/method/minitouch.py index 30fdcc88c..356976c21 100644 --- a/module/device/method/minitouch.py +++ b/module/device/method/minitouch.py @@ -86,6 +86,8 @@ def insert_swipe(p0, p3, speed=15, min_distance=10): distance = np.linalg.norm(np.subtract(points[1:], points[0]), axis=1) mask = np.append(True, distance > min_distance) points = np.array(points)[mask].tolist() + if len(points) <= 1: + points = [p0, p3] else: points = [p0, p3]