aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/GestureOverlay.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/GestureOverlay.tsx')
-rw-r--r--src/client/views/GestureOverlay.tsx14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index 110b61efe..f0205133c 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -193,7 +193,7 @@ export default class GestureOverlay extends Touchable {
}, (500));
}
else {
- clearTimeout(this._holdTimer);
+ this._holdTimer && clearTimeout(this._holdTimer);
}
document.removeEventListener("touchmove", this.onReactTouchMove);
document.removeEventListener("touchend", this.onReactTouchEnd);
@@ -270,7 +270,7 @@ export default class GestureOverlay extends Touchable {
onReactTouchMove = (e: TouchEvent) => {
const nts: any = this.getNewTouches(e);
- clearTimeout(this._holdTimer);
+ this._holdTimer && clearTimeout(this._holdTimer);
this._holdTimer = undefined;
document.dispatchEvent(
@@ -290,7 +290,7 @@ export default class GestureOverlay extends Touchable {
onReactTouchEnd = (e: TouchEvent) => {
const nts: any = this.getNewTouches(e);
- clearTimeout(this._holdTimer);
+ this._holdTimer && clearTimeout(this._holdTimer);
this._holdTimer = undefined;
document.dispatchEvent(
@@ -323,7 +323,7 @@ export default class GestureOverlay extends Touchable {
}
handleHandDown = async (e: React.TouchEvent) => {
- clearTimeout(this._holdTimer!);
+ this._holdTimer && clearTimeout(this._holdTimer);
const fingers = new Array<React.Touch>();
for (let i = 0; i < e.touches.length; i++) {
const pt: any = e.touches.item(i);
@@ -623,7 +623,7 @@ export default class GestureOverlay extends Touchable {
actionPerformed = true;
break;
case GestureUtils.Gestures.EndBracket:
- this.dispatchGesture(GestureUtils.Gestures.EndBracket);
+ this.dispatchGesture("endbracket");
actionPerformed = true;
break;
case GestureUtils.Gestures.Line:
@@ -648,7 +648,7 @@ export default class GestureOverlay extends Touchable {
document.removeEventListener("pointerup", this.onPointerUp);
}
- dispatchGesture = (gesture: GestureUtils.Gestures, stroke?: InkData, data?: any) => {
+ dispatchGesture = (gesture: "box" | "line" | "startbracket" | "endbracket" | "stroke" | "scribble" | "text", stroke?: InkData, data?: any) => {
const target = document.elementFromPoint((stroke ?? this._points)[0].X, (stroke ?? this._points)[0].Y);
target?.dispatchEvent(
new CustomEvent<GestureUtils.GestureEvent>("dashOnGesture",
@@ -656,7 +656,7 @@ export default class GestureOverlay extends Touchable {
bubbles: true,
detail: {
points: stroke ?? this._points,
- gesture: gesture,
+ gesture: gesture as any,
bounds: this.getBounds(stroke ?? this._points),
text: data
}