Mercurial > MadButterfly
comparison nodejs/svg.js @ 847:dfe28355bded
Fix the location of the text elements.
author | wycc |
---|---|
date | Sun, 19 Sep 2010 19:28:33 +0800 |
parents | f348a41e1aae |
children | 702e4874a58a 0027379c962e |
comparison
equal
deleted
inserted
replaced
846:f348a41e1aae | 847:dfe28355bded |
---|---|
251 var a; | 251 var a; |
252 var vstr; | 252 var vstr; |
253 var bbox, center; | 253 var bbox, center; |
254 | 254 |
255 a = node.attr("bbox-x"); | 255 a = node.attr("bbox-x"); |
256 sys.puts("a="+a); | |
256 if(!a) | 257 if(!a) |
257 return 0; | 258 return 0; |
258 | 259 |
259 tgt.bbox = bbox = new Object(); | 260 tgt.bbox = bbox = new Object(); |
260 vstr = a.value(); | 261 vstr = a.value(); |
389 if (c == "tspan") { | 390 if (c == "tspan") { |
390 this.parseTSpan(tcoord,nodes[k],style); | 391 this.parseTSpan(tcoord,nodes[k],style); |
391 } else { | 392 } else { |
392 } | 393 } |
393 } | 394 } |
395 sys.puts(y); | |
396 if (this._set_bbox(n, tcoord)) { | |
397 tcoord.center.x -= tcoord[2]; | |
398 tcoord.center.y -= tcoord[5]; | |
399 tcoord._x = tcoord.center.x; | |
400 tcoord._y = tcoord.center.y; | |
401 } else { | |
402 tcoord._x = coord.center.x; | |
403 tcoord._y = coord.center.y; | |
404 } | |
394 | 405 |
395 make_mbnames(this.mb_rt, n, tcoord); | 406 make_mbnames(this.mb_rt, n, tcoord); |
396 }; | 407 }; |
397 | 408 |
398 | 409 |
467 parseTransform(tcoord,trans.value()); | 478 parseTransform(tcoord,trans.value()); |
468 | 479 |
469 var rect = this.mb_rt.rect_new(x,y,w,h,10, 10); | 480 var rect = this.mb_rt.rect_new(x,y,w,h,10, 10); |
470 this._set_paint(n, rect); | 481 this._set_paint(n, rect); |
471 if (this._set_bbox(n, tcoord)) { | 482 if (this._set_bbox(n, tcoord)) { |
472 rx = accu_matrix[0]*tcoord.center.x+accu_matrix[1]*tcoord.center.y+accu_matrix[2]; | 483 tcoord.center.x -= tcoord[2]; |
473 ry = accu_matrix[3]*tcoord.center.x+accu_matrix[4]*tcoord.center.y+accu_matrix[5]; | 484 tcoord.center.y -= tcoord[5]; |
474 tcoord.center.x -= accu_matrix[2]+tcoord[2]; | |
475 tcoord.center.y -= accu_matrix[2]+tcoord[2]; | |
476 } else { | 485 } else { |
477 if (trans) { | 486 if (trans) { |
478 rx = tcoord[0]*x+tcoord[1]*y+tcoord[2]; | 487 rx = tcoord[0]*x+tcoord[1]*y+tcoord[2]; |
479 ry = tcoord[3]*x+tcoord[4]*y+tcoord[5]; | 488 ry = tcoord[3]*x+tcoord[4]*y+tcoord[5]; |
480 if (tcoord.center.x > rx) | 489 if (tcoord.center.x > rx) |
481 tcoord.center.x = rx; | 490 tcoord.center.x = rx; |
482 if (tcoord.center.y > ry) | 491 if (tcoord.center.y > ry) |
483 tcoord.center.y = ry; | 492 tcoord.center.y = ry; |
484 } | 493 } |
485 } | 494 } |
495 sys.puts("center.x="+tcoord.center.x); | |
496 sys.puts("center.y="+tcoord.center.y); | |
497 tcoord._x = tcoord.center.x; | |
498 tcoord._y = tcoord.center.y; | |
486 tcoord.add_shape(rect); | 499 tcoord.add_shape(rect); |
487 | 500 |
488 make_mbnames(this.mb_rt, n, tcoord); | 501 make_mbnames(this.mb_rt, n, tcoord); |
489 }; | 502 }; |
490 | 503 |