Added new argument removeFromTilemap

This commit is contained in:
Richard Davey 2019-04-08 15:59:30 +01:00
parent d63321eba5
commit 0514d27efc
2 changed files with 18 additions and 4 deletions

View file

@ -451,16 +451,23 @@ var DynamicTilemapLayer = new Class({
*
* @method Phaser.Tilemaps.DynamicTilemapLayer#destroy
* @since 3.0.0
*
* @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap?
*/
destroy: function ()
destroy: function (removeFromTilemap)
{
if (removeFromTilemap === undefined) { removeFromTilemap = true; }
// Uninstall this layer only if it is still installed on the LayerData object
if (this.layer.tilemapLayer === this)
{
this.layer.tilemapLayer = undefined;
}
this.tilemap.removeLayer(this);
if (removeFromTilemap)
{
this.tilemap.removeLayer(this);
}
this.tilemap = undefined;
this.layer = undefined;

View file

@ -1439,16 +1439,23 @@ var StaticTilemapLayer = new Class({
*
* @method Phaser.Tilemaps.StaticTilemapLayer#destroy
* @since 3.0.0
*
* @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap?
*/
destroy: function ()
destroy: function (removeFromTilemap)
{
if (removeFromTilemap === undefined) { removeFromTilemap = true; }
// Uninstall this layer only if it is still installed on the LayerData object
if (this.layer.tilemapLayer === this)
{
this.layer.tilemapLayer = undefined;
}
this.tilemap.removeLayer(this);
if (removeFromTilemap)
{
this.tilemap.removeLayer(this);
}
this.tilemap = undefined;
this.layer = undefined;