How can I get the center point of a shape like polygon use konva? I need to add some text label to the center of a shape.
You can use shape.getClientRect()
to get bounding client rectangle of the shape.
Then absolute position of the center will be:
const box = shape.getClientRect();
const x = box.x + box.width / 2;
const y = box.y + box.height / 2;