Send layer width/height to PIXI.Tilemap (previously these were ignored and forgotten after the c'tor).

Modify resize to set displayWidth/displayHeight only.
This commit is contained in:
Pete Baron 2016-07-21 17:12:46 +12:00
parent 008de253ce
commit 29c77e10d7

View file

@ -28,9 +28,6 @@ Phaser.TilemapLayerGL = function (game, tilemap, index, width, height) {
this.game = game;
width |= 0;
height |= 0;
/**
* The Tilemap to which this layer is bound.
* @property {Phaser.Tilemap} map
@ -219,7 +216,7 @@ Phaser.TilemapLayerGL = function (game, tilemap, index, width, height) {
// get PIXI textures for each tileset source image
var baseTexture = new PIXI.BaseTexture(tileset.image);
PIXI.Tilemap.call(this, new PIXI.Texture(baseTexture), this.map.width, this.map.height, this._mc.tileset.tileWidth, this._mc.tileset.tileHeight, this.layer);
PIXI.Tilemap.call(this, new PIXI.Texture(baseTexture), width | 0, height | 0, this.map.width, this.map.height, this._mc.tileset.tileWidth, this._mc.tileset.tileHeight, this.layer);
Phaser.Component.Core.init.call(this, game, 0, 0, null, null);
@ -296,24 +293,9 @@ Phaser.TilemapLayerGL.prototype.destroy = function() {
*/
Phaser.TilemapLayerGL.prototype.resize = function (width, height) {
this.texture.frame.resize(width, height);
this.texture.width = width;
this.texture.height = height;
this.texture.crop.width = width;
this.texture.crop.height = height;
this.texture.baseTexture.width = width;
this.texture.baseTexture.height = height;
this.texture.baseTexture.dirty();
this.texture.requiresUpdate = true;
this.texture._updateUvs();
this.displayWidth = width;
this.displayHeight = height;
this.dirty = true;
};
/**