Skip to content

Commit 7b4d6a6

Browse files
committed
fixed getLocalBounds() to return the bounds of the DisplayObject without transformations and adjusted width and height to work the way they did before to be compatible with how PIXI used to work.
1 parent cf9aeae commit 7b4d6a6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/pixi/display/DisplayObjectContainer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,14 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function (targetCoordinateSpac
435435
};
436436

437437
/**
438-
* Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration.
438+
* Retrieves the non-global local bounds of the displayObjectContainer as a rectangle without any transformations. The calculation takes all visible children into consideration.
439439
*
440440
* @method getLocalBounds
441441
* @return {Rectangle} The rectangular bounding area
442442
*/
443443
PIXI.DisplayObjectContainer.prototype.getLocalBounds = function () {
444444

445-
return this.getBounds(this.parent);
445+
return this.getBounds(this);
446446

447447
};
448448

@@ -577,7 +577,7 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function (renderSession) {
577577
Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
578578

579579
get: function() {
580-
return this.getLocalBounds().width;
580+
return this.getLocalBounds().width + this.scale.x;
581581
},
582582

583583
set: function(value) {
@@ -606,7 +606,7 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
606606
Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
607607

608608
get: function() {
609-
return this.getLocalBounds().height;
609+
return this.getLocalBounds().height * this.scale.y;
610610
},
611611

612612
set: function(value) {

0 commit comments

Comments
 (0)