# HG changeset patch # User wycc # Date 1300892556 -28800 # Node ID 9a585df24e5204302a9ef688be09fced1550a4b8 # Parent 76d2aad5da3533ad8443171c9d095627ac9645ec Consider the width and height attribute for the rect elements. The inkscape will change the width and height directly without using transform when we resize the rectangle. diff -r 76d2aad5da35 -r 9a585df24e52 nodejs/svg.js --- a/nodejs/svg.js Wed Mar 23 00:33:51 2011 +0800 +++ b/nodejs/svg.js Wed Mar 23 23:02:36 2011 +0800 @@ -964,6 +964,23 @@ tcoord.tx = 0; tcoord.ty = 0; } + + tcoord.tx += x; + tcoord.ty += y; + attr = n.attr('duplicate-src'); + if (attr) { + var id = attr.value(); + var orign = this.mb_rt.mbnames[id].node; + sys.puts("xxxxxxxxxxxxxx"); + var nw = getInteger(orign,'width'); + var nh = getInteger(orign,'height'); + sys.puts("nw="+nw); + sys.puts("nh="+nh); + sys.puts("w="+w); + sys.puts("h="+h); + tcoord.sx *= w/nw; + tcoord.sy *= h/nh; + } @@ -1027,6 +1044,8 @@ } loadSVG.prototype.parseGroup=function(accu_matrix,root, group_id, n) { + var label = n.attr('label'); + if (label && label.value()=='dup') return; var k; var nodes = n.childNodes(); var coord = this.mb_rt.coord_new(root); @@ -1034,6 +1053,7 @@ var trans = n.attr('transform'); var accu=[1,0,0,0,1,0]; var style; + n.coord = coord; coord.node = n; this._check_duplicate_src(n,coord);