Skip to content

Commit

Permalink
fix(fabric.Text): Ensure the shortcut text render the passed argument…
Browse files Browse the repository at this point in the history
… and not the entire line (fabricjs#6526)
  • Loading branch information
asturur authored and shanicerae committed Jan 16, 2021
1 parent d4fd1cf commit b645654
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/shapes/text.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,13 +878,12 @@

/**
* @private
* @param {String} method
* @param {String} method fillText or strokeText.
* @param {CanvasRenderingContext2D} ctx Context to render on
* @param {String} line Content of the line
* @param {Array} line Content of the line, splitted in an array by grapheme
* @param {Number} left
* @param {Number} top
* @param {Number} lineIndex
* @param {Number} charOffset
*/
_renderChars: function(method, ctx, line, left, top, lineIndex) {
// set proper line offset
Expand All @@ -902,7 +901,7 @@
top -= lineHeight * this._fontSizeFraction / this.lineHeight;
if (shortCut) {
// render all the line in one pass without checking
this._renderChar(method, ctx, lineIndex, 0, this.textLines[lineIndex], left, top, lineHeight);
this._renderChar(method, ctx, lineIndex, 0, line.join(''), left, top, lineHeight);
ctx.restore();
return;
}
Expand Down

0 comments on commit b645654

Please sign in to comment.