aboutsummaryrefslogtreecommitdiff
path: root/src/pen-gestures
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-06-08 22:26:42 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-06-08 22:26:42 -0400
commit23d91c839bc7dd14fd906aa1b3c7b3cd16980dd4 (patch)
treec5f181d92e5edad3c12f4500128bc5420eb6616d /src/pen-gestures
parent01cc676b568c9d53757e1e4c8155672ecea95562 (diff)
parentc878c35dc06c6f0c653390d95d18feeaf2dfabd1 (diff)
Merge branch 'master' into RichTextEdition
Diffstat (limited to 'src/pen-gestures')
-rw-r--r--src/pen-gestures/GestureUtils.ts15
-rw-r--r--src/pen-gestures/ndollar.ts17
2 files changed, 22 insertions, 10 deletions
diff --git a/src/pen-gestures/GestureUtils.ts b/src/pen-gestures/GestureUtils.ts
index 3b6170f68..20e14a68d 100644
--- a/src/pen-gestures/GestureUtils.ts
+++ b/src/pen-gestures/GestureUtils.ts
@@ -1,12 +1,6 @@
-import { NDollarRecognizer } from "./ndollar";
-import { Type } from "typescript";
-import { InkField, PointData } from "../fields/InkField";
-import { Docs } from "../client/documents/Documents";
-import { Doc, WidthSym, HeightSym } from "../fields/Doc";
-import { NumCast } from "../fields/Types";
-import { CollectionFreeFormView } from "../client/views/collections/collectionFreeForm/CollectionFreeFormView";
import { Rect } from "react-measure";
-import { Scripting } from "../client/util/Scripting";
+import { PointData } from "../fields/InkField";
+import { NDollarRecognizer } from "./ndollar";
export namespace GestureUtils {
export class GestureEvent {
@@ -39,7 +33,10 @@ export namespace GestureUtils {
EndBracket = "endbracket",
Stroke = "stroke",
Scribble = "scribble",
- Text = "text"
+ Text = "text",
+ Triangle = "triangle",
+ Circle = "circle",
+ Rectangle = "rectangle",
}
export const GestureRecognizer = new NDollarRecognizer(false);
diff --git a/src/pen-gestures/ndollar.ts b/src/pen-gestures/ndollar.ts
index e5740d105..9d42035d1 100644
--- a/src/pen-gestures/ndollar.ts
+++ b/src/pen-gestures/ndollar.ts
@@ -142,7 +142,7 @@ export class Result {
//
// NDollarRecognizer constants
//
-const NumMultistrokes = 4;
+const NumMultistrokes = 7;
const NumPoints = 96;
const SquareSize = 250.0;
const OneDThreshold = 0.25; // customize to desired gesture set (usually 0.20 - 0.35)
@@ -190,6 +190,21 @@ export class NDollarRecognizer {
// 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))
));
+ this.Multistrokes[4] = new Multistroke(GestureUtils.Gestures.Triangle, useBoundedRotationInvariance, new Array(
+ new Array(new Point(40, 100), new Point(100, 200), new Point(140, 102), new Point(42, 100))
+ ));
+ this.Multistrokes[5] = new Multistroke(GestureUtils.Gestures.Circle, useBoundedRotationInvariance, new Array(
+ new Array(new Point(200, 250), new Point(240, 230), new Point(248, 210), new Point(248, 190), new Point(240, 170), new Point(200, 150), new Point(160, 170), new Point(151, 190), new Point(151, 210), new Point(160, 230), new Point(201, 250))
+ ));
+ this.Multistrokes[6] = new Multistroke(GestureUtils.Gestures.Rectangle, useBoundedRotationInvariance, new Array(
+ new Array(
+ new Point(30, 146), //new Point(29, 160), new Point(30, 180), new Point(31, 200),
+ new Point(30, 222), //new Point(50, 219), new Point(70, 225), new Point(90, 230),
+ new Point(106, 225), //new Point(100, 200), new Point(106, 180), new Point(110, 160),
+ new Point(106, 146), //new Point(80, 150), new Point(50, 146),
+ new Point(30, 143),
+ new Point(29, 220))
+ ));
//
// PREDEFINED STROKES