Jarrod Lofy
Jarrod Lofy

Reputation: 215

Easeljs Shape and Properties

I am having problems understanding creating shapes using easeljs. So I've tried creating a shape then tried to get it properties afterward and all of them seem to be either 0 or null. I wanted to use .getBounds() to get the bounds of the object I created but it seems to return null. This seems pretty straightforward I'm totally missing where I went wrong.

    var target  = new createjs.Shape();
    target.graphics.beginFill("#ff0000").drawRect(100, 100, 300, 100);
    stage.addChild(target);
    var bounds = target.getBounds();
    console.log(bounds);`

Upvotes: 0

Views: 181

Answers (1)

Lanny
Lanny

Reputation: 11294

Shapes do not have bounds, as they are quite complicated and expensive to calculate. You can set bounds on them if you know the rough size, and EaselJS will use that when calculating the size of containers.

http://blog.createjs.com/update-width-height-in-easeljs/

Upvotes: 1

Related Questions