Skip to content

Commit

Permalink
fix for d3 v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benfred committed Aug 8, 2016
1 parent 7bede40 commit 2df538e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "venn.js",
"version": "0.2.11",
"version": "0.2.12",
"author": "Ben Frederickson <ben@benfrederickson.com> (http:/www.benfrederickson.com)",
"url": "https://github.com/benfred/venn.js/issues",
"devDependencies": {
Expand Down
8 changes: 7 additions & 1 deletion src/diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ export function VennDiagram() {

if (wrap) {
if (hasPrevious) {
updateText.on("end", wrapText(circles, label));
// d3 4.0 uses 'on' for events on transitions,
// but d3 3.0 used 'each' instead. switch appropiately
if ('on' in updateText) {
updateText.on("end", wrapText(circles, label));
} else {
updateText.each("end", wrapText(circles, label));
}
} else {
updateText.each(wrapText(circles, label));
}
Expand Down
8 changes: 7 additions & 1 deletion venn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,13 @@

if (wrap) {
if (hasPrevious) {
updateText.on("end", wrapText(circles, label));
// d3 4.0 uses 'on' for events on transitions,
// but d3 3.0 used 'each' instead. switch appropiately
if ('on' in updateText) {
updateText.on("end", wrapText(circles, label));
} else {
updateText.each("end", wrapText(circles, label));
}
} else {
updateText.each(wrapText(circles, label));
}
Expand Down

0 comments on commit 2df538e

Please sign in to comment.