Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
fix: wordWrap() - Don't add spaces before the first word on a line (#38)
Browse files Browse the repository at this point in the history
Fixes #37
  • Loading branch information
bluepichu authored and tleunen committed Jan 20, 2017
1 parent 0b5d29c commit 2060ce0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pixi-multistyle-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export default class MultiStyleText extends PIXI.Text {
// Part should be split in the middle
const characters = parts[k].split('');

if (k === 0) {
if (j > 0 && k === 0) {
result += " ";
spaceLeft -= this.context.measureText(" ").width;
}
Expand All @@ -426,8 +426,8 @@ export default class MultiStyleText extends PIXI.Text {
result += `\n${characters[c]}`;
spaceLeft = wordWrapWidth - characterWidth;
} else {
if (j === 0 && c === 0) {
result += ' ';
if (j > 0 && k === 0 && c === 0) {
result += " ";
}

result += characters[c];
Expand Down

0 comments on commit 2060ce0

Please sign in to comment.