comparison nodejs/svg.js @ 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 9ce82873d406
children 98ea7146cef3
comparison
equal deleted inserted replaced
1380:76d2aad5da35 1381:9a585df24e52
962 tcoord.sy = 1; 962 tcoord.sy = 1;
963 tcoord.r = 0; 963 tcoord.r = 0;
964 tcoord.tx = 0; 964 tcoord.tx = 0;
965 tcoord.ty = 0; 965 tcoord.ty = 0;
966 } 966 }
967
968 tcoord.tx += x;
969 tcoord.ty += y;
970 attr = n.attr('duplicate-src');
971 if (attr) {
972 var id = attr.value();
973 var orign = this.mb_rt.mbnames[id].node;
974 sys.puts("xxxxxxxxxxxxxx");
975 var nw = getInteger(orign,'width');
976 var nh = getInteger(orign,'height');
977 sys.puts("nw="+nw);
978 sys.puts("nh="+nh);
979 sys.puts("w="+w);
980 sys.puts("h="+h);
981 tcoord.sx *= w/nw;
982 tcoord.sy *= h/nh;
983 }
967 984
968 985
969 986
970 var rect = this.mb_rt.rect_new(x,y,w,h,10, 10); 987 var rect = this.mb_rt.rect_new(x,y,w,h,10, 10);
971 tcoord.add_shape(rect); 988 tcoord.add_shape(rect);
1025 sys.puts("id "+id+" is not defined"); 1042 sys.puts("id "+id+" is not defined");
1026 } 1043 }
1027 } 1044 }
1028 1045
1029 loadSVG.prototype.parseGroup=function(accu_matrix,root, group_id, n) { 1046 loadSVG.prototype.parseGroup=function(accu_matrix,root, group_id, n) {
1047 var label = n.attr('label');
1048 if (label && label.value()=='dup') return;
1030 var k; 1049 var k;
1031 var nodes = n.childNodes(); 1050 var nodes = n.childNodes();
1032 var coord = this.mb_rt.coord_new(root); 1051 var coord = this.mb_rt.coord_new(root);
1033 // Parse the transform and style here 1052 // Parse the transform and style here
1034 var trans = n.attr('transform'); 1053 var trans = n.attr('transform');
1035 var accu=[1,0,0,0,1,0]; 1054 var accu=[1,0,0,0,1,0];
1036 var style; 1055 var style;
1056
1037 n.coord = coord; 1057 n.coord = coord;
1038 coord.node = n; 1058 coord.node = n;
1039 this._check_duplicate_src(n,coord); 1059 this._check_duplicate_src(n,coord);
1040 1060
1041 coord.center= new Object(); 1061 coord.center= new Object();