changeset 888:143ac14c3ce9 abs_n_rel_center

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.
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 26 Sep 2010 14:09:16 +0800
parents 8a2d676d9fa3
children 0a4b92e4ff75
files nodejs/svg.js
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)