OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var MINIMUM_EDGE_SEPARATION = 20; | 5 var MINIMUM_EDGE_SEPARATION = 20; |
6 | 6 |
7 function isEdgeInitiallyVisible(target, index, source, type) { | 7 function isEdgeInitiallyVisible(target, index, source, type) { |
8 return type == "control" && (target.cfg || source.cfg); | 8 return type == "control" && (target.cfg || source.cfg); |
9 } | 9 } |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return (target.x < source.x) | 42 return (target.x < source.x) |
43 ? (target.x + target.getTotalNodeWidth() + inputOffset) | 43 ? (target.x + target.getTotalNodeWidth() + inputOffset) |
44 : (target.x - inputOffset) | 44 : (target.x - inputOffset) |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 Edge.prototype.generatePath = function(graph) { | 48 Edge.prototype.generatePath = function(graph) { |
49 var target = this.target; | 49 var target = this.target; |
50 var source = this.source; | 50 var source = this.source; |
51 var input_x = target.x + target.getInputX(this.index); | 51 var input_x = target.x + target.getInputX(this.index); |
| 52 var arrowheadHeight = 7; |
| 53 var input_y = target.y - 2 * DEFAULT_NODE_BUBBLE_RADIUS - arrowheadHeight; |
52 var output_x = source.x + source.getOutputX(); | 54 var output_x = source.x + source.getOutputX(); |
53 var output_y = source.y + DEFAULT_NODE_HEIGHT + DEFAULT_NODE_BUBBLE_RADIUS; | 55 var output_y = source.y + graph.getNodeHeight(source) + DEFAULT_NODE_BUBBLE_RA
DIUS; |
54 var inputApproach = target.getInputApproach(this.index); | 56 var inputApproach = target.getInputApproach(this.index); |
55 var outputApproach = source.getOutputApproach(graph); | 57 var outputApproach = source.getOutputApproach(graph); |
56 var horizontalPos = this.getInputHorizontalPosition(graph); | 58 var horizontalPos = this.getInputHorizontalPosition(graph); |
57 | 59 |
58 var result = "M" + output_x + "," + output_y + | 60 var result = "M" + output_x + "," + output_y + |
59 "L" + output_x + "," + outputApproach + | 61 "L" + output_x + "," + outputApproach + |
60 "L" + horizontalPos + "," + outputApproach; | 62 "L" + horizontalPos + "," + outputApproach; |
61 | 63 |
62 if (horizontalPos != input_x) { | 64 if (horizontalPos != input_x) { |
63 result += "L" + horizontalPos + "," + inputApproach; | 65 result += "L" + horizontalPos + "," + inputApproach; |
64 } else { | 66 } else { |
65 if (inputApproach < outputApproach) { | 67 if (inputApproach < outputApproach) { |
66 inputApproach = outputApproach; | 68 inputApproach = outputApproach; |
67 } | 69 } |
68 } | 70 } |
69 | 71 |
70 result += "L" + input_x + "," + inputApproach + | 72 result += "L" + input_x + "," + inputApproach + |
71 "L" + input_x + "," + (target.y - DEFAULT_NODE_BUBBLE_RADIUS - 12); | 73 "L" + input_x + "," + input_y; |
72 return result; | 74 return result; |
73 } | 75 } |
74 | 76 |
75 Edge.prototype.isBackEdge = function() { | 77 Edge.prototype.isBackEdge = function() { |
76 return this.target.hasBackEdges() && (this.target.rank < this.source.rank); | 78 return this.target.hasBackEdges() && (this.target.rank < this.source.rank); |
77 } | 79 } |
OLD | NEW |