aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/InteractionUtils.ts
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-01-15 13:30:08 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-01-15 13:30:08 -0500
commit19be14b5807b117f477b57b9ecc7b96247bf4fef (patch)
treede87c664ab1181426f6dbebb4c4a92b1e3e045b9 /src/client/util/InteractionUtils.ts
parentde0c00ff0bb1f58a0736da24acc984f5a090d009 (diff)
the quick brown fox jumped over the lazy dog
Diffstat (limited to 'src/client/util/InteractionUtils.ts')
-rw-r--r--src/client/util/InteractionUtils.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/util/InteractionUtils.ts b/src/client/util/InteractionUtils.ts
index 63ee2fb92..da42bdc93 100644
--- a/src/client/util/InteractionUtils.ts
+++ b/src/client/util/InteractionUtils.ts
@@ -11,7 +11,10 @@ export namespace InteractionUtils {
export class MultiTouchEvent<T extends React.TouchEvent | TouchEvent> {
constructor(
readonly fingers: number,
- readonly points: T extends React.TouchEvent ? React.TouchList : TouchList,
+ // readonly points: T extends React.TouchEvent ? React.TouchList : TouchList,
+ readonly targetTouches: T extends React.TouchEvent ? React.Touch[] : Touch[],
+ readonly touches: T extends React.TouchEvent ? React.Touch[] : Touch[],
+ readonly changedTouches: T extends React.TouchEvent ? React.Touch[] : Touch[],
readonly touchEvent: T extends React.TouchEvent ? React.TouchEvent : TouchEvent
) { }
}
@@ -43,13 +46,11 @@ export namespace InteractionUtils {
};
}
- export function GetMyTargetTouches(e: TouchEvent | React.TouchEvent, prevPoints: Map<number, React.Touch>, ignorePen: boolean): React.Touch[] {
+ export function GetMyTargetTouches(mte: InteractionUtils.MultiTouchEvent<React.TouchEvent | TouchEvent>, prevPoints: Map<number, React.Touch>, ignorePen: boolean): React.Touch[] {
const myTouches = new Array<React.Touch>();
- for (let i = 0; i < e.touches.length; i++) {
- const pt: any = e.touches.item(i);
+ for (const pt of mte.touches) {
if (ignorePen || (pt.radiusX > 1 && pt.radiusY > 1)) {
- for (let j = 0; j < e.targetTouches.length; j++) {
- const tPt = e.targetTouches.item(j);
+ for (const tPt of mte.targetTouches) {
if (tPt?.screenX === pt?.screenX && tPt?.screenY === pt?.screenY) {
if (pt && prevPoints.has(pt.identifier)) {
myTouches.push(pt);