mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-02 19:14:42 +00:00
This commit is contained in:
parent
b1c25a4f56
commit
b77957f3ec
1 changed files with 10 additions and 7 deletions
|
|
@ -341,18 +341,19 @@
|
|||
return this.cursorOffsetCache;
|
||||
}
|
||||
var lineLeftOffset,
|
||||
lineIndex = 0,
|
||||
charIndex = 0,
|
||||
lineIndex,
|
||||
charIndex,
|
||||
topOffset = 0,
|
||||
leftOffset = 0,
|
||||
boundaries,
|
||||
cursorPosition = this.get2DCursorLocation(position);
|
||||
for (var i = 0; i < cursorPosition.lineIndex; i++) {
|
||||
charIndex = cursorPosition.charIndex;
|
||||
lineIndex = cursorPosition.lineIndex;
|
||||
for (var i = 0; i < lineIndex; i++) {
|
||||
topOffset += this.getHeightOfLine(i);
|
||||
}
|
||||
|
||||
lineLeftOffset = this._getLineLeftOffset(cursorPosition.lineIndex);
|
||||
var bound = this.__charBounds[cursorPosition.lineIndex][cursorPosition.charIndex];
|
||||
lineLeftOffset = this._getLineLeftOffset(lineIndex);
|
||||
var bound = this.__charBounds[lineIndex][charIndex];
|
||||
bound && (leftOffset = bound.left);
|
||||
if (this.charSpacing !== 0 && charIndex === this._textLines[lineIndex].length) {
|
||||
leftOffset -= this._getWidthOfCharSpacing();
|
||||
|
|
@ -429,7 +430,9 @@
|
|||
boxEnd = this.__charBounds[endLine][endChar].left;
|
||||
}
|
||||
else {
|
||||
boxEnd = this.__charBounds[endLine][endChar - 1].left + this.__charBounds[endLine][endChar - 1].width;
|
||||
var charSpacing = this._getWidthOfCharSpacing();
|
||||
boxEnd = this.__charBounds[endLine][endChar - 1].left
|
||||
+ this.__charBounds[endLine][endChar - 1].width - charSpacing;
|
||||
}
|
||||
}
|
||||
realLineHeight = lineHeight;
|
||||
|
|
|
|||
Loading…
Reference in a new issue