update CHANGELOG with new version

This commit is contained in:
Anton Lavrenov 2023-01-20 10:53:49 -05:00
parent 721792358a
commit 0a90828633
5 changed files with 39 additions and 9 deletions

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
### 8.4.2 (2023-01-20)
- Fix justify on text with limited height
### 8.4.1 (2023-01-19) ### 8.4.1 (2023-01-19)
- Typescript fixes for `container.add()` method. Ability to use empty array as argument. E.g. `container.add(...emptyArray)` - Typescript fixes for `container.add()` method. Ability to use empty array as argument. E.g. `container.add(...emptyArray)`

View File

@ -8,7 +8,7 @@
* Konva JavaScript Framework v8.4.1 * Konva JavaScript Framework v8.4.1
* http://konvajs.org/ * http://konvajs.org/
* Licensed under the MIT * Licensed under the MIT
* Date: Thu Jan 19 2023 * Date: Fri Jan 20 2023
* *
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva) * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
@ -13753,12 +13753,12 @@
} }
} }
// if element height is fixed, abort if adding one more line would overflow // if element height is fixed, abort if adding one more line would overflow
if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) {
break;
}
if (this.textArr[this.textArr.length - 1]) { if (this.textArr[this.textArr.length - 1]) {
this.textArr[this.textArr.length - 1].lastInParagraph = true; this.textArr[this.textArr.length - 1].lastInParagraph = true;
} }
if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) {
break;
}
} }
this.textHeight = fontSize; this.textHeight = fontSize;
// var maxTextWidth = 0; // var maxTextWidth = 0;

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -533,12 +533,12 @@ export class Text extends Shape<TextConfig> {
} }
} }
// if element height is fixed, abort if adding one more line would overflow // if element height is fixed, abort if adding one more line would overflow
if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) {
break;
}
if (this.textArr[this.textArr.length - 1]) { if (this.textArr[this.textArr.length - 1]) {
this.textArr[this.textArr.length - 1].lastInParagraph = true; this.textArr[this.textArr.length - 1].lastInParagraph = true;
} }
if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) {
break;
}
} }
this.textHeight = fontSize; this.textHeight = fontSize;
// var maxTextWidth = 0; // var maxTextWidth = 0;

View File

@ -647,6 +647,32 @@ describe('Text', function () {
assert.equal(layer.getContext().getTrace(true), trace); assert.equal(layer.getContext().getTrace(true), trace);
}); });
it('text justify should not justify just one line', function () {
var stage = addStage();
var layer = new Konva.Layer();
var text = new Konva.Text({
x: 10,
y: 10,
rotation: 0,
width: 500,
height: 58,
text: 'YOU ARE INVITED!',
fontSize: 30,
align: 'justify',
draggable: true,
});
layer.add(text);
stage.add(layer);
var trace =
'clearRect(0,0,578,200);save();transform(1,0,0,1,10,10);font=normal normal 30px Arial;textBaseline=middle;textAlign=left;translate(0,0);save();fillStyle=black;fillText(Y,0,15);fillStyle=black;fillText(O,20.01,15);fillStyle=black;fillText(U,43.345,15);fillStyle=black;fillText( ,65.01,15);fillStyle=black;fillText(A,73.345,15);fillStyle=black;fillText(R,93.354,15);fillStyle=black;fillText(E,115.02,15);fillStyle=black;fillText( ,135.029,15);fillStyle=black;fillText(I,143.364,15);fillStyle=black;fillText(N,151.699,15);fillStyle=black;fillText(V,173.364,15);fillStyle=black;fillText(I,193.374,15);fillStyle=black;fillText(T,201.709,15);fillStyle=black;fillText(E,220.034,15);fillStyle=black;fillText(D,240.044,15);fillStyle=black;fillText(!,261.709,15);restore();restore();';
assert.equal(layer.getContext().getTrace(), trace);
});
it('text multi line with justify align and several paragraphs', function () { it('text multi line with justify align and several paragraphs', function () {
var stage = addStage(); var stage = addStage();
var layer = new Konva.Layer(); var layer = new Konva.Layer();