1+ var transformFn = 'transform' ,
2+ pathAttr = 'path' ;
3+
4+ if ( Raphael . type === 'svg.js' ) {
5+ transformFn = 'transforma' ;
6+ pathAttr = 'd' ;
7+ }
8+
19function Symbol ( chart , options , symbol ) {
210 this . chart = chart ;
311 this . group = this . chart . paper . set ( ) ;
@@ -7,12 +15,12 @@ function Symbol(chart, options, symbol) {
715 this . flowstate = ( options . flowstate || 'future' ) ;
816
917 this . next_direction = options . next && options [ 'direction_next' ] ? options [ 'direction_next' ] : undefined ;
10-
18+
1119 this . text = this . chart . paper . text ( 0 , 0 , options . text ) ;
1220 //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t
1321 if ( options . key ) { this . text . node . id = options . key + 't' ; }
1422 this . text . node . setAttribute ( 'class' , this . getAttr ( 'class' ) + 't' ) ;
15-
23+
1624 this . text . attr ( {
1725 'text-anchor' : 'start' ,
1826 'x' : this . getAttr ( 'text-margin' ) ,
@@ -47,12 +55,12 @@ function Symbol(chart, options, symbol) {
4755 }
4856 this . text . attr ( "text" , tempText . substring ( 1 ) ) ;
4957 }
50-
58+
5159 this . group . push ( this . text ) ;
5260
5361 if ( symbol ) {
5462 var tmpMargin = this . getAttr ( 'text-margin' ) ;
55-
63+
5664 symbol . attr ( {
5765 'fill' : this . getAttr ( 'fill' ) ,
5866 'stroke' : this . getAttr ( 'element-color' ) ,
@@ -94,7 +102,7 @@ Symbol.prototype.getAttr = function(attName) {
94102} ;
95103
96104Symbol . prototype . initialize = function ( ) {
97- this . group . transforma ( 't' + this . getAttr ( 'line-width' ) + ',' + this . getAttr ( 'line-width' ) ) ;
105+ this . group [ transformFn ] . call ( this . group , 't' + this . getAttr ( 'line-width' ) + ',' + this . getAttr ( 'line-width' ) ) ;
98106
99107 this . width = this . group . getBBox ( ) . width ;
100108 this . height = this . group . getBBox ( ) . height ;
@@ -114,19 +122,19 @@ Symbol.prototype.getY = function() {
114122} ;
115123
116124Symbol . prototype . shiftX = function ( x ) {
117- this . group . transforma ( 't' + ( this . getX ( ) + x ) + ',' + this . getY ( ) ) ;
125+ this . group [ transformFn ] . call ( this . group , 't' + ( this . getX ( ) + x ) + ',' + this . getY ( ) ) ;
118126} ;
119127
120128Symbol . prototype . setX = function ( x ) {
121- this . group . transforma ( 't' + x + ',' + this . getY ( ) ) ;
129+ this . group [ transformFn ] . call ( this . group , 't' + x + ',' + this . getY ( ) ) ;
122130} ;
123131
124132Symbol . prototype . shiftY = function ( y ) {
125- this . group . transforma ( 't' + this . getX ( ) + ',' + ( this . getY ( ) + y ) ) ;
133+ this . group [ transformFn ] . call ( this . group , 't' + this . getX ( ) + ',' + ( this . getY ( ) + y ) ) ;
126134} ;
127135
128136Symbol . prototype . setY = function ( y ) {
129- this . group . transforma ( 't' + this . getX ( ) + ',' + y ) ;
137+ this . group [ transformFn ] . call ( this . group , 't' + this . getX ( ) + ',' + y ) ;
130138} ;
131139
132140Symbol . prototype . getTop = function ( ) {
@@ -377,8 +385,8 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) {
377385 intersections ,
378386 inter ;
379387
380- var ePath = otherLine . attr ( 'd' ) ,
381- lPath = line . attr ( 'd' ) ;
388+ var ePath = otherLine . attr ( pathAttr ) ,
389+ lPath = line . attr ( pathAttr ) ;
382390
383391 for ( var iP = 0 , lenP = ePath . length - 1 ; iP < lenP ; iP ++ ) {
384392 var newPath = [ ] ;
@@ -410,27 +418,27 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) {
410418 lPath . splice ( lP + 1 , 0 , newSegment ) ;
411419 newSegment = [ 'C' , res . x + lineWith * 2 , line2_from_y , res . x , line2_from_y - lineWith * 4 , res . x - lineWith * 2 , line2_from_y ] ;
412420 lPath . splice ( lP + 2 , 0 , newSegment ) ;
413- line . attr ( 'd' , lPath ) ;
421+ line . attr ( pathAttr , lPath ) ;
414422 } else {
415423 newSegment = [ 'L' , res . x - lineWith * 2 , line2_from_y ] ;
416424 lPath . splice ( lP + 1 , 0 , newSegment ) ;
417425 newSegment = [ 'C' , res . x - lineWith * 2 , line2_from_y , res . x , line2_from_y - lineWith * 4 , res . x + lineWith * 2 , line2_from_y ] ;
418426 lPath . splice ( lP + 2 , 0 , newSegment ) ;
419- line . attr ( 'd' , lPath ) ;
427+ line . attr ( pathAttr , lPath ) ;
420428 }
421429 } else {
422430 if ( line2_from_y > line2_to_y ) {
423431 newSegment = [ 'L' , line2_from_x , res . y + lineWith * 2 ] ;
424432 lPath . splice ( lP + 1 , 0 , newSegment ) ;
425433 newSegment = [ 'C' , line2_from_x , res . y + lineWith * 2 , line2_from_x + lineWith * 4 , res . y , line2_from_x , res . y - lineWith * 2 ] ;
426434 lPath . splice ( lP + 2 , 0 , newSegment ) ;
427- line . attr ( 'd' , lPath ) ;
435+ line . attr ( pathAttr , lPath ) ;
428436 } else {
429437 newSegment = [ 'L' , line2_from_x , res . y - lineWith * 2 ] ;
430438 lPath . splice ( lP + 1 , 0 , newSegment ) ;
431439 newSegment = [ 'C' , line2_from_x , res . y - lineWith * 2 , line2_from_x + lineWith * 4 , res . y , line2_from_x , res . y + lineWith * 2 ] ;
432440 lPath . splice ( lP + 2 , 0 , newSegment ) ;
433- line . attr ( 'd' , lPath ) ;
441+ line . attr ( pathAttr , lPath ) ;
434442 }
435443 }
436444
0 commit comments