(showTypes: boolean)
| 43 | } |
| 44 | |
| 45 | public redetermineGraphBoundingBox(showTypes: boolean): [[number, number], [number, number]] { |
| 46 | this.minGraphX = 0; |
| 47 | this.maxGraphNodeX = 1; |
| 48 | this.minGraphY = 0; |
| 49 | this.maxGraphY = 1; |
| 50 | |
| 51 | for (const node of this.nodes()) { |
| 52 | if (!node.visible) continue; |
| 53 | |
| 54 | this.minGraphX = Math.min(this.minGraphX, node.x); |
| 55 | this.maxGraphNodeX = Math.max(this.maxGraphNodeX, node.x + node.getWidth()); |
| 56 | |
| 57 | this.minGraphY = Math.min(this.minGraphY, node.y - C.NODE_INPUT_WIDTH); |
| 58 | this.maxGraphY = Math.max(this.maxGraphY, node.y + node.getHeight(showTypes) |
| 59 | + C.NODE_INPUT_WIDTH); |
| 60 | } |
| 61 | |
| 62 | this.maxGraphX = this.maxGraphNodeX + this.maxBackEdgeNumber |
| 63 | * C.MINIMUM_EDGE_SEPARATION; |
| 64 | |
| 65 | this.width = this.maxGraphX - this.minGraphX; |
| 66 | this.height = this.maxGraphY - this.minGraphY; |
| 67 | |
| 68 | return [ |
| 69 | [this.minGraphX - this.width / 2, this.minGraphY - this.height / 2], |
| 70 | [this.maxGraphX + this.width / 2, this.maxGraphY + this.height / 2] |
| 71 | ]; |
| 72 | } |
| 73 | |
| 74 | public makeNodeVisible(identifier: string): void { |
| 75 | if (this.nodeMap[identifier]) this.nodeMap[identifier].visible = true; |
no test coverage detected