@@ -3,7 +3,7 @@ goog.provide('acgraph.vector.Text.TextOverflow');
33
44goog . require ( 'acgraph.utils.HTMLParser' ) ;
55goog . require ( 'acgraph.utils.IdGenerator' ) ;
6- goog . require ( 'acgraph.vector.Element ' ) ;
6+ goog . require ( 'acgraph.vector.Shape ' ) ;
77goog . require ( 'acgraph.vector.TextSegment' ) ;
88goog . require ( 'goog.math.Rect' ) ;
99
@@ -21,7 +21,7 @@ goog.require('goog.math.Rect');
2121 @param {number= } opt_x Coordinate X (Left) of left top corner of text bounds.
2222 @param {number= } opt_y Coordinate Y (Top) of left top corner of text bounds.
2323 @constructor
24- @extends {acgraph.vector.Element }
24+ @extends {acgraph.vector.Shape }
2525*/
2626acgraph . vector . Text = function ( opt_x , opt_y ) {
2727
@@ -218,8 +218,9 @@ acgraph.vector.Text = function(opt_x, opt_y) {
218218 this . textPath = null ;
219219
220220 goog . base ( this ) ;
221+ this . setNullFillAndStroke ( ) ;
221222} ;
222- goog . inherits ( acgraph . vector . Text , acgraph . vector . Element ) ;
223+ goog . inherits ( acgraph . vector . Text , acgraph . vector . Shape ) ;
223224
224225
225226//----------------------------------------------------------------------------------------------------------------------
@@ -419,7 +420,7 @@ acgraph.vector.Text.Direction = {
419420 * @type {number }
420421 */
421422acgraph . vector . Text . prototype . SUPPORTED_DIRTY_STATES =
422- acgraph . vector . Element . prototype . SUPPORTED_DIRTY_STATES |
423+ acgraph . vector . Shape . prototype . SUPPORTED_DIRTY_STATES |
423424 acgraph . vector . Element . DirtyState . DATA |
424425 acgraph . vector . Element . DirtyState . STYLE |
425426 acgraph . vector . Element . DirtyState . POSITION |
@@ -1690,41 +1691,42 @@ acgraph.vector.Text.prototype.textDefragmentation = function() {
16901691 this . text_ = goog . string . canonicalizeNewlines ( goog . string . normalizeSpaces ( this . text_ ) ) ;
16911692 var textArr = this . text_ . split ( q ) ;
16921693
1693- if ( textArr . length == 1 && ! goog . isDef ( this . style_ [ 'width' ] ) && ! this . path ( ) ) {
1694- if ( ! this . domElement ( ) ) {
1695- this . createDom ( true ) ;
1696- }
1697- if ( this . hasDirtyState ( acgraph . vector . Element . DirtyState . STYLE ) )
1698- this . renderStyle ( ) ;
1699-
1700- segment = new acgraph . vector . TextSegment ( this . text_ , { } ) ;
1701- this . currentLine_ . push ( segment ) ;
1702- this . segments_ . push ( segment ) ;
1703- segment . parent ( this ) ;
1704-
1705- if ( this . hasDirtyState ( acgraph . vector . Element . DirtyState . DATA ) )
1706- this . renderData ( ) ;
1707-
1708- var bounds = acgraph . getRenderer ( ) . getBBox ( this . domElement ( ) , this . text_ , this . style_ ) ;
1709-
1710- segment . baseLine = - bounds . top ;
1711- segment . height = bounds . height ;
1712- segment . width = bounds . width ;
1713-
1714- // calculate line params with newly added segment.
1715- this . currentLineHeight_ = bounds . height ;
1716- this . currentLineWidth_ = bounds . width + this . textIndent_ ;
1717- this . currentBaseLine_ = segment . baseLine ;
1718- this . currentLineEmpty_ = this . text_ . length == 0 ;
1719-
1720- this . finalizeTextLine ( ) ;
1721- this . currentNumberSeqBreaks_ ++ ;
1722- var height = this . currentLine_ [ 0 ] ? this . currentLine_ [ 0 ] . height : 0 ;
1723- this . accumulatedHeight_ += goog . isString ( this . lineHeight_ ) ?
1724- parseInt ( this . lineHeight_ , 0 ) + height :
1725- this . lineHeight_ * height ;
1726-
1727- } else {
1694+ // if (textArr.length == 1 && !goog.isDefAndNotNull(this.style_['width']) && !this.path()) {
1695+ // if (!this.domElement()) {
1696+ // this.createDom(true);
1697+ // }
1698+ //
1699+ // if (this.hasDirtyState(acgraph.vector.Element.DirtyState.STYLE))
1700+ // this.renderStyle();
1701+ //
1702+ // if (this.hasDirtyState(acgraph.vector.Element.DirtyState.DATA)) {
1703+ // segment = new acgraph.vector.TextSegment(this.text_, {});
1704+ // this.currentLine_.push(segment);
1705+ // this.segments_.push(segment);
1706+ // segment.parent(this);
1707+ //
1708+ // this.renderData();
1709+ // }
1710+ //
1711+ // var bounds = acgraph.getRenderer().getBBox(this.domElement(), this.text_, this.style_);
1712+ //
1713+ // segment.baseLine = -bounds.top;
1714+ // segment.height = bounds.height;
1715+ // segment.width = bounds.width;
1716+ //
1717+ // // calculate line params with newly added segment.
1718+ // this.currentLineHeight_ = bounds.height;
1719+ // this.currentLineWidth_ = bounds.width + this.textIndent_;
1720+ // this.currentBaseLine_ = segment.baseLine;
1721+ // this.currentLineEmpty_ = this.text_.length == 0;
1722+ //
1723+ // this.finalizeTextLine();
1724+ // this.currentNumberSeqBreaks_++;
1725+ // var height = this.currentLine_[0] ? this.currentLine_[0].height : 0;
1726+ // this.accumulatedHeight_ += goog.isString(this.lineHeight_) ?
1727+ // parseInt(this.lineHeight_, 0) + height :
1728+ // this.lineHeight_ * height;
1729+ // } else {
17281730 for ( i = 0 ; i < textArr . length ; i ++ ) {
17291731 text = goog . string . trimLeft ( textArr [ i ] ) ;
17301732 if ( goog . isDefAndNotNull ( text ) ) {
@@ -1736,7 +1738,7 @@ acgraph.vector.Text.prototype.textDefragmentation = function() {
17361738 }
17371739 }
17381740 }
1739- }
1741+ // }
17401742 }
17411743
17421744 if ( this . textIndent_ && this . textLines_ . length > 0 ) {
0 commit comments