File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -85,16 +85,22 @@ fabric.Textbox = fabric.util.createClass(fabric.Textbox, {
85
85
accumulatedSpace = 0 ;
86
86
line = this . _textLines [ i ] ;
87
87
currentLineWidth = this . getLineWidth ( i ) ;
88
- if ( currentLineWidth < this . width && ( spaces = this . textLines [ i ] . split ( '' ) ) ) {
88
+ if (
89
+ currentLineWidth < this . width &&
90
+ ( spaces = this . textLines [ i ] . split ( '' ) ) &&
91
+ spaces . length > 1
92
+ ) {
89
93
numberOfSpaces = spaces . length ;
90
94
diffSpace = ( this . width - currentLineWidth ) / ( numberOfSpaces - 1 ) ;
91
95
for ( var j = 0 , jlen = line . length ; j <= jlen ; j ++ ) {
92
96
charBound = this . __charBounds [ i ] [ j ] ;
93
97
// if (this._reSpaceAndTab.test(line[j])) {
94
- charBound . width += diffSpace ;
95
- charBound . kernedWidth += diffSpace ;
96
98
charBound . left += accumulatedSpace ;
97
- accumulatedSpace += diffSpace ;
99
+ if ( j < jlen - 1 ) {
100
+ charBound . width += diffSpace ;
101
+ charBound . kernedWidth += diffSpace ;
102
+ accumulatedSpace += diffSpace ;
103
+ }
98
104
// } else {
99
105
// charBound.left += accumulatedSpace;
100
106
// }
You can’t perform that action at this time.
0 commit comments