changeset 1381:9a585df24e52

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.
author wycc
date Wed, 23 Mar 2011 23:02:36 +0800
parents 76d2aad5da35
children 7ee0658025f3
files nodejs/svg.js
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);