aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/Touchable.tsx
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-01-13 17:31:15 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-01-13 17:31:15 -0500
commit75d5b58ef99a80ca2b2823a7836b96a2b574f9f5 (patch)
treed9a060a38800f3336a5df4f0c27eb85e0bb63494 /src/client/views/Touchable.tsx
parentd86b4db095379d473820271868e8f7cd5830d502 (diff)
parent4daad3765bd3c5693b9aff2ce53ca8b81804d000 (diff)
radial menu stuff added, too unstable to use currently
Diffstat (limited to 'src/client/views/Touchable.tsx')
-rw-r--r--src/client/views/Touchable.tsx21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/client/views/Touchable.tsx b/src/client/views/Touchable.tsx
index 24ea801a0..2a7599fbf 100644
--- a/src/client/views/Touchable.tsx
+++ b/src/client/views/Touchable.tsx
@@ -2,11 +2,13 @@ import * as React from 'react';
import { action } from 'mobx';
import { InteractionUtils } from '../util/InteractionUtils';
import { SelectionManager } from '../util/SelectionManager';
+import { RadialMenu } from './nodes/RadialMenu';
const HOLD_DURATION = 1000;
export abstract class Touchable<T = {}> extends React.Component<T> {
- private holdTimer: NodeJS.Timeout | undefined;
+ //private holdTimer: NodeJS.Timeout | undefined;
+ holdTimer: NodeJS.Timeout | undefined;
protected _touchDrag: boolean = false;
protected prevPoints: Map<number, React.Touch> = new Map<number, React.Touch>();
@@ -46,12 +48,12 @@ 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;
- }
+ // if (this.holdTimer) {
+ // clearTimeout(this.holdTimer)
+ // this.holdTimer = undefined;
+ // }
this.holdTimer = setTimeout(() => this.handle1PointerHoldStart(e), HOLD_DURATION);
- console.log(this.holdTimer);
+ // console.log(this.holdTimer);
break;
case 2:
this.handle2PointersDown(e);
@@ -74,8 +76,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;
+ // this.holdTimer = undefined;
}
switch (myTouches.length) {
case 1:
@@ -110,7 +113,7 @@ export abstract class Touchable<T = {}> extends React.Component<T> {
}
if (this.holdTimer) {
clearTimeout(this.holdTimer);
- this.holdTimer = undefined;
+ console.log("clear");
}
this._touchDrag = false;
e.stopPropagation();
@@ -155,9 +158,9 @@ export abstract class Touchable<T = {}> extends React.Component<T> {
}
handle1PointerHoldStart = (e: React.TouchEvent): any => {
- console.log("Hold");
e.stopPropagation();
e.preventDefault();
+ document.removeEventListener("touchmove", this.onTouch);
}
handleHandDown = (e: React.TouchEvent) => {