Mercurial > MadButterfly
comparison nodejs/svg.js @ 936:a9abcdac0ae5
Fix issue of moving lightbar of testsvg.js.
The lightbar does not move as expectation. It caused by compute
trasnforming matrix that transform saved points from the space when
saving points to current space. The transform matrix should not
include matric of the owner of saved points.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 12 Nov 2010 16:53:03 +0800 |
parents | 35b6a9411e26 |
children | 78312b44f48c |
comparison
equal
deleted
inserted
replaced
935:960e2395973d | 936:a9abcdac0ae5 |
---|---|
451 var _bbox_proto = { | 451 var _bbox_proto = { |
452 _get_ac_saved_rev: function() { | 452 _get_ac_saved_rev: function() { |
453 var c = this.owner; | 453 var c = this.owner; |
454 var mtx; | 454 var mtx; |
455 | 455 |
456 if(c.type != "coord") | 456 c = c.parent; |
457 c = c.parent; // is a shape! | |
458 | 457 |
459 mtx = c._mbapp_saved_rev_mtx; | 458 mtx = c._mbapp_saved_rev_mtx; |
460 while(c.parent && typeof c.parent != "undefined") { | 459 while(c.parent && typeof c.parent != "undefined") { |
461 c = c.parent; | 460 c = c.parent; |
462 mtx = _mul(mtx, c._mbapp_saved_rev_mtx); | 461 mtx = _mul(mtx, c._mbapp_saved_rev_mtx); |
467 | 466 |
468 _get_ac_mtx: function() { | 467 _get_ac_mtx: function() { |
469 var c = this.owner; | 468 var c = this.owner; |
470 var mtx; | 469 var mtx; |
471 | 470 |
472 if(c.type != "coord") | 471 c = c.parent; |
473 c = c.parent; // is a shape! | |
474 | 472 |
475 mtx = [c[0], c[1], c[2], c[3], c[4], c[5]]; | 473 mtx = [c[0], c[1], c[2], c[3], c[4], c[5]]; |
476 while(c.parent) { | 474 while(c.parent) { |
477 c = c.parent; | 475 c = c.parent; |
478 mtx = _mul(c, mtx); | 476 mtx = _mul(c, mtx); |
507 var _center_proto = { | 505 var _center_proto = { |
508 _get_ac_saved_rev: function() { | 506 _get_ac_saved_rev: function() { |
509 var c = this.owner; | 507 var c = this.owner; |
510 var mtx; | 508 var mtx; |
511 | 509 |
512 if(c.type != "coord") | 510 c = c.parent; |
513 c = c.parent; // is a shape! | |
514 | 511 |
515 mtx = c._mbapp_saved_rev_mtx; | 512 mtx = c._mbapp_saved_rev_mtx; |
516 while(c.parent && typeof c.parent != "undefined") { | 513 while(c.parent && typeof c.parent != "undefined") { |
517 c = c.parent; | 514 c = c.parent; |
518 mtx = _mul(mtx, c._mbapp_saved_rev_mtx); | 515 mtx = _mul(mtx, c._mbapp_saved_rev_mtx); |
523 | 520 |
524 _get_ac_mtx: function() { | 521 _get_ac_mtx: function() { |
525 var c = this.owner; | 522 var c = this.owner; |
526 var mtx; | 523 var mtx; |
527 | 524 |
528 if(c.type != "coord") | 525 c = c.parent; |
529 c = c.parent; // is a shape! | |
530 | 526 |
531 mtx = [c[0], c[1], c[2], c[3], c[4], c[5]]; | 527 mtx = [c[0], c[1], c[2], c[3], c[4], c[5]]; |
532 while(c.parent) { | 528 while(c.parent) { |
533 c = c.parent; | 529 c = c.parent; |
534 mtx = _mul(c, mtx); | 530 mtx = _mul(c, mtx); |
609 | 605 |
610 /*! \brief Prevent user to modify value. | 606 /*! \brief Prevent user to modify value. |
611 */ | 607 */ |
612 get y() { return this._y; }, | 608 get y() { return this._y; }, |
613 | 609 |
610 /*! \brief Center position in the relative space defined by parent. | |
611 */ | |
614 get rel() { | 612 get rel() { |
615 var rev; | 613 var rev; |
616 var xy; | 614 var xy; |
617 | 615 |
618 rev = this._get_ac_rev(); | 616 rev = this._get_ac_rev(); |