aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/Touchable.tsx
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2020-01-13 17:33:40 -0500
committerFawn <fangrui_tong@brown.edu>2020-01-13 17:33:40 -0500
commita53d5600be4cf6cd8c55813ac1958cf754508ee4 (patch)
treecac159c287ec3f4508e78b5e7afa3e295735406e /src/client/views/Touchable.tsx
parenta23fb4733c250b2be0124ad456af7da71f4fca00 (diff)
parent75d5b58ef99a80ca2b2823a7836b96a2b574f9f5 (diff)
Merge branch 'pen' of https://github.com/browngraphicslab/Dash-Web into remote
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) => {