diff options
author | Zachary Zhang <zacharyzhang7@gmail.com> | 2024-03-12 16:28:39 -0400 |
---|---|---|
committer | Zachary Zhang <zacharyzhang7@gmail.com> | 2024-03-12 16:28:39 -0400 |
commit | 84e75f944a45c3b98ec70c75d2abc47051b10b03 (patch) | |
tree | b10eb9018cf2d699931064f01926c00508ef9668 | |
parent | ec89fe170a810c0a83b9347ec9f024e0ff9c2568 (diff) |
test
-rw-r--r-- | src/client/views/nodes/DiagramBox.tsx | 34 |
1 files changed, 29 insertions, 5 deletions
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} /> |