()
| 582 | } |
| 583 | |
| 584 | private viewSelection(): void { |
| 585 | let minX; |
| 586 | let maxX; |
| 587 | let minY; |
| 588 | let maxY; |
| 589 | let hasSelection = false; |
| 590 | this.visibleNodes.selectAll<SVGGElement, GraphNode>("g").each((node: GraphNode) => { |
| 591 | if (this.state.selection.isSelected(node)) { |
| 592 | hasSelection = true; |
| 593 | minX = minX ? Math.min(minX, node.x) : node.x; |
| 594 | maxX = maxX ? Math.max(maxX, node.x + node.getWidth()) : node.x + node.getWidth(); |
| 595 | minY = minY ? Math.min(minY, node.y) : node.y; |
| 596 | maxY = maxY |
| 597 | ? Math.max(maxY, node.y + node.getHeight(this.state.showTypes)) |
| 598 | : node.y + node.getHeight(this.state.showTypes); |
| 599 | } |
| 600 | }); |
| 601 | if (hasSelection) { |
| 602 | this.viewGraphRegion(minX - C.NODE_INPUT_WIDTH, minY - 60, |
| 603 | maxX + C.NODE_INPUT_WIDTH, maxY + 60); |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | // Actions (handlers of toolbox menu and hotkeys events) |
| 608 | private layoutAction(view: GraphView): void { |
no test coverage detected