mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Text textures are now stored in the TextureManager
This commit is contained in:
parent
91b2b0c531
commit
6ea40f8b32
2 changed files with 19 additions and 2 deletions
|
@ -9,6 +9,7 @@
|
|||
* The `TweenChainBuilder` was incorrectly setting the `persist` flag on the Chain to `true`, which goes against what the documentation says. It now correctly sets it to `false`. This means if you previously had a Tween Chain that was persisting, it will no longer do so, so add the property to regain the feature.
|
||||
* The `dropped` argument has now been adeded to the documentation for the `DRAG_END` and `GAMEOBJECT_DRAG_END` events (thanks @samme)
|
||||
* `Container.onChildDestroyed` is a new internal method used to destroy Container children. Previously, if you destroyed a Game Object in an exclusive Container, the game object would (momentarily) move onto the Scene display list and emit an ADDED_TO_SCENE event. Also, if you added a Sprite to a non-exclusive Container and stopped the Scene, you would get a TypeError (evaluating 'this.anims.destroy'). This happened because the fromChild argument in the DESTROY event was misinterpreted as destroyChild in the Container's remove(), and the Container was calling the Sprite's destroy() again. (thanks @samme)
|
||||
* The `Text` Game Object now places its texture into the global `TextureManager` and a `_textureKey` private string property has been added to reference that texture.
|
||||
|
||||
# Bug Fixes
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ var GetValue = require('../../utils/object/GetValue');
|
|||
var RemoveFromDOM = require('../../dom/RemoveFromDOM');
|
||||
var TextRender = require('./TextRender');
|
||||
var TextStyle = require('./TextStyle');
|
||||
var UUID = require('../../utils/string/UUID');
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -261,8 +262,18 @@ var Text = new Class({
|
|||
*/
|
||||
this._crop = this.resetCropObject();
|
||||
|
||||
/**
|
||||
* The internal unique key to refer to the texture in the TextureManager.
|
||||
*
|
||||
* @name Phaser.GameObjects.Text#_textureKey
|
||||
* @type {string}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._textureKey = UUID();
|
||||
|
||||
// Create a Texture for this Text object
|
||||
this.texture = scene.sys.textures.addCanvas(null, this.canvas, true);
|
||||
this.texture = scene.sys.textures.addCanvas(this._textureKey, this.canvas);
|
||||
|
||||
// Set the context to be the CanvasTexture context
|
||||
this.context = this.texture.context;
|
||||
|
@ -1520,7 +1531,12 @@ var Text = new Class({
|
|||
|
||||
CanvasPool.remove(this.canvas);
|
||||
|
||||
this.texture.destroy();
|
||||
var texture = this.texture;
|
||||
|
||||
if (texture)
|
||||
{
|
||||
texture.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue