Skip to content

Update DisplayObject.js - #543

Open
yar3333 wants to merge 1 commit into
CreateJS:masterfrom
yar3333:patch-1
Open

Update DisplayObject.js#543
yar3333 wants to merge 1 commit into
CreateJS:masterfrom
yar3333:patch-1

Conversation

@yar3333

@yar3333 yar3333 commented Dec 26, 2014

Copy link
Copy Markdown
Contributor

Fix: case setBounds(null) (don't do "this._bounds = new createjs.Rectangle" after "this._bounds = null").
Maybe we need also always create new rectangle, not using old _bounds (or always return cloned rectangle from getBounds())?
In my project I got several bugs related to next code:
var boundsToUseLater = myObj.getBounds(); // save current bounds
// some code (change myObj then call getBounds())
// use boundsToUseLater - properties x/y/widht/height not the same as they were the save moment

Fix: case setBounds(null)  (don't do "this._bounds = new createjs.Rectangle" after "this._bounds = null").
Maybe we need also always create new rectangle, not using old _bounds (or always return cloned rectangle from getBounds())?
In my project I got several bugs related to next code:
var boundsToUseLater = myObj.getBounds(); // save current bounds
// some code (change myObj then call getBounds())
// use boundsToUseLater - properties x/y/widht/height not the same as they were the save moment
@JonnyCodes

JonnyCodes commented Nov 22, 2017

Copy link
Copy Markdown

Shouldn't the bounds be null if any of those properties (x, y, width or height) are null?
Edit: Just seen how old this pull request is!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants