diff options
Diffstat (limited to 'src/client/views/Touchable.tsx')
| -rw-r--r-- | src/client/views/Touchable.tsx | 21 |
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) => { |
