| author | |
| committer | |
| log | 38158ef4e891882c34beeffc1c046747004b4983 |
| tree | d07a21a556271dc1095be7111a808f49ce0175e4 |
| parent | a46bcc611e2e0f0799e9271027594e97e0df9e92 |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU (~clover) |
Forward every overridden touch callback and reset to UIKit before local filtering
or state changes, and explicitly admit Pencil and direct touches. Keep the
existing delegate preference checks and exclusive-touch policy.
Refs #76
Assisted-by: gpt-6.1-sol2 files changed, 6 insertions(+), 0 deletions(-)
apps/ios/Snowbound/CanvasView.swift+1| ... | ... | @@ -177,6 +177,7 @@ final class CanvasView: UIScrollView, UIScrollViewDelegate, UITextInput, UITextI |
| 177 | 177 | addGestureRecognizer(recognizer) |
| 178 | 178 | } |
| 179 | 179 | // The Pencil draws; fingers, a trackpad and a mouse scroll and select. |
| 180 | ink.allowedTouchTypes = [UITouch.TouchType.pencil, .direct].map { NSNumber(value: $0.rawValue) } | |
| 180 | 181 | let hands = [UITouch.TouchType.direct, .indirectPointer].map { NSNumber(value: $0.rawValue) } |
| 181 | 182 | let recognizers: [UIGestureRecognizer?] = [tap, doubleTap, grip, panGestureRecognizer, pinchGestureRecognizer] |
| 182 | 183 | for recognizer in recognizers { |
apps/ios/Snowbound/Ink.swift+5| ... | ... | @@ -68,6 +68,7 @@ final class InkGesture: UIGestureRecognizer { |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) { |
| 71 | super.touchesBegan(touches, with: event) | |
| 71 | 72 | for touch in touches { |
| 72 | 73 | if tracked == nil { |
| 73 | 74 | tracked = touch |
| ... | ... | @@ -82,22 +83,26 @@ final class InkGesture: UIGestureRecognizer { |
| 82 | 83 | } |
| 83 | 84 | |
| 84 | 85 | override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) { |
| 86 | super.touchesMoved(touches, with: event) | |
| 85 | 87 | guard let tracked, touches.contains(tracked) else { return } |
| 86 | 88 | points += (event.coalescedTouches(for: tracked) ?? [tracked]).map(sample) |
| 87 | 89 | state = .changed |
| 88 | 90 | } |
| 89 | 91 | |
| 90 | 92 | override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) { |
| 93 | super.touchesEnded(touches, with: event) | |
| 91 | 94 | guard let tracked, touches.contains(tracked) else { return } |
| 92 | 95 | points.append(sample(tracked)) |
| 93 | 96 | state = .ended |
| 94 | 97 | } |
| 95 | 98 | |
| 96 | 99 | override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent) { |
| 100 | super.touchesCancelled(touches, with: event) | |
| 97 | 101 | state = .cancelled |
| 98 | 102 | } |
| 99 | 103 | |
| 100 | 104 | override func reset() { |
| 105 | super.reset() | |
| 101 | 106 | tracked = nil |
| 102 | 107 | points = [] |
| 103 | 108 | } |