Kaushal Cavale
Kaushal Cavale

Reputation: 25

Createjs : Container.getBounds() and Container.getTransformedBounds() returns null

I have a container and I have added a couple of bitmaps to it and scaled the whole container. Now when I call getTransformedBounds() on it, it returns null.

   let innerContainer = new createjs.Container();
   innerContainer.addChild(bitmap1);
   innerContainer.addChild(bitmap2);
   innerContainer.scaleX=scale;
   innerContainer.scaleY=scale;
   let phBounds = innerContainer.getTransformedBounds();   

Here phBounds is null. It was working all these days. Suddenly today it is returning null. Strange. Any help greatly appreciated.

Upvotes: 0

Views: 576

Answers (1)

gskinner
gskinner

Reputation: 2488

Did you wait for the Bitmap image to load? If not, the bounds will be null because there is no content to measure. I wrote a quick test, and everything looks like its working fine:

https://codepen.io/gskinner/pen/bWEoaQ

Upvotes: 1

Related Questions