authorclover caruso <git@paperclover.net> 2026-10-12 13:01:38-07:00
committerclover caruso <git@paperclover.net> 2026-10-15 01:52:38-07:00
log38158ef4e891882c34beeffc1c046747004b4983
treed07a21a556271dc1095be7111a808f49ce0175e4
parenta46bcc611e2e0f0799e9271027594e97e0df9e92
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU (~clover)

fix(ios): honor the ink recognizer lifecycle

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-sol

2 files changed, 6 insertions(+), 0 deletions(-)

apps/ios/Snowbound/CanvasView.swift+1
......@@ -177,6 +177,7 @@ final class CanvasView: UIScrollView, UIScrollViewDelegate, UITextInput, UITextI
177177 addGestureRecognizer(recognizer)
178178 }
179179 // The Pencil draws; fingers, a trackpad and a mouse scroll and select.
180 ink.allowedTouchTypes = [UITouch.TouchType.pencil, .direct].map { NSNumber(value: $0.rawValue) }
180181 let hands = [UITouch.TouchType.direct, .indirectPointer].map { NSNumber(value: $0.rawValue) }
181182 let recognizers: [UIGestureRecognizer?] = [tap, doubleTap, grip, panGestureRecognizer, pinchGestureRecognizer]
182183 for recognizer in recognizers {
apps/ios/Snowbound/Ink.swift+5
......@@ -68,6 +68,7 @@ final class InkGesture: UIGestureRecognizer {
6868 }
6969
7070 override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
71 super.touchesBegan(touches, with: event)
7172 for touch in touches {
7273 if tracked == nil {
7374 tracked = touch
......@@ -82,22 +83,26 @@ final class InkGesture: UIGestureRecognizer {
8283 }
8384
8485 override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {
86 super.touchesMoved(touches, with: event)
8587 guard let tracked, touches.contains(tracked) else { return }
8688 points += (event.coalescedTouches(for: tracked) ?? [tracked]).map(sample)
8789 state = .changed
8890 }
8991
9092 override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) {
93 super.touchesEnded(touches, with: event)
9194 guard let tracked, touches.contains(tracked) else { return }
9295 points.append(sample(tracked))
9396 state = .ended
9497 }
9598
9699 override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent) {
100 super.touchesCancelled(touches, with: event)
97101 state = .cancelled
98102 }
99103
100104 override func reset() {
105 super.reset()
101106 tracked = nil
102107 points = []
103108 }