Here I have drawn some arcs using Konvajs library, but I cannot get their width and height after the objects have been drawn, How can I do that? for quick read of code:
function drawSurface(idnumber, radius, x, y, startAngleParam, endAngleParam) {
var borderbold = 5;
var surface;
if (typeof startAngleParam !== 'undefined') {
surface = new Konva.Shape({
x: x,
y: y,
fill: '#ccc',
stroke: "#ccc",
strokeWidth: 8,
id: idnumber,
opacity: 1,
drawFunc: function (context) {
var startAngle = startAngleParam * Math.PI;
var endAngle = (startAngleParam + 0.5 + endAngleParam) * Math.PI;
var counterClockwise = false;
context.beginPath();
context.arc(0, 0, radius, startAngle, endAngle, counterClockwise);
context.setAttr("lineWidth", borderbold);
context.stroke();
context.fillStrokeShape(this);
}
});
}
else {
surface = new Konva.Circle({
x: x,
y: y,
radius: radius,
fill: '#ccc',
strokeWidth: 3,
id: idnumber,
opacity: 1
});
}
return surface;
}
Please support your answer with a code example.