()
| 138 | if (!Touch) throw new Error("No touch driver configured"); |
| 139 | |
| 140 | const onSample = () => { |
| 141 | const points = touch.sample(); |
| 142 | if (!points) return; |
| 143 | |
| 144 | const last = touch.points[0]; |
| 145 | |
| 146 | if (points.length === 0) { |
| 147 | if (last) { |
| 148 | last.target?.onTouchEnded(last.x, last.y); |
| 149 | touch.points[0] = undefined; |
| 150 | } |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | const { x, y } = points[0]; |
| 155 | |
| 156 | if (last) { |
| 157 | last.x = x; |
| 158 | last.y = y; |
| 159 | last.target?.onTouchMoved(x, y); |
| 160 | return; |
| 161 | } |
| 162 | |
| 163 | const entry = { x, y }; |
| 164 | touch.points[0] = entry; |
| 165 | entry.target = dragger.contains(x, y) ? dragger : null; |
| 166 | entry.target?.onTouchBegan(x, y); |
| 167 | }; |
| 168 | |
| 169 | const touch = new Touch({ onSample }) |
| 170 |
nothing calls this directly
no test coverage detected