Skip to content

Commit

Permalink
Omit adding attributes if they don't contribute anything.
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Dahlström committed Sep 26, 2014
1 parent 1ebe48e commit a17d80d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion trianglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ Trianglify.Pattern.prototype.generateSVG = function () {
var x = (d[0][0] + d[1][0] + d[2][0])/3;
var y = (d[0][1] + d[1][1] + d[2][1])/3;
var c = color(x, y);
group.append("path").attr("d", "M" + d.join("L") + "Z").attr({ fill: c, stroke: c }).attr('fill-opacity', options.fillOpacity).attr('stroke-opacity', options.strokeOpacity);
var g = group.append("path").attr("d", "M" + d.join("L") + "Z").attr({ fill: c, stroke: c });
if (options.fillOpacity != 1)
g.attr('fill-opacity', options.fillOpacity);
if (options.strokeOpacity != 1)
g.attr('stroke-opacity', options.strokeOpacity);
});
return svg.node();
};
Expand Down
Loading

0 comments on commit a17d80d

Please sign in to comment.