File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
packages/ui-canvas/platforms/android/java/com/akylas/canvas Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -63,12 +63,13 @@ public static android.text.StaticLayout createEllipsizeStaticLayout(android.text
6363 int i = 0 ;
6464 float lineHeight = staticLayout .getLineBottom (i ) - staticLayout .getLineTop (i );
6565 float totalHeight = lineHeight * lineCount ;
66-
67- while (totalHeight > maxHeight && maxLines > 0 ) {
68- maxLines --;
69- i ++;
70- lineHeight = staticLayout .getLineBottom (i ) - staticLayout .getLineTop (i );
71- totalHeight = lineHeight * maxLines ;
66+ if (maxLines > 1 ) {
67+ while (totalHeight > maxHeight && maxLines > 0 ) {
68+ maxLines --;
69+ i ++;
70+ lineHeight = staticLayout .getLineBottom (i ) - staticLayout .getLineTop (i );
71+ totalHeight = lineHeight * maxLines ;
72+ }
7273 }
7374 // Check if truncation is needed
7475 if (maxLines < lineCount ) {
You can’t perform that action at this time.
0 commit comments