Skip to content

Commit

Permalink
remove listener on resize
Browse files Browse the repository at this point in the history
this is unexpected behaviour and produces rendering artefacts as well
  • Loading branch information
FlorianLudwig committed Sep 29, 2015
1 parent 37ae9d1 commit b8716de
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 74 deletions.
36 changes: 1 addition & 35 deletions bin/gown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/gown.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bin/gown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/gown.min.js.map

Large diffs are not rendered by default.

36 changes: 1 addition & 35 deletions src/utils/ScaleContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,51 +75,17 @@ function ScaleContainer(texture, rect) {
this.br = this._getTexture(lw + mw, th + ch, rw, bh);
this.addChild(this.br);
}


// apply scaling when the window gets resized using worldTansformation
var scope = this;
window.addEventListener('resize', function() {
scope._applyScales('tl', scope.tl);
scope._applyScales('tm', scope.tm);
scope._applyScales('tr', scope.tr);

scope._applyScales('cl', scope.cl);
scope._applyScales('cm', scope.cm);
scope._applyScales('cr', scope.cr);

scope._applyScales('bl', scope.bl);
scope._applyScales('bm', scope.bm);
scope._applyScales('br', scope.br);
});
}

// constructor
ScaleContainer.prototype = Object.create( PIXI.Container.prototype );
ScaleContainer.prototype.constructor = ScaleContainer;
module.exports = ScaleContainer;

/**
* apply scaling when the window gets resized using worldTansformation
*
* @method _applyScales
* @private
*/
ScaleContainer.prototype._applyScales = function(name, elem) {
if (this.scaleOriginals[name]) {
elem.width = (Math.ceil(this.scaleOriginals[name].width *
this.worldTransform.a) /
this.worldTransform.a);
elem.height = (Math.ceil(this.scaleOriginals[name].height *
this.worldTransform.d) /
this.worldTransform.d);
}
};

/**
* set scaling width and height
*
* @method _applyScales
* @method _updateScales
* @private
*/
ScaleContainer.prototype._updateScales = function() {
Expand Down

0 comments on commit b8716de

Please sign in to comment.