aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/GestureOverlay.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-07-11 19:52:33 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-07-11 19:52:33 -0400
commit97456cca47bfe37d8c0b78770d0db88b75289d56 (patch)
tree1d4cf06649538c1283b8875e2e317ef5c36c0df3 /src/client/views/GestureOverlay.tsx
parent6b5c11a26e114f26f3907342f9afbd47b27cecf4 (diff)
parentbf8c338e662327b39cdef3f90c436447e48d2807 (diff)
merged with master & cleaned up formatShapePane
Diffstat (limited to 'src/client/views/GestureOverlay.tsx')
-rw-r--r--src/client/views/GestureOverlay.tsx23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index 26a06090b..fc8530811 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -5,7 +5,6 @@ import { Doc } from "../../fields/Doc";
import { InkData, InkTool } from "../../fields/InkField";
import { Cast, FieldValue, NumCast } from "../../fields/Types";
import MobileInkOverlay from "../../mobile/MobileInkOverlay";
-import MobileInterface from "../../mobile/MobileInterface";
import { GestureUtils } from "../../pen-gestures/GestureUtils";
import { MobileInkOverlayContent } from "../../server/Message";
import { emptyFunction, emptyPath, returnEmptyString, returnFalse, returnOne, returnTrue, returnZero, returnEmptyFilter } from "../../Utils";
@@ -113,7 +112,7 @@ export default class GestureOverlay extends Touchable {
onReactTouchStart = (te: React.TouchEvent) => {
document.removeEventListener("touchmove", this.onReactHoldTouchMove);
document.removeEventListener("touchend", this.onReactHoldTouchEnd);
- if (RadialMenu.Instance._display === true) {
+ if (RadialMenu.Instance?._display === true) {
te.preventDefault();
te.stopPropagation();
RadialMenu.Instance.closeMenu();
@@ -163,8 +162,8 @@ export default class GestureOverlay extends Touchable {
// -- radial menu code --
this._holdTimer = setTimeout(() => {
console.log("hold");
- const target = document.elementFromPoint(te.changedTouches.item(0).clientX, te.changedTouches.item(0).clientY);
- const pt: any = te.touches[te.touches.length - 1];
+ const target = document.elementFromPoint(te.changedTouches?.item(0).clientX, te.changedTouches?.item(0).clientY);
+ const pt: any = te.touches[te.touches?.length - 1];
if (nts.nt.length === 1 && pt.radiusX > 1 && pt.radiusY > 1) {
target?.dispatchEvent(
new CustomEvent<InteractionUtils.MultiTouchEvent<React.TouchEvent>>("dashOnTouchHoldStart",
@@ -553,7 +552,7 @@ export default class GestureOverlay extends Touchable {
else if (this._d1 !== doc && !LinkManager.Instance.doesLinkExist(this._d1, doc)) {
// we don't want to create a link between ink strokes (doing so makes drawing a t very hard)
if (this._d1.type !== "ink" && doc.type !== "ink") {
- DocUtils.MakeLink({ doc: this._d1 }, { doc: doc }, "gestural link");
+ DocUtils.MakeLink({ doc: this._d1 }, { doc: doc }, "gestural link", "");
actionPerformed = true;
}
}
@@ -581,14 +580,6 @@ export default class GestureOverlay extends Touchable {
const points = this._points.map(p => ({ X: p.X - B.left, Y: p.Y - B.top }));
//push first points to so interactionUtil knows pointer is up
this._points.push({ X: this._points[0].X, Y: this._points[0].Y });
- if (MobileInterface.Instance && MobileInterface.Instance.drawingInk) {
- DocServer.Mobile.dispatchGesturePoints({
- points: this._points,
- bounds: B,
- color: ActiveInkColor(),
- width: ActiveInkWidth()
- });
- }
const initialPoint = this._points[0.];
const xInGlass = initialPoint.X > (this._thumbX ?? Number.MAX_SAFE_INTEGER) && initialPoint.X < (this._thumbX ?? Number.MAX_SAFE_INTEGER) + (this.height);
@@ -734,7 +725,7 @@ export default class GestureOverlay extends Touchable {
this._points = [];
switch (shape) {
//must push an extra point in the end so InteractionUtils knows pointer is up.
- //must be (points[0].X,points[0]-1)
+ //must be (points[0].X,points[0]-1)
case "rectangle":
this._points.push({ X: left, Y: top });
this._points.push({ X: right, Y: top });
@@ -923,7 +914,7 @@ export default class GestureOverlay extends Touchable {
}
}
-// export class
+// export class
export enum ToolglassTools {
InkToText = "inktotext",
@@ -960,4 +951,4 @@ Scripting.addGlobal(function resetPen() {
}, "resets the pen tool");
Scripting.addGlobal(function createText(text: any, x: any, y: any) {
GestureOverlay.Instance.dispatchGesture("text", [{ X: x, Y: y }], text);
-}, "creates a text document with inputted text and coordinates", "(text: any, x: any, y: any)"); \ No newline at end of file
+}, "creates a text document with inputted text and coordinates", "(text: any, x: any, y: any)");