some more justify fixes

This commit is contained in:
Anton Lavrenov
2016-12-08 11:21:27 -05:00
parent b51ae24e33
commit 64aef6809e
3 changed files with 13 additions and 5 deletions

View File

@@ -13140,7 +13140,7 @@
var letter = text[li];
// skip justify for the last line
if ((letter === ' ') && (n !== textArrLen - 1) && align === JUSTIFY) {
context.translate(((totalWidth - width) / spacesNumber), 0);
context.translate(Math.floor((totalWidth - width) / spacesNumber), 0);
}
this.partialText = letter;
context.fillStrokeShape(this);
@@ -13364,6 +13364,10 @@
}
dummyContext.restore();
this.textHeight = fontSize;
// var maxTextWidth = 0;
// for(var j = 0; j < this.textArr.length; j++) {
// maxTextWidth = Math.max(maxTextWidth, this.textArr[j].width);
// }
this.textWidth = textWidth;
}
};

6
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -160,7 +160,7 @@
var letter = text[li];
// skip justify for the last line
if ((letter === ' ') && (n !== textArrLen - 1) && align === JUSTIFY) {
context.translate(((totalWidth - width) / spacesNumber), 0);
context.translate(Math.floor((totalWidth - width) / spacesNumber), 0);
}
this.partialText = letter;
context.fillStrokeShape(this);
@@ -384,6 +384,10 @@
}
dummyContext.restore();
this.textHeight = fontSize;
// var maxTextWidth = 0;
// for(var j = 0; j < this.textArr.length; j++) {
// maxTextWidth = Math.max(maxTextWidth, this.textArr[j].width);
// }
this.textWidth = textWidth;
}
};