From d181c48333df1b574a4e86bce8193d1e9aeb9b6a Mon Sep 17 00:00:00 2001 From: Matthias Konitzny <konitzny@ibr.cs.tu-bs.de> Date: Fri, 16 Sep 2022 19:06:37 +0200 Subject: [PATCH] Settings now actually work --- src/editor/renderer.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/editor/renderer.tsx b/src/editor/renderer.tsx index 119d4c1..9301165 100644 --- a/src/editor/renderer.tsx +++ b/src/editor/renderer.tsx @@ -64,7 +64,7 @@ export class GraphRenderer2D extends React.PureComponent< }); this.state = { - selectedNodes: [], // TODO: Why was undefined allowed here? + selectedNodes: [], }; this.keys = {}; @@ -182,12 +182,8 @@ export class GraphRenderer2D extends React.PureComponent< } private handleNodeDrag(node: Node) { - // if (!this.props.selectedNodes.includes(node)) { - // this.props.onNodeSelectionChanged([...this.props.selectedNodes, node]); - // } - // Should run connect logic? - if (!this.props.connectOnDrag) { + if (!this.props.settings.connectOnDrag) { return; } @@ -204,7 +200,7 @@ export class GraphRenderer2D extends React.PureComponent< } // Add link - this.props.onLinkCreation(node.id, closest.id); + this.props.onLinkCreation(node.id, closest.node.id); } private handleNodeCanvasObject( @@ -234,7 +230,7 @@ export class GraphRenderer2D extends React.PureComponent< n.neighbors.includes(node) ); - if (this.props.settings && drawLabel) { + if (this.props.settings.visibleLabels && drawLabel) { const labelHeightOffset = iconSize / 3; this.drawNodeLabel(node, globalScale, ctx, labelHeightOffset, 11); } -- GitLab