mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
fix calculations
This commit is contained in:
parent
7f62ccf620
commit
e112c14852
@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## Not released:
|
||||
|
||||
* Fix line with tension calculations
|
||||
|
||||
## 4.1.2 - 2020-01-08
|
||||
|
||||
* Fix possible `NaN` in content calculations
|
||||
|
2
konva.js
2
konva.js
@ -9847,7 +9847,7 @@
|
||||
points[1]
|
||||
], this._getTensionPoints(), [
|
||||
points[points.length - 2],
|
||||
points[points.length - 2]
|
||||
points[points.length - 1]
|
||||
]);
|
||||
}
|
||||
else {
|
||||
|
@ -199,8 +199,8 @@ export class Line<Config extends LineConfig = LineConfig> extends Shape<
|
||||
points[0],
|
||||
points[1],
|
||||
...this._getTensionPoints(),
|
||||
points[points.length - 1],
|
||||
points[points.length - 2]
|
||||
points[points.length - 2],
|
||||
points[points.length - 1]
|
||||
];
|
||||
} else {
|
||||
points = this.points();
|
||||
|
@ -291,6 +291,7 @@ suite('Line', function() {
|
||||
|
||||
test('getClientRect with tension', function() {
|
||||
var stage = addStage();
|
||||
stage.draggable(true);
|
||||
var layer = new Konva.Layer();
|
||||
|
||||
var line = new Konva.Line({
|
||||
@ -298,7 +299,7 @@ suite('Line', function() {
|
||||
y: 0,
|
||||
points: [75, 75, 100, 200, 300, 140],
|
||||
tension: 0.5,
|
||||
stroke: '#0f0'
|
||||
stroke: '#0f0',
|
||||
});
|
||||
layer.add(line);
|
||||
|
||||
@ -311,7 +312,7 @@ suite('Line', function() {
|
||||
assert.equal(client.x, 56, 'check x');
|
||||
assert.equal(client.y, 74, 'check y');
|
||||
assert.equal(client.width, 245, 'check width');
|
||||
assert.equal(client.height, 227, 'check height');
|
||||
assert.equal(client.height, 147, 'check height');
|
||||
});
|
||||
|
||||
test('getClientRect with low number of points', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user