Skip to content

Commit

Permalink
Merge pull request #176 from photonstorm/master
Browse files Browse the repository at this point in the history
Support multiple CNI configuration directories
  • Loading branch information
GulajavaMinistudio committed Apr 7, 2019
2 parents 8353abb + 382fed3 commit 3bb8149
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Notes:
* `Tween.remove` is a new method that immediately removes the Tween from the TweenManager, regardless of what state the tween is in. Once called the tween will no longer exist within any internal TweenManager arrays.
* `SceneManager.isPaused` is a new method that will return if the given Scene is currently paused or not (thanks @samme)
* `ScenePlugin.isPaused` is a new method that will return if the given Scene is currently paused or not (thanks @samme)
* `TextureManager.removeKey` is a new method that will remove a key from the Texture Manager without destroying the texture itself.

### Updates

Expand All @@ -73,6 +74,7 @@ Notes:
* The `Clock.now` property value is now synced to be the `TimeStep.time` value when the Clock plugin boots and is no longer `Date.now()` until the first update (thanks @Antriel)
* `Graphics.strokePoints` has renamed the second argument from `autoClose` to `closeShape`. There is also a new third argument `closePath`, which defaults to `true` and automatically closes the path before stroking it. The `endIndex` argument is now the fourth argument, instead of the third.
* `Graphics.fillPoints` has renamed the second argument from `autoClose` to `closeShape`. There is also a new third argument `closePath`, which defaults to `true` and automatically closes the path before filling it. The `endIndex` argument is now the fourth argument, instead of the third.
* Calling `Texture.destroy` will now call `TextureManager.removeKey` to ensure the key is removed from the manager, should you destroy a texture directly, rather than going via `TextureManager.remove`. Fix #4461 (thanks @BigZaphod)

### Bug Fixes

Expand Down
3 changes: 3 additions & 0 deletions src/textures/Texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ var Texture = new Class({
this.source = [];
this.dataSource = [];
this.frames = {};

this.manager.removeKey(this.key);

this.manager = null;
}

Expand Down
22 changes: 20 additions & 2 deletions src/textures/TextureManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ var TextureManager = new Class({
// By this point key should be a Texture, if not, the following fails anyway
if (this.list.hasOwnProperty(key.key))
{
delete this.list[key.key];

key.destroy();

this.emit(Events.REMOVE, key.key);
Expand All @@ -223,6 +221,26 @@ var TextureManager = new Class({
return this;
},

/**
* Removes a key from the Texture Manager but does not destroy the Texture that was using the key.
*
* @method Phaser.Textures.TextureManager#removeKey
* @since 3.17.0
*
* @param {string} key - The key to remove from the texture list.
*
* @return {Phaser.Textures.TextureManager} The Texture Manager.
*/
removeKey: function (key)
{
if (this.list.hasOwnProperty(key))
{
delete this.list[key];
}

return this;
},

/**
* Adds a new Texture to the Texture Manager created from the given Base64 encoded data.
*
Expand Down

0 comments on commit 3bb8149

Please sign in to comment.