Mercurial > MadButterfly
changeset 1398:6fa4a53c3fca
Use clone_from_subtree to generate content for the svg:use.
author | wycc |
---|---|
date | Sun, 03 Apr 2011 11:48:39 +0800 |
parents | a19f6cecf3c8 |
children | 9cebe429508c |
files | nodejs/svg.js |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/svg.js Sat Apr 02 06:00:25 2011 +0800 +++ b/nodejs/svg.js Sun Apr 03 11:48:39 2011 +0800 @@ -633,7 +633,7 @@ var vstr; var bbox, center; var orig; - + a = node.attr("bbox-x"); if(!a) { tgt.center = new Object(); @@ -1133,11 +1133,18 @@ loadSVG.prototype.parseUse=function(accu_matrix,root, use_id, n) { var k; var nodes; - var coord = this.mb_rt.coord_new(root); + var coord; // Parse the transform and style here var trans = n.attr('transform'); var accu=[1,0,0,0,1,0]; var style; + var attr = n.attr('duplicate-src'); + if (attr) { + var src = this.mb_rt.mbnames[attr.value()]; + coord = root.clone_from_subtree(src); + } else { + coord = this.mb_rt.coord_new(root); + } n.coord = coord; coord.node = n; this._check_duplicate_src(n,coord); @@ -1157,11 +1164,6 @@ coord.ty = 0; } - var attr = n.attr('duplicate-src'); - if (attr) { - var src = this.mb_rt.mbnames[attr.value()]; - multiply(coord, coord,src); - } multiply(accu,accu_matrix); multiply(accu,coord); @@ -1176,7 +1178,6 @@ root.center.x = coord.center.x; if (root.center.y > coord.center.y) root.center.y = coord.center.y; - this._set_bbox(n, coord); this._groupMap[n.name()] = n;