Comparing version 0.5.2 to 0.5.3
@@ -0,1 +1,6 @@ | ||
v0.5.3 | ||
====== | ||
* Fixes for edge label placement in rankdir=LR and rankdir=RL | ||
v0.5.2 | ||
@@ -2,0 +7,0 @@ ====== |
@@ -46,3 +46,5 @@ "use strict"; | ||
_.each(edge.points, reverseYOne); | ||
reverseYOne(edge); | ||
if (_.has(edge, "y")) { | ||
reverseYOne(edge); | ||
} | ||
}); | ||
@@ -61,3 +63,5 @@ } | ||
_.each(edge.points, swapXYOne); | ||
swapXYOne(edge); | ||
if (_.has(edge, "x")) { | ||
swapXYOne(edge); | ||
} | ||
}); | ||
@@ -64,0 +68,0 @@ } |
@@ -150,4 +150,4 @@ "use strict"; | ||
function makeSpaceForEdgeLabels(g) { | ||
var graphLabel = g.graph(); | ||
graphLabel.ranksep /= 2; | ||
var graph = g.graph(); | ||
graph.ranksep /= 2; | ||
_.each(g.edges(), function(e) { | ||
@@ -157,3 +157,7 @@ var edge = g.edge(e); | ||
if (edge.labelpos.toLowerCase() !== "c") { | ||
edge.width += edge.labeloffset; | ||
if (graph.rankdir === "TB" || graph.rankdir === "BT") { | ||
edge.width += edge.labeloffset; | ||
} else { | ||
edge.height += edge.labeloffset; | ||
} | ||
} | ||
@@ -225,2 +229,17 @@ }); | ||
_.each(g.edges(), function(e) { | ||
var edge = g.edge(e); | ||
if (_.has(edge, "x")) { | ||
var x = edge.x, | ||
y = edge.y, | ||
w = edge.width, | ||
h = edge.height; | ||
minX = Math.min(minX, x - w / 2); | ||
maxX = Math.max(maxX, x + w / 2); | ||
minY = Math.min(minY, y - h / 2); | ||
maxY = Math.max(maxY, y + h / 2); | ||
} | ||
}); | ||
minX -= marginX; | ||
@@ -272,5 +291,8 @@ minY -= marginY; | ||
if (_.has(edge, "x")) { | ||
if (edge.labelpos === "l" || edge.labelpos === "r") { | ||
edge.width -= edge.labeloffset; | ||
} | ||
switch (edge.labelpos) { | ||
case "l": edge.x -= edge.width / 2; break; | ||
case "r": edge.x += edge.width / 2; break; | ||
case "l": edge.x -= edge.width / 2 + edge.labeloffset; break; | ||
case "r": edge.x += edge.width / 2 + edge.labeloffset; break; | ||
} | ||
@@ -277,0 +299,0 @@ } |
@@ -83,2 +83,4 @@ "use strict"; | ||
origLabel.y = node.y; | ||
origLabel.width = node.width; | ||
origLabel.height = node.height; | ||
} | ||
@@ -85,0 +87,0 @@ v = w; |
@@ -1,1 +0,1 @@ | ||
module.exports = "0.5.2"; | ||
module.exports = "0.5.3"; |
{ | ||
"name": "dagre", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Graph layout for JavaScript", | ||
@@ -12,3 +12,3 @@ "author": "Chris Pettitt <cpettitt@gmail.com>", | ||
"dependencies": { | ||
"graphlib": "^0.8.0", | ||
"graphlib": "^0.8.3", | ||
"lodash": "^2.4.1" | ||
@@ -15,0 +15,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
379007
2474
Updatedgraphlib@^0.8.3