@@ -57,7 +57,7 @@ function SmartLabelManager(container, useEllipses, options) {
57
57
58
58
// Get a context of canvas
59
59
this . ctx = canvas && canvas . getContext && canvas . getContext ( '2d' ) ;
60
-
60
+
61
61
this . _containerManager = new ContainerManager ( wrapper , isBrowserLess , 10 ) ;
62
62
this . _showNoEllipses = ! useEllipses ;
63
63
this . _init = true ;
@@ -223,7 +223,7 @@ SmartLabelManager.prototype._isSameStyle = function () {
223
223
} ;
224
224
/**
225
225
* Sets font property of canvas context based on which the width of text is calculated.
226
- *
226
+ *
227
227
* @param {any } style style configuration which affects the text size
228
228
* {
229
229
* fontSize / 'font-size' : MUST BE FOLLOWED BY PX (10px, 11px)
@@ -448,8 +448,8 @@ SmartLabelManager.prototype.getSmartText = function (text, maxWidth, maxHeight,
448
448
/**
449
449
* For canvas lineHeight is directly used. In some cases, lineHeight can be 0.x pixels greater than
450
450
* maxHeight. Previously, div was used to calculate lineHeight and it used to return a rounded number.
451
- *
452
- * Adding a buffer of 1px, maxheight will be increased by a factor of 1.2 only when
451
+ *
452
+ * Adding a buffer of 1px, maxheight will be increased by a factor of 1.2 only when
453
453
* 0 <= (lineHeight - maxHeight) <= 1
454
454
*/
455
455
if ( ( lineHeight - maxHeight <= 1 ) && ( lineHeight - maxHeight >= 0 ) ) {
@@ -503,7 +503,7 @@ SmartLabelManager.prototype.getSmartText = function (text, maxWidth, maxHeight,
503
503
text = fastTrim ( text ) . replace ( / ( \s + ) / g, ' ' ) ;
504
504
maxWidthWithEll = this . _showNoEllipses ? maxWidth : ( maxWidth - ellipsesWidth ) ;
505
505
506
- // Checks if any html tag is present. This if block is executed for all normal texts and
506
+ // Checks if any html tag is present. This if block is executed for all normal texts and
507
507
// all texts containing only <br /> tag.
508
508
if ( ! hasHTMLTag || hasOnlyBrTag ) {
509
509
// Gets splitted array
@@ -557,7 +557,7 @@ SmartLabelManager.prototype.getSmartText = function (text, maxWidth, maxHeight,
557
557
if ( tempArr [ i ] === '<br />' ) {
558
558
strHeight += this . _lineHeight ;
559
559
lastIndexBroken = i ;
560
-
560
+
561
561
maxStrWidth = max ( maxStrWidth , strWidth ) ;
562
562
strWidth = 0 ;
563
563
trimStr = null ;
@@ -585,7 +585,8 @@ SmartLabelManager.prototype.getSmartText = function (text, maxWidth, maxHeight,
585
585
smartLabel . text = fastTrim ( trimStr ) + ellipsesStr ;
586
586
smartLabel . tooltext = smartLabel . oriText ;
587
587
smartLabel . width = max ( maxStrWidth , strWidth ) ;
588
- smartLabel . height = strHeight ;
588
+ smartLabel . height = strHeight ;
589
+ smartLabel . isTruncated = true ;
589
590
return smartLabel ;
590
591
}
591
592
}
@@ -619,7 +620,8 @@ SmartLabelManager.prototype.getSmartText = function (text, maxWidth, maxHeight,
619
620
smartLabel . text = fastTrim ( trimStr ) + ellipsesStr ;
620
621
smartLabel . tooltext = toolText ;
621
622
smartLabel . width = maxStrWidth ;
622
- smartLabel . height = strHeight - this . _lineHeight ;
623
+ smartLabel . height = strHeight - this . _lineHeight ;
624
+ smartLabel . isTruncated = true ;
623
625
return smartLabel ;
624
626
}
625
627
}
@@ -681,7 +683,8 @@ SmartLabelManager.prototype.getSmartText = function (text, maxWidth, maxHeight,
681
683
smartLabel . tooltext = smartLabel . oriText ;
682
684
// The max width among all the lines will be the width of the string.
683
685
smartLabel . width = maxWidth ;
684
- smartLabel . height = ( strHeight - this . _lineHeight ) ;
686
+ smartLabel . height = ( strHeight - this . _lineHeight ) ;
687
+ smartLabel . isTruncated = true ;
685
688
return smartLabel ;
686
689
} else {
687
690
maxStrWidth = max ( maxStrWidth , strWidth ) ;
@@ -1023,4 +1026,4 @@ SmartLabelManager.prototype.dispose = function () {
1023
1026
return this ;
1024
1027
} ;
1025
1028
1026
- export default SmartLabelManager ;
1029
+ export default SmartLabelManager ;
0 commit comments