# HG changeset patch # User Thinker K.F. Li # Date 1285481356 -28800 # Node ID 143ac14c3ce97e1eeddc8ce4db1a02cd98977c70 # Parent 8a2d676d9fa37fcf3ca719e8bbdd646105bc7264 Set opacity for a path. You can not set opacity on a shape of MadButterfly, but you can set opacity for a coord. We add an additional coord to contain a path, and set opacity on the containing coord. diff -r 8a2d676d9fa3 -r 143ac14c3ce9 nodejs/svg.js --- a/nodejs/svg.js Sun Sep 26 14:07:05 2010 +0800 +++ b/nodejs/svg.js Sun Sep 26 14:09:16 2010 +0800 @@ -699,6 +699,9 @@ } tgt.stroke_width = stroke_width; + + if(alpha < 1) + tgt.parent.opacity = alpha; }; loadSVG.prototype._set_paint = function(node, tgt) { @@ -752,13 +755,14 @@ var d = formalize_path_data(n.attr('d').value()); var style = n.attr('style'); var path = this.mb_rt.path_new(d); + var pcoord = this.mb_rt.coord_new(coord); - guessPathBoundingBox(coord,d); - coord.add_shape(path); + guessPathBoundingBox(pcoord,d); + pcoord.add_shape(path); this._set_paint(n, path); this._set_bbox(n, path); - make_mbnames(this.mb_rt, n, path); + make_mbnames(this.mb_rt, n, pcoord); }; loadSVG.prototype.parseText=function(accu,coord,id, n)