1515 * Paper.js DOM to a SVG DOM.
1616 */
1717new function ( ) {
18- // Shortcut to Format.number
19- var format = Format . number ,
18+ var formatter = Formatter . instance ,
2019 namespaces = {
2120 href : 'http://www.w3.org/1999/xlink'
2221 } ;
@@ -26,7 +25,7 @@ new function() {
2625 var val = attrs [ key ] ,
2726 namespace = namespaces [ key ] ;
2827 if ( typeof val === 'number' )
29- val = format ( val ) ;
28+ val = formatter . number ( val ) ;
3029 if ( namespace ) {
3130 node . setAttributeNS ( namespace , key , val ) ;
3231 } else {
@@ -72,11 +71,11 @@ new function() {
7271 angle = decomposed . rotation ,
7372 scale = decomposed . scaling ;
7473 if ( trans && ! trans . isZero ( ) )
75- parts . push ( 'translate(' + Format . point ( trans ) + ')' ) ;
74+ parts . push ( 'translate(' + formatter . point ( trans ) + ')' ) ;
7675 if ( ! Numerical . isZero ( scale . x - 1 ) || ! Numerical . isZero ( scale . y - 1 ) )
77- parts . push ( 'scale(' + Format . point ( scale ) + ')' ) ;
76+ parts . push ( 'scale(' + formatter . point ( scale ) + ')' ) ;
7877 if ( angle )
79- parts . push ( 'rotate(' + format ( angle ) + ')' ) ;
78+ parts . push ( 'rotate(' + formatter . number ( angle ) + ')' ) ;
8079 attrs . transform = parts . join ( ' ' ) ;
8180 } else {
8281 attrs . transform = 'matrix(' + matrix . getValues ( ) . join ( ',' ) + ')' ;
@@ -223,7 +222,7 @@ new function() {
223222 case 'polygon' :
224223 var parts = [ ] ;
225224 for ( i = 0 , l = segments . length ; i < l ; i ++ )
226- parts . push ( Format . point ( segments [ i ] . _point ) ) ;
225+ parts . push ( formatter . point ( segments [ i ] . _point ) ) ;
227226 attrs = {
228227 points : parts . join ( ' ' )
229228 } ;
@@ -296,8 +295,8 @@ new function() {
296295 break ;
297296 }
298297 if ( angle ) {
299- attrs . transform = 'rotate(' + format ( angle ) + ','
300- + Format . point ( center ) + ')' ;
298+ attrs . transform = 'rotate(' + formatter . number ( angle ) + ','
299+ + formatter . point ( center ) + ')' ;
301300 // Tell applyStyle() that to transform the gradient the other way
302301 item . _gradientMatrix = new Matrix ( ) . rotate ( - angle , center ) ;
303302 }
@@ -320,16 +319,16 @@ new function() {
320319 bounds = definition . getBounds ( ) ;
321320 if ( ! symbolNode ) {
322321 symbolNode = createElement ( 'symbol' , {
323- viewBox : Format . rectangle ( bounds )
322+ viewBox : formatter . rectangle ( bounds )
324323 } ) ;
325324 symbolNode . appendChild ( exportSvg ( definition ) ) ;
326325 setDefinition ( symbol , symbolNode ) ;
327326 }
328327 attrs . href = '#' + symbolNode . id ;
329328 attrs . x += bounds . x ;
330329 attrs . y += bounds . y ;
331- attrs . width = format ( bounds . width ) ;
332- attrs . height = format ( bounds . height ) ;
330+ attrs . width = formatter . number ( bounds . width ) ;
331+ attrs . height = formatter . number ( bounds . height ) ;
333332 return createElement ( 'use' , attrs ) ;
334333 }
335334
@@ -431,7 +430,7 @@ new function() {
431430 : entry . type === 'array'
432431 ? value . join ( ',' )
433432 : entry . type === 'number'
434- ? format ( value )
433+ ? formatter . number ( value )
435434 : value ;
436435 }
437436 } ) ;
0 commit comments