diff --git a/src/app/cartography/shared/widgets/drawing-line.widget.ts b/src/app/cartography/shared/widgets/drawing-line.widget.ts index b34da544..e5071b00 100644 --- a/src/app/cartography/shared/widgets/drawing-line.widget.ts +++ b/src/app/cartography/shared/widgets/drawing-line.widget.ts @@ -16,12 +16,8 @@ export class DrawingLineWidget { this.drawingLine.end = new Point(x, y); const over = function(this, d, i) { - // const e = event; - // const dom = select('g.canvas').node(); const node = self.selection.select('g.canvas').node(); const coordinates = mouse(node); - // console.log(e); - console.log(d, i); self.drawingLine.end.x = coordinates[0]; self.drawingLine.end.y = coordinates[1]; self.draw(); @@ -31,15 +27,6 @@ export class DrawingLineWidget { this.draw(); } - // private handleMouseOver(d, i) { - // const e = event; - // console.log(e); - // console.log(d, i); - // this.drawingLine.end.x = e.clientX; - // this.drawingLine.end.y = e.clientY; - // this.draw(); - // } - public update(x: number, y: number) { this.drawingLine.end = new Point(x, y); } @@ -50,7 +37,10 @@ export class DrawingLineWidget { public connect(selection: SVGSelection) { this.selection = selection; - // this.selection.append('g').classed("drawing-line-tool"); + const canvas = this.selection.select("g.canvas"); + if (!canvas.select("g.drawing-line-tool").node()) { + canvas.append('g').attr("class", "drawing-line-tool"); + } } public draw() { @@ -61,27 +51,9 @@ export class DrawingLineWidget { const value_line = line(); - // const canvas = this.selection.select('g.drawing-line-tool'); - // - // const tool = canvas - // .selectAll('path') - // .data(link_data); - // - // const enter = tool - // .enter() - // // .append('g.drawing-line') - // .append('path') - // - // // enter.classed("drawing-line"); - // - // - // tool - // .merge(enter) - // .attr('d', value_line) - // .attr('stroke', '#000') - // .attr('stroke-width', '2'); + const drawing_line_tool = this.selection.select('g.drawing-line-tool'); - const tool = this.selection + const tool = drawing_line_tool .selectAll('path') .data(link_data); @@ -94,23 +66,6 @@ export class DrawingLineWidget { .attr('d', value_line) .attr('stroke', '#000') .attr('stroke-width', '2'); - - // const tool = this.selection - // .selectAll('g.drawing-line') - // .data(link_data); - // - // const enter = tool - // .enter() - // .append('g.drawing-line') - // .append('path'); - // - // tool - // .merge(enter) - // .select('path') - // .attr('d', value_line) - // .attr('stroke', '#000') - // .attr('stroke-width', '2'); - - + } } diff --git a/src/app/project-map/project-map.component.ts b/src/app/project-map/project-map.component.ts index 054405db..7dca5c5e 100644 --- a/src/app/project-map/project-map.component.ts +++ b/src/app/project-map/project-map.component.ts @@ -270,8 +270,7 @@ export class ProjectMapComponent implements OnInit { const node: Node = event.node; const port: Port = event.port; - console.log(node); - this.mapChild.graphLayout.getDrawingLineTool().start(node.x, node.y); + this.mapChild.graphLayout.getDrawingLineTool().start(node.x + node.width / 2., node.y + node.height / 2.); } }