aboutsummaryrefslogtreecommitdiff
path: root/src/pen-gestures
diff options
context:
space:
mode:
authorLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-06-11 00:22:43 -0700
committerLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-06-11 00:22:43 -0700
commit7e3dbc157548f75e7b42367be00d32aea6469516 (patch)
tree508fe51cf873f8d10a0c71fe8dd7d9247d58592f /src/pen-gestures
parentb13adb6e2620d80c019c7c8f6d344ba5ca2fcec2 (diff)
parentb14c559285d579a90bd8f7282a85283201f2f65c (diff)
merged with master
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