mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 05:14:58 +08:00
Fix line.getClientRect() calculations for line with a tension or low number of points
This commit is contained in:
@@ -185,9 +185,23 @@ export class Line<Config extends LineConfig = LineConfig> extends Shape<
|
||||
}
|
||||
// overload size detection
|
||||
getSelfRect() {
|
||||
var points;
|
||||
var points = this.points();
|
||||
if (points.length < 4) {
|
||||
return {
|
||||
x: points[0] || 0,
|
||||
y: points[1] || 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
if (this.tension() !== 0) {
|
||||
points = this._getTensionPoints();
|
||||
points = [
|
||||
points[0],
|
||||
points[1],
|
||||
...this._getTensionPoints(),
|
||||
points[points.length - 2],
|
||||
points[points.length - 2]
|
||||
];
|
||||
} else {
|
||||
points = this.points();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user