@@ -142,16 +142,28 @@ thin.core.AbstractTextGroup.prototype.setTextLineHeightRatio = function(ratio) {
142142} ;
143143
144144
145+ /**
146+ * @deprecated See: https://github.com/thinreports/thinreports-editor/issues/38
147+ * @param {string|number } spacing
148+ * @return {string }
149+ */
150+ thin . core . AbstractTextGroup . prototype . convertKerningToDefaultInSince06 = function ( spacing ) {
151+ if ( isNaN ( Number ( spacing ) ) ) {
152+ spacing = thin . core . TextStyle . DEFAULT_KERNING ;
153+ }
154+
155+ return spacing ;
156+ } ;
157+
158+
145159/**
146160 * @param {string } spacing
147161 */
148162thin . core . AbstractTextGroup . prototype . setKerning = function ( spacing ) {
149163 var layout = this . getLayout ( ) ;
150164 var element = this . getElement ( ) ;
151165
152- if ( isNaN ( Number ( spacing ) ) ) {
153- spacing = thin . core . TextStyle . DEFAULT_KERNING ;
154- }
166+ spacing = this . convertKerningToDefaultInSince06 ( spacing ) ;
155167
156168 if ( thin . isExactlyEqual ( spacing , thin . core . TextStyle . DEFAULT_KERNING ) ) {
157169 layout . setElementAttributes ( element , {
@@ -382,38 +394,38 @@ thin.core.AbstractTextGroup.prototype.disposeInternal = function() {
382394/**
383395 * @return {string }
384396 */
385- thin . core . AbstractTextGroup . prototype . getTextAnchorToHash = function ( ) {
386- var textAlignToHash = '' ;
397+ thin . core . AbstractTextGroup . prototype . getTextAnchorAsJSON = function ( ) {
398+ var textAlignAsJSON = '' ;
387399 var horizonAlignType = thin . core . TextStyle . HorizonAlignType ;
388400
389401 // SVG: start, middle, end
390402 // TLF: left, center, right
391403 switch ( this . getTextAnchor ( ) ) {
392404 case horizonAlignType . MIDDLE :
393- textAlignToHash = 'center' ;
405+ textAlignAsJSON = 'center' ;
394406 break ;
395407 case horizonAlignType . END :
396- textAlignToHash = 'right' ;
408+ textAlignAsJSON = 'right' ;
397409 break ;
398410 default :
399- textAlignToHash = 'left' ;
411+ textAlignAsJSON = 'left' ;
400412 break ;
401413 }
402414
403- return textAlignToHash ;
415+ return textAlignAsJSON ;
404416} ;
405417
406418
407419/**
408- * @param {string } textAlignToHash
420+ * @param {string } textAlignFromJSON
409421 */
410- thin . core . AbstractTextGroup . prototype . setTextAnchorFromHash = function ( textAlignToHash ) {
422+ thin . core . AbstractTextGroup . prototype . setTextAnchorFromJSON = function ( textAlignFromJSON ) {
411423 var anchor = '' ;
412424 var horizonAlignType = thin . core . TextStyle . HorizonAlignType ;
413425
414426 // SVG: start, middle, end
415427 // TLF: left, center, right
416- switch ( textAlignToHash ) {
428+ switch ( textAlignFromJSON ) {
417429 case 'center' :
418430 anchor = horizonAlignType . MIDDLE ;
419431 break ;
@@ -432,43 +444,43 @@ thin.core.AbstractTextGroup.prototype.setTextAnchorFromHash = function(textAlign
432444/**
433445 * @return {string }
434446 */
435- thin . core . AbstractTextGroup . prototype . getVerticalAlignToHash = function ( ) {
436- var verticalAlignToHash = '' ;
447+ thin . core . AbstractTextGroup . prototype . getVerticalAlignAsJSON = function ( ) {
448+ var verticalAlignAsJSON = '' ;
437449 var verticalAlignType = thin . core . TextStyle . VerticalAlignType ;
438450
439451 // SVG: top, center, bottom
440452 // TLF: top, middle, bottom
441453 switch ( this . getVerticalAlign ( ) ) {
442454 case verticalAlignType . CENTER :
443- verticalAlignToHash = 'middle' ;
455+ verticalAlignAsJSON = 'middle' ;
444456 break ;
445457 case verticalAlignType . BOTTOM :
446- verticalAlignToHash = verticalAlignType . BOTTOM ;
458+ verticalAlignAsJSON = verticalAlignType . BOTTOM ;
447459 break ;
448460 default :
449- verticalAlignToHash = verticalAlignType . TOP ;
461+ verticalAlignAsJSON = verticalAlignType . TOP ;
450462 break ;
451463 }
452464
453- return verticalAlignToHash ;
465+ return verticalAlignAsJSON ;
454466} ;
455467
456468
457469/**
458- * @param {string } verticalAlignToHash
470+ * @param {string } verticalAlignFromJSON
459471 */
460- thin . core . AbstractTextGroup . prototype . setVerticalAlignFromHash = function ( verticalAlignToHash ) {
472+ thin . core . AbstractTextGroup . prototype . setVerticalAlignFromJSON = function ( verticalAlignFromJSON ) {
461473 var valign = '' ;
462474 var verticalAlignType = thin . core . TextStyle . VerticalAlignType ;
463475
464476 // SVG: top, center, bottom
465477 // TLF: top, middle, bottom
466- switch ( verticalAlignToHash ) {
478+ switch ( verticalAlignFromJSON ) {
467479 case 'middle' :
468480 valign = verticalAlignType . CENTER ;
469481 break ;
470482 default :
471- valign = verticalAlignToHash ;
483+ valign = verticalAlignFromJSON ;
472484 break ;
473485 }
474486
@@ -479,8 +491,8 @@ thin.core.AbstractTextGroup.prototype.setVerticalAlignFromHash = function(vertic
479491/**
480492 * @return {Object }
481493 */
482- thin . core . AbstractTextGroup . prototype . toHash = function ( ) {
483- var hash = this . toHash_ ( ) ;
494+ thin . core . AbstractTextGroup . prototype . asJSON = function ( ) {
495+ var object = this . asJSON_ ( ) ;
484496
485497 var lineHeight = this . getTextLineHeight ( ) ;
486498 var lineHeightRatio = this . getTextLineHeightRatio ( ) ;
@@ -494,21 +506,21 @@ thin.core.AbstractTextGroup.prototype.toHash = function() {
494506 letterSpecing = Number ( letterSpecing ) ;
495507 }
496508
497- goog . object . extend ( hash [ 'style' ] , {
509+ goog . object . extend ( object [ 'style' ] , {
498510 'font-family' : [ this . getFontFamily ( ) ] ,
499511 'font-size' : this . getFontSize ( ) ,
500- 'color' : goog . object . get ( hash [ 'style' ] , 'fill-color' ) ,
501- 'text-align' : this . getTextAnchorToHash ( ) ,
502- 'vertical-align' : this . getVerticalAlignToHash ( ) ,
512+ 'color' : goog . object . get ( object [ 'style' ] , 'fill-color' ) ,
513+ 'text-align' : this . getTextAnchorAsJSON ( ) ,
514+ 'vertical-align' : this . getVerticalAlignAsJSON ( ) ,
503515 'line-height' : lineHeight ,
504516 'line-height-ratio' : lineHeightRatio ,
505517 'letter-spacing' : letterSpecing
506518 } ) ;
507- goog . object . extend ( hash [ 'style' ] , this . fontStyle_ . toHash ( ) ) ;
519+ goog . object . extend ( object [ 'style' ] , this . fontStyle_ . asJSON ( ) ) ;
508520
509- goog . object . remove ( hash [ 'style' ] , 'fill-color' ) ;
521+ goog . object . remove ( object [ 'style' ] , 'fill-color' ) ;
510522
511- return hash ;
523+ return object ;
512524} ;
513525
514526
@@ -530,10 +542,10 @@ thin.core.AbstractTextGroup.prototype.update = function(attrs) {
530542 this . setFillColor ( value ) ;
531543 break ;
532544 case 'text-align' :
533- this . setTextAnchorFromHash ( value ) ;
545+ this . setTextAnchorFromJSON ( value ) ;
534546 break ;
535547 case 'vertical-align' :
536- this . setVerticalAlignFromHash ( value ) ;
548+ this . setVerticalAlignFromJSON ( value ) ;
537549 break ;
538550 case 'line-height-ratio' :
539551 this . setTextLineHeightRatio ( value ) ;
0 commit comments