fix non-closed hit for Konva.Path. close #867

This commit is contained in:
Anton Lavrenov
2020-03-12 09:27:42 -05:00
parent 2019f8042b
commit b7b50f22d8
5 changed files with 64 additions and 5 deletions

View File

@@ -53,6 +53,7 @@ export class Path extends Shape<PathConfig> {
// context position
context.beginPath();
var isClosed = false;
for (var n = 0; n < ca.length; n++) {
var c = ca[n].command;
var p = ca[n].points;
@@ -93,12 +94,17 @@ export class Path extends Shape<PathConfig> {
break;
case 'z':
isClosed = true;
context.closePath();
break;
}
}
context.fillStrokeShape(this);
if (!isClosed && !this.hasFill()) {
context.strokeShape(this);
} else {
context.fillStrokeShape(this);
}
}
getSelfRect() {
var points = [];