Skip to content

Commit 7b8a430

Browse files
committed
TilemapLayer docs incorrectly reported it as extending Phaser.Image, but it doesn't share the same components so has been updated.
TilemapLayer was missing the Input component (thanks @uhe1231 phaserjs#1700)
1 parent 04cb388 commit 7b8a430

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ Version 2.3.1 - "Katar" - in dev
265265
* The version of p2.js being used in 2.3.0 wasn't correctly declaring itself as a global for browserify / requireJS. This update resolves that (thanks @dgoemans #1723)
266266
* AnimationManager.frameName setter wasn't checking if `_frameData` existed before accessing it (thanks @nesukun #1727)
267267
* P2.getConstraints would return an array of null objects. It now returns the raw p2 constraint objects (thanks @valueerrorx #1726)
268+
* TilemapLayer docs incorrectly reported it as extending Phaser.Image, but it doesn't share the same components so has been updated.
269+
* TilemapLayer was missing the Input component (thanks @uhe1231 #1700)
268270

269271
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
270272

src/tilemap/TilemapLayer.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@
1212
* By default TilemapLayers have fixedToCamera set to `true`. Changing this will break Camera follow and scrolling behavior.
1313
*
1414
* @class Phaser.TilemapLayer
15-
* @extends {Phaser.Image}
15+
* @extends PIXI.Sprite
16+
* @extends Phaser.Component.Core
17+
* @extends Phaser.Component.Bounds
18+
* @extends Phaser.Component.BringToTop
19+
* @extends Phaser.Component.Destroy
20+
* @extends Phaser.Component.FixedToCamera
21+
* @extends Phaser.Component.InputEnabled
22+
* @extends Phaser.Component.Reset
23+
* @extends Phaser.Component.Smoothed
1624
* @constructor
1725
* @param {Phaser.Game} game - Game reference to the currently running game.
1826
* @param {Phaser.Tilemap} tilemap - The tilemap to which this layer belongs.
@@ -261,15 +269,18 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
261269
Phaser.TilemapLayer.prototype = Object.create(PIXI.Sprite.prototype);
262270
Phaser.TilemapLayer.prototype.constructor = Phaser.TilemapLayer;
263271

264-
var components = [
272+
Phaser.Component.Core.install.call(Phaser.TilemapLayer.prototype, [
265273
'Bounds',
274+
'BringToTop',
266275
'Destroy',
267276
'FixedToCamera',
277+
'InputEnabled',
268278
'Reset',
269279
'Smoothed'
270-
];
280+
]);
271281

272-
Phaser.Component.Core.install.call(Phaser.TilemapLayer.prototype, components);
282+
Phaser.TilemapLayer.prototype.preUpdateCore = Phaser.Component.Core.preUpdate;
283+
Phaser.TilemapLayer.prototype.postUpdateCore = Phaser.Component.Core.postUpdate;
273284

274285
/**
275286
* The shared double-copy canvas, created as needed.
@@ -306,9 +317,7 @@ Phaser.TilemapLayer.ensureSharedCopyCanvas = function () {
306317
*/
307318
Phaser.TilemapLayer.prototype.preUpdate = function() {
308319

309-
Phaser.Component.Core.preUpdate.call(this);
310-
311-
return true;
320+
return this.preUpdateCore();
312321

313322
};
314323

@@ -320,7 +329,7 @@ Phaser.TilemapLayer.prototype.preUpdate = function() {
320329
*/
321330
Phaser.TilemapLayer.prototype.postUpdate = function () {
322331

323-
Phaser.Component.Core.prototype.postUpdate.call(this);
332+
this.postUpdateCore();
324333

325334
// Stops you being able to auto-scroll the camera if it's not following a sprite
326335
var camera = this.game.camera;

0 commit comments

Comments
 (0)