aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/GestureOverlay.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-05 13:06:14 -0400
committerGitHub <noreply@github.com>2020-08-05 13:06:14 -0400
commita9fbb81375d3e97b808d2cb90e68c9716ee916b7 (patch)
tree23a8545c9660ed57f0e3af7f6537cf4c2e5edc7f /src/client/views/GestureOverlay.tsx
parent1c54fb50438698bbc7a533ff98102e2a41458017 (diff)
parentd3c49ce7b1921dec4c27f425b2af788e3d6385e9 (diff)
Merge pull request #489 from browngraphicslab/ink_edits
fixed bugs after testing
Diffstat (limited to 'src/client/views/GestureOverlay.tsx')
-rw-r--r--src/client/views/GestureOverlay.tsx40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index 7c0a8635e..30df7cf9a 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -676,6 +676,15 @@ export default class GestureOverlay extends Touchable {
var left = Math.min(...xs);
var bottom = Math.max(...ys);
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 fourth = (lastx - firstx) / 4;
+ if (isNaN(fourth) || fourth === 0) { fourth = 0.01; }
+ var m = (lasty - firsty) / (lastx - firstx);
+ if (isNaN(m) || m === 0) { m = 0.01; }
+ const b = firsty - m * firstx;
if (shape === "noRec") {
return false;
}
@@ -725,6 +734,8 @@ export default class GestureOverlay extends Touchable {
this._points.push({ X: left, Y: top });
this._points.push({ X: left, Y: top });
// this._points.push({ X: left, Y: top });
+
+ // this._points.push({ X: left, Y: top });
// this._points.push({ X: left, Y: top });
// this._points.push({ X: left, Y: top - 1 });
@@ -797,8 +808,33 @@ export default class GestureOverlay extends Touchable {
break;
case "line":
- this._points.push({ X: left, Y: top });
- this._points.push({ X: right, Y: bottom });
+ // const firstx = this._points[0].X;
+ // const firsty = this._points[0].Y;
+ // const lastx = this._points[this._points.length - 1].X;
+ // const lasty = this._points[this._points.length - 1].Y;
+ // const fourth = (lastx - firstx) / 4;
+ // const m = (lasty - firsty) / (lastx - firstx);
+ // const b = firsty - m * firstx;
+ this._points.push({ X: firstx, Y: firsty });
+ this._points.push({ X: firstx, Y: firsty });
+
+ this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+ this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+ this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+ this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+
+ this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+ this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+ this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+ this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+
+ this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+ this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+ this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+ this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+
+ 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 });
break;
case "arrow":
const x1 = left;