mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-10 14:54:42 +00:00
fix styles when measuring
This commit is contained in:
parent
7b581b4753
commit
079a6f4e30
2 changed files with 2 additions and 4 deletions
|
|
@ -292,7 +292,7 @@
|
|||
var loc = this.get2DCursorLocation(index);
|
||||
|
||||
if (!this._getLineStyle(loc.lineIndex)) {
|
||||
this._setLineStyle(loc.lineIndex, {})
|
||||
this._setLineStyle(loc.lineIndex, {});
|
||||
}
|
||||
|
||||
if (!this._getStyleDeclaration(loc.lineIndex, loc.charIndex)) {
|
||||
|
|
|
|||
|
|
@ -208,9 +208,7 @@
|
|||
charOffset = charOffset || 0;
|
||||
|
||||
for (var i = 0; i < text.length; i++) {
|
||||
decl = this._getStyleDeclaration(lineIndex, i + charOffset);
|
||||
|
||||
if (decl) {
|
||||
if (this.styles && this.styles[lineIndex] && (decl = this.styles[lineIndex][i + charOffset])) {
|
||||
ctx.save();
|
||||
width += this._applyCharStylesGetWidth(ctx, text[i], lineIndex, i, decl);
|
||||
ctx.restore();
|
||||
|
|
|
|||
Loading…
Reference in a new issue