mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-10 01:10:59 +00:00
Update itext.class.js
This commit is contained in:
parent
185d8e2d31
commit
db0b026eef
1 changed files with 3 additions and 3 deletions
|
|
@ -1008,7 +1008,7 @@
|
|||
return this.__widthOfSpace[lineIndex];
|
||||
}
|
||||
var line = this._textLines[lineIndex],
|
||||
wordsWidth = this._getWidthOfWords(ctx, line, lineIndex),
|
||||
wordsWidth = this._getWidthOfWords(ctx, line, lineIndex, 0),
|
||||
widthDiff = this.width - wordsWidth,
|
||||
numSpaces = line.length - line.replace(this._reSpacesAndTabs, '').length,
|
||||
width = widthDiff / numSpaces;
|
||||
|
|
@ -1022,14 +1022,14 @@
|
|||
* @param {Number} line
|
||||
* @param {Number} lineIndex
|
||||
*/
|
||||
_getWidthOfWords: function (ctx, line, lineIndex) {
|
||||
_getWidthOfWords: function (ctx, line, lineIndex, charOffset) {
|
||||
var width = 0;
|
||||
|
||||
for (var charIndex = 0; charIndex < line.length; charIndex++) {
|
||||
var _char = line[charIndex];
|
||||
|
||||
if (!_char.match(/\s/)) {
|
||||
width += this._getWidthOfChar(ctx, _char, lineIndex, charIndex);
|
||||
width += this._getWidthOfChar(ctx, _char, lineIndex, charIndex + charOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue