aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-13 17:12:16 -0400
committerGitHub <noreply@github.com>2020-08-13 17:12:16 -0400
commit3debb7fedcd9c955ede46e57d4da182a5fa9acae (patch)
tree5ec7fa7d096adbedccb30a9120c7e5c4de754211 /src
parentf9936e0f0d8fb670bd887bfd568a8ef12bdbc28d (diff)
parentd30ab1eb48857b4be439b844d3b02c3884921eac (diff)
Merge pull request #603 from browngraphicslab/ink_edits
verticals and horizontals
Diffstat (limited to 'src')
-rw-r--r--src/client/views/GestureOverlay.tsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index 81bb542dd..76e786257 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -678,8 +678,8 @@ export default class GestureOverlay extends Touchable {
var top = Math.min(...ys);
const firstx = this._points[0].X;
const firsty = this._points[0].Y;
- const lastx = this._points[this._points.length - 2].X;
- const lasty = this._points[this._points.length - 2].Y;
+ var lastx = this._points[this._points.length - 2].X;
+ var lasty = this._points[this._points.length - 2].Y;
var fourth = (lastx - firstx) / 4;
if (isNaN(fourth) || fourth === 0) { fourth = 0.01; }
var m = (lasty - firsty) / (lastx - firstx);
@@ -771,11 +771,17 @@ export default class GestureOverlay extends Touchable {
break;
case "line":
+ if (Math.abs(firstx - lastx) < 20) {
+ lastx = firstx;
+ }
+ if (Math.abs(firsty - lasty) < 20) {
+ lasty = firsty;
+ }
this._points.push({ X: firstx, Y: firsty });
this._points.push({ X: firstx, Y: firsty });
- this._points.push({ X: firstx + 4 * fourth, Y: m * (firstx + 4 * fourth) + b });
- this._points.push({ X: firstx + 4 * fourth, Y: m * (firstx + 4 * fourth) + b });
+ this._points.push({ X: lastx, Y: lasty });
+ this._points.push({ X: lastx, Y: lasty });
break;
case "arrow":
const x1 = left;