Skip to content

Commit 9a2237c

Browse files
committed
Prep v0.4.2
1 parent 7ed20a8 commit 9a2237c

7 files changed

+66
-18
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dagre-d3",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"main": [
55
"dist/dagre-d3.core.js",
66
"dist/dagre-d3.core.min.js"

dist/dagre-d3.core.js

+28-4
Original file line numberDiff line numberDiff line change
@@ -958,12 +958,14 @@ function createOrSelectGroup(root, name) {
958958

959959
var intersectRect = require("./intersect/intersect-rect"),
960960
intersectEllipse = require("./intersect/intersect-ellipse"),
961-
intersectCircle = require("./intersect/intersect-circle");
961+
intersectCircle = require("./intersect/intersect-circle"),
962+
intersectPolygon = require("./intersect/intersect-polygon");
962963

963964
module.exports = {
964965
rect: rect,
965966
ellipse: ellipse,
966-
circle: circle
967+
circle: circle,
968+
diamond: diamond
967969
};
968970

969971
function rect(parent, bbox, node) {
@@ -1012,7 +1014,29 @@ function circle(parent, bbox, node) {
10121014
return shapeSvg;
10131015
}
10141016

1015-
},{"./intersect/intersect-circle":11,"./intersect/intersect-ellipse":12,"./intersect/intersect-rect":16}],25:[function(require,module,exports){
1017+
// Circumscribe an ellipse for the bounding box with a diamond shape. I derived
1018+
// the function to calculate the diamond shape from:
1019+
// http://mathforum.org/kb/message.jspa?messageID=3750236
1020+
function diamond(parent, bbox, node) {
1021+
var w = (bbox.width * Math.SQRT2) / 2,
1022+
h = (bbox.height * Math.SQRT2) / 2,
1023+
points = [
1024+
{ x: 0, y: -h },
1025+
{ x: -w, y: 0 },
1026+
{ x: 0, y: h },
1027+
{ x: w, y: 0 }
1028+
],
1029+
shapeSvg = parent.insert("polygon", ":first-child")
1030+
.attr("points", points.map(function(p) { return p.x + "," + p.y; }).join(" "));
1031+
1032+
node.intersect = function(p) {
1033+
return intersectPolygon(node, points, p);
1034+
};
1035+
1036+
return shapeSvg;
1037+
}
1038+
1039+
},{"./intersect/intersect-circle":11,"./intersect/intersect-ellipse":12,"./intersect/intersect-polygon":15,"./intersect/intersect-rect":16}],25:[function(require,module,exports){
10161040
var _ = require("./lodash");
10171041

10181042
// Public utility functions
@@ -1069,7 +1093,7 @@ function applyTransition(selection, g) {
10691093
}
10701094

10711095
},{"./lodash":20}],26:[function(require,module,exports){
1072-
module.exports = "0.4.1";
1096+
module.exports = "0.4.2";
10731097

10741098
},{}]},{},[1])(1)
10751099
});

dist/dagre-d3.core.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dagre-d3.js

+28-4
Original file line numberDiff line numberDiff line change
@@ -958,12 +958,14 @@ function createOrSelectGroup(root, name) {
958958

959959
var intersectRect = require("./intersect/intersect-rect"),
960960
intersectEllipse = require("./intersect/intersect-ellipse"),
961-
intersectCircle = require("./intersect/intersect-circle");
961+
intersectCircle = require("./intersect/intersect-circle"),
962+
intersectPolygon = require("./intersect/intersect-polygon");
962963

963964
module.exports = {
964965
rect: rect,
965966
ellipse: ellipse,
966-
circle: circle
967+
circle: circle,
968+
diamond: diamond
967969
};
968970

969971
function rect(parent, bbox, node) {
@@ -1012,7 +1014,29 @@ function circle(parent, bbox, node) {
10121014
return shapeSvg;
10131015
}
10141016

1015-
},{"./intersect/intersect-circle":11,"./intersect/intersect-ellipse":12,"./intersect/intersect-rect":16}],25:[function(require,module,exports){
1017+
// Circumscribe an ellipse for the bounding box with a diamond shape. I derived
1018+
// the function to calculate the diamond shape from:
1019+
// http://mathforum.org/kb/message.jspa?messageID=3750236
1020+
function diamond(parent, bbox, node) {
1021+
var w = (bbox.width * Math.SQRT2) / 2,
1022+
h = (bbox.height * Math.SQRT2) / 2,
1023+
points = [
1024+
{ x: 0, y: -h },
1025+
{ x: -w, y: 0 },
1026+
{ x: 0, y: h },
1027+
{ x: w, y: 0 }
1028+
],
1029+
shapeSvg = parent.insert("polygon", ":first-child")
1030+
.attr("points", points.map(function(p) { return p.x + "," + p.y; }).join(" "));
1031+
1032+
node.intersect = function(p) {
1033+
return intersectPolygon(node, points, p);
1034+
};
1035+
1036+
return shapeSvg;
1037+
}
1038+
1039+
},{"./intersect/intersect-circle":11,"./intersect/intersect-ellipse":12,"./intersect/intersect-polygon":15,"./intersect/intersect-rect":16}],25:[function(require,module,exports){
10161040
var _ = require("./lodash");
10171041

10181042
// Public utility functions
@@ -1069,7 +1093,7 @@ function applyTransition(selection, g) {
10691093
}
10701094

10711095
},{"./lodash":20}],26:[function(require,module,exports){
1072-
module.exports = "0.4.1";
1096+
module.exports = "0.4.2";
10731097

10741098
},{}],27:[function(require,module,exports){
10751099
/*

dist/dagre-d3.min.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/version.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = "0.4.2-pre";
1+
module.exports = "0.4.2";

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dagre-d3",
3-
"version": "0.4.2-pre",
3+
"version": "0.4.2",
44
"description": "A D3-based renderer for Dagre",
55
"author": "Chris Pettitt <[email protected]>",
66
"keywords": [
@@ -38,4 +38,4 @@
3838
"url": "https://github.com/cpettitt/dagre-d3.git"
3939
},
4040
"license": "MIT"
41-
}
41+
}

0 commit comments

Comments
 (0)