@@ -292,9 +292,11 @@ CCLScripting = {
292292 "height" :stage . offsetHeight ,
293293 "style" :{
294294 "position" :"absolute" ,
295- "top" : ( serialized . y ? serialized . y : 0 ) + "px ",
296- "left" :( serialized . x ? serialized . x : 0 ) + "px "
295+ "top" : /* (serialized.y ? serialized.y : 0) + */ "0px ",
296+ "left" :/* (serialized.x ? serialized.x : 0) + */ "0px "
297297 } } ) ;
298+ svg . y = ( serialized . y ? serialized . y : 0 ) ;
299+ svg . x = ( serialized . x ? serialized . x : 0 ) ;
298300 setTimeout ( function ( ) {
299301 stage . appendChild ( svg . domParent ) ;
300302 } , 1000 ) ;
@@ -457,8 +459,8 @@ CCLScripting = {
457459 } ;
458460 this . drawRect = function ( params ) {
459461 var r = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ;
460- r . setAttribute ( "x" , params [ 0 ] ) ;
461- r . setAttribute ( "y" , params [ 1 ] ) ;
462+ r . setAttribute ( "x" , params [ 0 ] + this . x ) ;
463+ r . setAttribute ( "y" , params [ 1 ] + this . y ) ;
462464 r . setAttribute ( "width" , params [ 2 ] ) ;
463465 r . setAttribute ( "height" , params [ 3 ] ) ;
464466 applyFill ( r , this ) ;
@@ -467,8 +469,8 @@ CCLScripting = {
467469 } ;
468470 this . drawRoundRect = function ( params ) {
469471 var r = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ;
470- r . setAttribute ( "x" , params [ 0 ] ) ;
471- r . setAttribute ( "y" , params [ 1 ] ) ;
472+ r . setAttribute ( "x" , params [ 0 ] + this . x ) ;
473+ r . setAttribute ( "y" , params [ 1 ] + this . y ) ;
472474 r . setAttribute ( "width" , params [ 2 ] ) ;
473475 r . setAttribute ( "height" , params [ 3 ] ) ;
474476 r . setAttribute ( "rx" , params [ 4 ] ) ;
@@ -479,8 +481,8 @@ CCLScripting = {
479481 } ;
480482 this . drawCircle = function ( params ) {
481483 var c = document . createElementNS ( "http://www.w3.org/2000/svg" , "circle" ) ;
482- c . setAttribute ( "cx" , params [ 0 ] ) ;
483- c . setAttribute ( "cy" , params [ 1 ] ) ;
484+ c . setAttribute ( "cx" , params [ 0 ] + this . x ) ;
485+ c . setAttribute ( "cy" , params [ 1 ] + this . y ) ;
484486 c . setAttribute ( "r" , params [ 2 ] ) ;
485487 applyFill ( c , this ) ;
486488 applyStroke ( c , this ) ;
@@ -489,8 +491,8 @@ CCLScripting = {
489491
490492 this . drawEllipse = function ( params ) {
491493 var e = document . createElementNS ( "http://www.w3.org/2000/svg" , "ellipse" ) ;
492- e . setAttribute ( "cx" , params [ 0 ] ) ;
493- e . setAttribute ( "cy" , params [ 1 ] ) ;
494+ e . setAttribute ( "cx" , params [ 0 ] + this . x ) ;
495+ e . setAttribute ( "cy" , params [ 1 ] + this . y ) ;
494496 e . setAttribute ( "rx" , params [ 2 ] ) ;
495497 e . setAttribute ( "ry" , params [ 3 ] ) ;
496498 applyFill ( e , this ) ;
0 commit comments