From a0740b0377452b5c0654f1b6fca6d40ec9855d38 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Mon, 6 May 2024 23:08:05 +0700 Subject: [PATCH] feat: cancel touch when detecting three fingers --- Memola/Canvas/View/Bridge/Views/DrawingView.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Memola/Canvas/View/Bridge/Views/DrawingView.swift b/Memola/Canvas/View/Bridge/Views/DrawingView.swift index 20c263d..e2312a9 100644 --- a/Memola/Canvas/View/Bridge/Views/DrawingView.swift +++ b/Memola/Canvas/View/Bridge/Views/DrawingView.swift @@ -41,6 +41,10 @@ class DrawingView: UIView { override func touchesBegan(_ touches: Set, with event: UIEvent?) { super.touchesBegan(touches, with: event) + if let count = event?.allTouches?.count, count > 1 { + touchCancelled() + return + } guard let touch = touches.first else { return } let point = touch.location(in: self) touchBegan(at: point) @@ -48,6 +52,10 @@ class DrawingView: UIView { override func touchesMoved(_ touches: Set, with event: UIEvent?) { super.touchesMoved(touches, with: event) + if let count = event?.allTouches?.count, count > 1 { + touchCancelled() + return + } guard let touch = touches.first else { return } let point = touch.location(in: self) touchMoved(to: point)