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:
parent
71261c21bf
commit
e2e94e08e6
@ -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
|
||||
|
||||
|
18
konva.js
18
konva.js
@ -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
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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];
|
||||
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user