aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/Touchable.tsx
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-01-09 19:55:52 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-01-09 19:55:52 -0500
commit36eed6cc3a3387a1f7755a848aea4e19e2645e14 (patch)
treeb5872defd3807ef96402b4f073f23114b40a77e5 /src/client/views/Touchable.tsx
parent0e7d688da6fde96908bee6f0b62b02aae2b95872 (diff)
some stuff that ive played around with today. mobile interface, five fingers, other stuff
Diffstat (limited to 'src/client/views/Touchable.tsx')
-rw-r--r--src/client/views/Touchable.tsx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client/views/Touchable.tsx b/src/client/views/Touchable.tsx
index 251cd41e5..3eb66ff72 100644
--- a/src/client/views/Touchable.tsx
+++ b/src/client/views/Touchable.tsx
@@ -1,6 +1,7 @@
import * as React from 'react';
import { action } from 'mobx';
import { InteractionUtils } from '../util/InteractionUtils';
+import { SelectionManager } from '../util/SelectionManager';
const HOLD_DURATION = 1000;
@@ -34,11 +35,19 @@ export abstract class Touchable<T = {}> extends React.Component<T> {
case 1:
this.handle1PointerDown(e);
e.persist();
+ if (this.holdTimer) {
+ clearTimeout(this.holdTimer)
+ this.holdTimer = undefined;
+ }
this.holdTimer = setTimeout(() => this.handle1PointerHoldStart(e), HOLD_DURATION);
+ console.log(this.holdTimer);
break;
case 2:
this.handle2PointersDown(e);
break;
+ case 5:
+ this.handleHandDown(e);
+ break;
}
}
}
@@ -54,7 +63,9 @@ export abstract class Touchable<T = {}> extends React.Component<T> {
if (!InteractionUtils.IsDragging(this.prevPoints, myTouches, 5) && !this._touchDrag) return;
this._touchDrag = true;
if (this.holdTimer) {
+ console.log("clear");
clearTimeout(this.holdTimer);
+ this.holdTimer = undefined;
}
switch (myTouches.length) {
case 1:
@@ -88,7 +99,9 @@ export abstract class Touchable<T = {}> extends React.Component<T> {
}
}
if (this.holdTimer) {
+ console.log("clear");
clearTimeout(this.holdTimer);
+ this.holdTimer = undefined;
}
this._touchDrag = false;
e.stopPropagation();
@@ -137,4 +150,9 @@ export abstract class Touchable<T = {}> extends React.Component<T> {
e.stopPropagation();
e.preventDefault();
}
+
+ handleHandDown = (e: React.TouchEvent) => {
+ e.stopPropagation();
+ e.preventDefault();
+ }
} \ No newline at end of file