mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-04-25 10:08:34 +02:00
feat: cancel touch when detecting three fingers
This commit is contained in:
@@ -41,6 +41,10 @@ class DrawingView: UIView {
|
|||||||
|
|
||||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
super.touchesBegan(touches, with: event)
|
super.touchesBegan(touches, with: event)
|
||||||
|
if let count = event?.allTouches?.count, count > 1 {
|
||||||
|
touchCancelled()
|
||||||
|
return
|
||||||
|
}
|
||||||
guard let touch = touches.first else { return }
|
guard let touch = touches.first else { return }
|
||||||
let point = touch.location(in: self)
|
let point = touch.location(in: self)
|
||||||
touchBegan(at: point)
|
touchBegan(at: point)
|
||||||
@@ -48,6 +52,10 @@ class DrawingView: UIView {
|
|||||||
|
|
||||||
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
super.touchesMoved(touches, with: event)
|
super.touchesMoved(touches, with: event)
|
||||||
|
if let count = event?.allTouches?.count, count > 1 {
|
||||||
|
touchCancelled()
|
||||||
|
return
|
||||||
|
}
|
||||||
guard let touch = touches.first else { return }
|
guard let touch = touches.first else { return }
|
||||||
let point = touch.location(in: self)
|
let point = touch.location(in: self)
|
||||||
touchMoved(to: point)
|
touchMoved(to: point)
|
||||||
|
|||||||
Reference in New Issue
Block a user