aboutsummaryrefslogtreecommitdiff
path: root/src/pen-gestures
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-03-05 22:20:52 -0500
committerBob Zeleznik <zzzman@gmail.com>2020-03-05 22:20:52 -0500
commitb667ac18c58cd022219bec091e59977107b5bd7d (patch)
treebf79b3ad5fa5c3ebd89383b1c7cc50e846697900 /src/pen-gestures
parent45643918180f32f070f8d9f770c446b70c08548d (diff)
parent288e4d24b61d281819b7f0b5bb697edbcc9ed173 (diff)
Merge branch 'master' into audio_refactor
Diffstat (limited to 'src/pen-gestures')
-rw-r--r--src/pen-gestures/GestureUtils.ts13
-rw-r--r--src/pen-gestures/ndollar.ts11
2 files changed, 17 insertions, 7 deletions
diff --git a/src/pen-gestures/GestureUtils.ts b/src/pen-gestures/GestureUtils.ts
index 4b5ad6684..f14c573c3 100644
--- a/src/pen-gestures/GestureUtils.ts
+++ b/src/pen-gestures/GestureUtils.ts
@@ -6,18 +6,16 @@ import { Doc, WidthSym, HeightSym } from "../new_fields/Doc";
import { NumCast } from "../new_fields/Types";
import { CollectionFreeFormView } from "../client/views/collections/collectionFreeForm/CollectionFreeFormView";
import { Rect } from "react-measure";
+import { Scripting } from "../client/util/Scripting";
export namespace GestureUtils {
- namespace GestureDataTypes {
- export type BoxData = Array<Doc>;
- }
-
export class GestureEvent {
constructor(
readonly gesture: Gestures,
readonly points: PointData[],
readonly bounds: Rect,
- readonly callbackFn?: Function
+ readonly callbackFn?: Function,
+ readonly text?: any
) { }
}
@@ -37,8 +35,11 @@ export namespace GestureUtils {
export enum Gestures {
Box = "box",
Line = "line",
+ StartBracket = "startbracket",
+ EndBracket = "endbracket",
Stroke = "stroke",
- Scribble = "scribble"
+ Scribble = "scribble",
+ Text = "text"
}
export const GestureRecognizer = new NDollarRecognizer(false);
diff --git a/src/pen-gestures/ndollar.ts b/src/pen-gestures/ndollar.ts
index 9e15ada2d..bb92f62e1 100644
--- a/src/pen-gestures/ndollar.ts
+++ b/src/pen-gestures/ndollar.ts
@@ -142,7 +142,7 @@ export class Result {
//
// NDollarRecognizer constants
//
-const NumMultistrokes = 2;
+const NumMultistrokes = 4;
const NumPoints = 96;
const SquareSize = 250.0;
const OneDThreshold = 0.25; // customize to desired gesture set (usually 0.20 - 0.35)
@@ -178,6 +178,15 @@ export class NDollarRecognizer {
this.Multistrokes[1] = new Multistroke(GestureUtils.Gestures.Line, useBoundedRotationInvariance, new Array(
new Array(new Point(12, 347), new Point(119, 347))
));
+ this.Multistrokes[2] = new Multistroke(GestureUtils.Gestures.StartBracket, useBoundedRotationInvariance, new Array(
+ // new Array(new Point(145, 20), new Point(30, 21), new Point(34, 150))
+ new Array(new Point(31, 25), new Point(145, 20), new Point(31, 25), new Point(34, 150))
+ ));
+ this.Multistrokes[3] = new Multistroke(GestureUtils.Gestures.EndBracket, useBoundedRotationInvariance, new Array(
+ // new Array(new Point(150, 21), new Point(149, 150), new Point(26, 152))
+ // new Array(new Point(150, 150), new Point(150, 0), new Point(150, 150), new Point(0, 150))
+ new Array(new Point(10, 100), new Point(100, 100), new Point(150, 12), new Point(200, 103), new Point(300, 100))
+ ));
//
// PREDEFINED STROKES