From 84e75f944a45c3b98ec70c75d2abc47051b10b03 Mon Sep 17 00:00:00 2001
From: Zachary Zhang <zacharyzhang7@gmail.com>
Date: Tue, 12 Mar 2024 16:28:39 -0400
Subject: test

---
 src/client/views/nodes/DiagramBox.tsx | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

(limited to 'src/client/views/nodes/DiagramBox.tsx')

diff --git a/src/client/views/nodes/DiagramBox.tsx b/src/client/views/nodes/DiagramBox.tsx
index 376dff15d..9ff2d27d2 100644
--- a/src/client/views/nodes/DiagramBox.tsx
+++ b/src/client/views/nodes/DiagramBox.tsx
@@ -48,11 +48,35 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im
             docArray.map(doc => {
                 if (doc.title == 'rectangle') {
                     DocListCast(this.Document.data).map(lineDoc => {
-                        if ((lineDoc.title == 'stroke' || lineDoc.title == 'line') && typeof lineDoc.x === 'number' && typeof doc.x === 'number' && typeof doc.width === 'number'&& typeof doc.height === 'number'&& typeof doc.y === 'number'&& typeof lineDoc.y === 'number') {
-                            if (lineDoc.x < doc.x + doc.width + (doc.width + doc.x) * 0.1 && lineDoc.x > doc.x&&lineDoc.y>doc.y&&lineDoc.y<doc.y+doc.height) {
+                        if (
+                            (lineDoc.title == 'stroke' || lineDoc.title == 'line') &&
+                            typeof lineDoc.x === 'number' &&
+                            typeof doc.x === 'number' &&
+                            typeof doc.width === 'number' &&
+                            typeof doc.height === 'number' &&
+                            typeof doc.y === 'number' &&
+                            typeof lineDoc.y === 'number'
+                        ) {
+                            if (lineDoc.x < doc.x + doc.width + (doc.width + doc.x) * 0.1 && lineDoc.x > doc.x && lineDoc.y > doc.y && lineDoc.y < doc.y + doc.height) {
                                 DocListCast(this.Document.data).map(doc2 => {
-                                    if (doc2.title == 'rectangle' && typeof lineDoc.x === 'number' && typeof lineDoc.width === 'number' && typeof doc2.x === 'number' && typeof doc2.width === 'number'&& typeof doc2.y === 'number'&& typeof doc2.height === 'number'&& typeof lineDoc.y === 'number') {
-                                        if (lineDoc.x + lineDoc.width > doc2.x - (doc2.x - doc2.width) * 0.1 && lineDoc.x + lineDoc.width < doc2.x + doc2.width &&lineDoc.y>doc2.y&&lineDoc.y<doc2.y+doc2.height&& typeof doc.x === 'number' && typeof doc.width === 'number') {
+                                    if (
+                                        doc2.title == 'rectangle' &&
+                                        typeof lineDoc.x === 'number' &&
+                                        typeof lineDoc.width === 'number' &&
+                                        typeof doc2.x === 'number' &&
+                                        typeof doc2.width === 'number' &&
+                                        typeof doc2.y === 'number' &&
+                                        typeof doc2.height === 'number' &&
+                                        typeof lineDoc.y === 'number'
+                                    ) {
+                                        if (
+                                            lineDoc.x + lineDoc.width > doc2.x - (doc2.x - doc2.width) * 0.1 &&
+                                            lineDoc.x + lineDoc.width < doc2.x + doc2.width &&
+                                            lineDoc.y > doc2.y &&
+                                            lineDoc.y < doc2.y + doc2.height &&
+                                            typeof doc.x === 'number' &&
+                                            typeof doc.width === 'number'
+                                        ) {
                                             mermaidCode += doc.title + Math.floor(doc.x).toString() + '-->' + doc2.title + Math.floor(doc2.x).toString() + ';';
                                             const indexToRemove = docArray.findIndex(doc => doc === lineDoc);
                                             if (indexToRemove !== -1) {
@@ -70,7 +94,7 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im
         }
     };
     render() {
-        console.log(this.chartContent)
+        console.log(this.ScreenToLocalBoxXf().scale(2));
         return (
             <div>
                 <Mermaid chart={this.chartContent} />
-- 
cgit v1.2.3-70-g09d2

