comparison nodejs/svg.js @ 1392:cd5fb45bc247

Check if the scenes is defined. Disable the changeScene function if the scenes is not defined for the pure MB program.
author wycc
date Sun, 27 Mar 2011 08:27:03 +0800
parents e6d826db527c
children a768d74e5f49
comparison
equal deleted inserted replaced
1391:ff8122c59648 1392:cd5fb45bc247
1214 tcoord.tx += x; 1214 tcoord.tx += x;
1215 tcoord.ty += y; 1215 tcoord.ty += y;
1216 attr = n.attr('duplicate-src'); 1216 attr = n.attr('duplicate-src');
1217 if (attr) { 1217 if (attr) {
1218 var id = attr.value(); 1218 var id = attr.value();
1219 var orign = this.mb_rt.mbnames[id].node; 1219 var origcoord = this.mb_rt.mbnames[id];
1220 sys.puts("xxxxxxxxxxxxxx"); 1220 if (origcoord==null) {
1221 var nw = getInteger(orign,'width'); 1221 sys.puts("Unknown reference "+id);
1222 var nh = getInteger(orign,'height'); 1222 } else {
1223 sys.puts("nw="+nw); 1223 var orign = origcoord.node;
1224 sys.puts("nh="+nh); 1224 var nw = getInteger(orign,'width');
1225 sys.puts("w="+w); 1225 var nh = getInteger(orign,'height');
1226 sys.puts("h="+h); 1226 tcoord.sx *= w/nw;
1227 tcoord.sx *= w/nw; 1227 tcoord.sy *= h/nh;
1228 tcoord.sy *= h/nh; 1228 }
1229 } 1229 }
1230 nx = tcoord[0]*x+tcoord[1]*y+tcoord[2]; 1230 nx = tcoord[0]*x+tcoord[1]*y+tcoord[2];
1231 ny = tcoord[3]*x+tcoord[4]*y+tcoord[5]; 1231 ny = tcoord[3]*x+tcoord[4]*y+tcoord[5];
1232 if (tcoord.center.x > nx) 1232 if (tcoord.center.x > nx)
1233 tcoord.center.x = nx; 1233 tcoord.center.x = nx;
1234 if (tcoord.center.y > ny) 1234 if (tcoord.center.y > ny)
1235 tcoord.center.y = ny; 1235 tcoord.center.y = ny;
1236 var img = this.mb_rt.image_new(x,y,w,h); 1236 var img = this.mb_rt.image_new(x,y,w,h);
1237 sys.puts('----'+ref);
1238 var img_data = ldr.load(ref); 1237 var img_data = ldr.load(ref);
1239 try { 1238 try {
1240 var paint = this.mb_rt.paint_image_new(img_data); 1239 var paint = this.mb_rt.paint_image_new(img_data);
1241 paint.fill(img); 1240 paint.fill(img);
1242 } catch(e) { 1241 } catch(e) {