aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary Zhang <zacharyzhang7@gmail.com>2024-08-05 12:36:49 -0400
committerZachary Zhang <zacharyzhang7@gmail.com>2024-08-05 12:36:49 -0400
commit52cb136c3469e54d3acff77c04d14374c16c4e80 (patch)
tree49add11feaa1863b6df9e8ac497b4c9b480ca4b5 /src
parent0f82a2947729ff6d986b46d9d399857f8739d854 (diff)
fix horrible bug
Diffstat (limited to 'src')
-rw-r--r--src/client/views/GestureOverlay.tsx13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index 8cc33baca..abb8445dc 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -149,16 +149,20 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
const point2 = cuspArray[i + 1];
const point3 = cuspArray[i + 2];
const triangleObject = { p1: { X: point1.X, Y: point1.Y }, p2: { X: point2.X, Y: point2.Y }, p3: { X: point3.X, Y: point3.Y } };
+ const otherInk = DocumentView.getDocumentView(doc)?.ComponentView as InkingStroke;
+ const { inkData: otherInkData } = otherInk?.inkScaledData() ?? { inkData: [] };
+ const otherScreenPts = otherInkData.map(point => otherInk.ptToScreen(point));
+ console.log(otherScreenPts);
console.log((DocumentView.getDocumentView(doc)?.ComponentView as InkingStroke).inkScaledData().inkData.map(point => ({ X: point.X, Y: point.Y })));
console.log(triangleObject);
if (doc.title === 'line') {
- if (this.doesLineIntersectTriangle((DocumentView.getDocumentView(doc)?.ComponentView as InkingStroke).inkScaledData().inkData, triangleObject)) {
+ if (this.doesLineIntersectTriangle(otherScreenPts, triangleObject)) {
docsToDelete.push(doc);
hasDocInTriangle = true;
cuspBooleanArray.push(true);
}
} else {
- if (this.isAnyPointInTriangle(triangleObject, (DocumentView.getDocumentView(doc)?.ComponentView as InkingStroke).inkScaledData().inkData)) {
+ if (this.isAnyPointInTriangle(triangleObject, otherScreenPts)) {
docsToDelete.push(doc);
hasDocInTriangle = true;
cuspBooleanArray.push(true);
@@ -193,10 +197,10 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
console.log(hasObjectInFirstAndLast25);
const trueCount = cuspBooleanArray.filter(value => value).length;
const percentageTrues = trueCount / cuspBooleanArray.length;
- if (percentageTrues > 0.75 || hasObjectInFirstAndLast25) {
+ if (percentageTrues > 0.65 || hasObjectInFirstAndLast25) {
console.log('requirements are met');
}
- return percentageTrues > 0.75 || hasObjectInFirstAndLast25;
+ return percentageTrues > 0.65 || hasObjectInFirstAndLast25;
}
isRectangleOverlap(rect1: any, rect2: any): boolean {
const noOverlap = rect1.maxX < rect2.minX || rect1.minX > rect2.maxX || rect1.maxY < rect2.minY || rect1.minY > rect2.maxY;
@@ -323,6 +327,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
this._points.length = 0;
this._points.push(...controlPoints);
this.dispatchGesture(Gestures.Stroke);
+ const ffView = DocumentView.allViews().find(view => view.ComponentView instanceof CollectionFreeFormView);
}
}
}