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...@@ -177,6 +177,7 @@ final class CanvasView: UIScrollView, UIScrollViewDelegate, UITextInput, UITextI
177 addGestureRecognizer(recognizer)177 addGestureRecognizer(recognizer)
178 }178 }
179 // The Pencil draws; fingers, a trackpad and a mouse scroll and select.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 let hands = [UITouch.TouchType.direct, .indirectPointer].map { NSNumber(value: $0.rawValue) }181 let hands = [UITouch.TouchType.direct, .indirectPointer].map { NSNumber(value: $0.rawValue) }
181 let recognizers: [UIGestureRecognizer?] = [tap, doubleTap, grip, panGestureRecognizer, pinchGestureRecognizer]182 let recognizers: [UIGestureRecognizer?] = [tap, doubleTap, grip, panGestureRecognizer, pinchGestureRecognizer]
182 for recognizer in recognizers {183 for recognizer in recognizers {
apps/ios/Snowbound/Ink.swift+5
...@@ -68,6 +68,7 @@ final class InkGesture: UIGestureRecognizer {...@@ -68,6 +68,7 @@ final class InkGesture: UIGestureRecognizer {
68 }68 }
6969
70 override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {70 override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
71 super.touchesBegan(touches, with: event)
71 for touch in touches {72 for touch in touches {
72 if tracked == nil {73 if tracked == nil {
73 tracked = touch74 tracked = touch
...@@ -82,22 +83,26 @@ final class InkGesture: UIGestureRecognizer {...@@ -82,22 +83,26 @@ final class InkGesture: UIGestureRecognizer {
82 }83 }
8384
84 override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {85 override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {
86 super.touchesMoved(touches, with: event)
85 guard let tracked, touches.contains(tracked) else { return }87 guard let tracked, touches.contains(tracked) else { return }
86 points += (event.coalescedTouches(for: tracked) ?? [tracked]).map(sample)88 points += (event.coalescedTouches(for: tracked) ?? [tracked]).map(sample)
87 state = .changed89 state = .changed
88 }90 }
8991
90 override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) {92 override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) {
93 super.touchesEnded(touches, with: event)
91 guard let tracked, touches.contains(tracked) else { return }94 guard let tracked, touches.contains(tracked) else { return }
92 points.append(sample(tracked))95 points.append(sample(tracked))
93 state = .ended96 state = .ended
94 }97 }
9598
96 override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent) {99 override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent) {
100 super.touchesCancelled(touches, with: event)
97 state = .cancelled101 state = .cancelled
98 }102 }
99103
100 override func reset() {104 override func reset() {
105 super.reset()
101 tracked = nil106 tracked = nil
102 points = []107 points = []
103 }108 }