feat: cancel touch when detecting three fingers

This commit is contained in:
dscyrescotti
2024-05-06 23:08:05 +07:00
parent 0202678d8d
commit a0740b0377

View File

@@ -41,6 +41,10 @@ class DrawingView: UIView {
override func touchesBegan(_ touches: Set<UITouch>, 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<UITouch>, 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)