diff options
author | yipstanley <stanley_yip@brown.edu> | 2019-12-03 17:34:58 -0500 |
---|---|---|
committer | yipstanley <stanley_yip@brown.edu> | 2019-12-03 17:34:58 -0500 |
commit | 2781f77d46612720865ac0c1d115d6e013806103 (patch) | |
tree | e340c45a13eed609368db56a44d8600ade4e7053 /src/client/util/InteractionUtils.ts | |
parent | 494deb74c82443ef828cad4de57d0236ea72a0fa (diff) |
improved multi-user touch stuff
Diffstat (limited to 'src/client/util/InteractionUtils.ts')
-rw-r--r-- | src/client/util/InteractionUtils.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/util/InteractionUtils.ts b/src/client/util/InteractionUtils.ts index b7738e862..c24c70bca 100644 --- a/src/client/util/InteractionUtils.ts +++ b/src/client/util/InteractionUtils.ts @@ -8,6 +8,17 @@ export namespace InteractionUtils { const REACT_POINTER_PEN_BUTTON = 0; const ERASER_BUTTON = 5; + export function GetMyTargetTouches(e: TouchEvent, prevPoints: Map<number, React.Touch>): React.Touch[] { + let myTouches = new Array<React.Touch>(); + for (let i = 0; i < e.targetTouches.length; i++) { + let pt = e.targetTouches.item(i); + if (pt && prevPoints.has(pt.identifier)) { + myTouches.push(pt); + } + } + return myTouches; + } + export function IsType(e: PointerEvent | React.PointerEvent, type: string): boolean { switch (type) { // pen and eraser are both pointer type 'pen', but pen is button 0 and eraser is button 5. -syip2 |