diff options
author | andrewdkim <adkim414@gmail.com> | 2020-01-21 14:11:27 -0500 |
---|---|---|
committer | andrewdkim <adkim414@gmail.com> | 2020-01-21 14:11:27 -0500 |
commit | 0a5728e57c658188a9cbc881fbceeafed5d99fa7 (patch) | |
tree | 658cb9839a368ec55e7f536a38933e210af086cb | |
parent | 5a4d3d1c938fe6d258effc2db0b9f5e3b30ec6b5 (diff) |
ignore strokes
-rw-r--r-- | package-lock.json | 13 | ||||
-rw-r--r-- | src/client/views/GestureOverlay.tsx | 22 |
2 files changed, 31 insertions, 4 deletions
diff --git a/package-lock.json b/package-lock.json index da0027d07..d5945d554 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15567,6 +15567,15 @@ "readable-stream": "^2.0.2" } }, + "stream-combiner": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", + "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", + "requires": { + "duplexer": "~0.1.1", + "through": "~2.3.4" + } + }, "stream-each": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", @@ -15639,7 +15648,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "requires": { "safe-buffer": "~5.1.0" @@ -18236,4 +18245,4 @@ } } } -}
\ No newline at end of file +} diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx index 84d089b47..9a17e9eee 100644 --- a/src/client/views/GestureOverlay.tsx +++ b/src/client/views/GestureOverlay.tsx @@ -358,13 +358,30 @@ export default class GestureOverlay extends Touchable { const B = this.svgBounds; const points = this._points.map(p => ({ X: p.X - B.left, Y: p.Y - B.top })); - const xInGlass = points[0].X > (this._thumbX ?? Number.MAX_SAFE_INTEGER) && points[0].X < (this._thumbX ?? Number.MAX_SAFE_INTEGER) + this.height; - const yInGlass = points[0].Y > (this._thumbY ?? Number.MAX_SAFE_INTEGER) - this.height && points[0].Y < (this._thumbY ?? Number.MAX_SAFE_INTEGER); + 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; + const yInGlass = initialPoint.Y > (this._thumbY ?? Number.MAX_SAFE_INTEGER) - this.height && initialPoint.Y < (this._thumbY ?? Number.MAX_SAFE_INTEGER); if (this.Tool !== ToolglassTools.None && xInGlass && yInGlass) { switch (this.Tool) { case ToolglassTools.InkToText: break; + case ToolglassTools.IgnoreGesture: + const target = document.elementFromPoint(this._points[0].X, this._points[0].Y); + target?.dispatchEvent( + new CustomEvent<GestureUtils.GestureEvent>("dashOnGesture", + { + bubbles: true, + detail: { + points: this._points, + gesture: GestureUtils.Gestures.Stroke, + bounds: B + } + } + ) + ); + this._points = []; + break; } } else { @@ -514,6 +531,7 @@ export default class GestureOverlay extends Touchable { export enum ToolglassTools { InkToText = "inktotext", + IgnoreGesture = "ignoregesture", None = "none", } |