| 18 | const activeTouches = new Map(); |
| 19 | |
| 20 | export function addTouch(touch) { |
| 21 | const identifier = touch.identifier; |
| 22 | const target = touch.target; |
| 23 | if (!activeTouches.has(target)) { |
| 24 | activeTouches.set(target, new Map()); |
| 25 | } |
| 26 | if (activeTouches.get(target).get(identifier)) { |
| 27 | // Do not allow existing touches to be overwritten |
| 28 | console.error( |
| 29 | 'Touch with identifier %s already exists. Did not record touch start.', |
| 30 | identifier, |
| 31 | ); |
| 32 | } else { |
| 33 | activeTouches.get(target).set(identifier, touch); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | export function updateTouch(touch) { |
| 38 | const identifier = touch.identifier; |