I'm trying to get the width of a node shape in kineticjs. I'm doing this:
var node = left.find('Rect');
var width = node.width()
console.log(width);
and left is a group that has a Rect.
var shape = new Kinetic.Rect({
x: 0,
y: 0,
width: C_EC_WIDTH,
height: C_EC_WIDTH,
fill: viewcolor,
stroke: "black",
strokeWidth: 1
});
left.add(shape);
But I always get this result:
I have tried getWidth(), setWidth(100), width() and width(100). The width(100) and setWidth(100) worked properly. But the others not! I can not have access to the width of the shape, I always get the object!
What am I doing wrong?
Edit:
Tried this:
var width = node.width().width().width();
and have the same result. It returns the kinetic object! I have no idea why! It is not making any sense for me.