1
0
mirror of https://github.com/konvajs/konva.git synced 2025-04-05 20:48:28 +08:00

update CHANGELOG with new version

This commit is contained in:
Anton Lavrenov 2019-10-15 11:51:13 -05:00
parent 71261c21bf
commit e2e94e08e6
5 changed files with 59 additions and 12 deletions

View File

@ -5,8 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## Not released:
## 4.0.15 - 2019-10-15
* TS fixes
* Better calculations for `TextPath` with align = right.
* Better calculations for `TextPath` with align = right
* Better `textPath.getClientRect()`
## 4.0.14 - 2019-10-11

View File

@ -8,7 +8,7 @@
* Konva JavaScript Framework v4.0.14
* http://konvajs.org/
* Licensed under the MIT
* Date: Fri Oct 11 2019
* Date: Tue Oct 15 2019
*
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
@ -14261,6 +14261,14 @@
}
};
TextPath.prototype.getSelfRect = function () {
if (!this.glyphInfo.length) {
return {
x: 0,
y: 0,
width: 0,
height: 0
};
}
var points = [];
this.glyphInfo.forEach(function (info) {
points.push(info.p0.x);
@ -14268,10 +14276,10 @@
points.push(info.p1.x);
points.push(info.p1.y);
});
var minX = points[0];
var maxX = points[0];
var minY = points[0];
var maxY = points[0];
var minX = points[0] || 0;
var maxX = points[0] || 0;
var minY = points[1] || 0;
var maxY = points[1] || 0;
var x, y;
for (var i = 0; i < points.length / 2; i++) {
x = points[i * 2];

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -500,6 +500,14 @@ export class TextPath extends Shape<TextPathConfig> {
}
}
getSelfRect() {
if (!this.glyphInfo.length) {
return {
x: 0,
y: 0,
width: 0,
height: 0
};
}
var points = [];
this.glyphInfo.forEach(function(info) {
@ -508,10 +516,10 @@ export class TextPath extends Shape<TextPathConfig> {
points.push(info.p1.x);
points.push(info.p1.y);
});
var minX = points[0];
var maxX = points[0];
var minY = points[0];
var maxY = points[0];
var minX = points[0] || 0;
var maxX = points[0] || 0;
var minY = points[1] || 0;
var maxY = points[1] || 0;
var x, y;
for (var i = 0; i < points.length / 2; i++) {
x = points[i * 2];

View File

@ -631,4 +631,32 @@ suite('TextPath', function() {
);
layer.draw();
});
test('client rect calculations', function() {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var textpath = new Konva.TextPath({
x: 100,
y: 150,
fill: '#333',
fontSize: 16,
fontFamily: 'Arial',
align: 'right',
text: 'test_path',
data: 'M 0,10 L 300 10'
});
layer.add(textpath);
layer.draw();
var rect = textpath.getClientRect();
assert.equal(rect.height, 16, 'check height');
textpath.text('');
rect = textpath.getClientRect();
assert.equal(rect.height, 0, 'check height');
});
});