There is no "event" for closed drawing. If you want to detect if a line is closed when the drawing is finished, you can just check the positions of the first and the last points on the line. If they are too close - then you can make a closed shape.
Following Free drawing demo:
stage.on('mouseup touchend', function () {
isPaint = false;
const points = lastLine.points();
const p1 = {x: points[0], y: points[1]};
const p2 = {x: points[points.length - 2], y: points[points.length - 1]};
const dist = Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
if (dist < 10) {
lastLine.closed(true);
}
layer.draw();
});
Non react demo: https://jsbin.com/cijobitaza/edit?html,js,output
But you can do something very similar with react
.