mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Merge branch 'master' of https://github.com/phaserjs/phaser
This commit is contained in:
commit
f7049fe831
9 changed files with 48 additions and 20 deletions
|
@ -9,12 +9,15 @@
|
||||||
* 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 `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)
|
* 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)
|
* `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` and `TileSprite` Game Objects now place their textures into the global `TextureManager` and a `_textureKey` private string property has been added which contains a UUID to reference that texture.
|
||||||
|
|
||||||
# Bug Fixes
|
# Bug Fixes
|
||||||
|
|
||||||
* The `InputManager.onTouchMove` function has been fixed so it now correctly handles touch events on pages that have scrolled horizontally or vertically and shifted the viewport. Fix #6489 (thanks @somechris @hyewonjo)
|
* The `InputManager.onTouchMove` function has been fixed so it now correctly handles touch events on pages that have scrolled horizontally or vertically and shifted the viewport. Fix #6489 (thanks @somechris @hyewonjo)
|
||||||
* `Factory.staticBody` had the wrong return type in the docs/TS defs. Fix #6693 (thanks @ddhaiby)
|
* `Factory.staticBody` had the wrong return type in the docs/TS defs. Fix #6693 (thanks @ddhaiby)
|
||||||
* The `Time.Timeline` class didn't show as extending the Event Emitter, or have `config` as an optional argument in the docs / TS defs. Fix #6673 (thanks @ghclark2)
|
* The `Time.Timeline` class didn't show as extending the Event Emitter, or have `config` as an optional argument in the docs / TS defs. Fix #6673 (thanks @ghclark2)
|
||||||
|
* `Animations.AnimationFrame#duration` is now the complete duration of the frame. Before this included `Animations.AnimationState#msPerFrame` with the value of `Animations.AnimationFrame#duration`. The fix to remove `Animations.AnimationState#msPerFrame` from `Animations.AnimationFrame#duration` has been removed from `Animations.AnimationManager#createFromAseprite` because of this clarification. Fix #6712 (thanks @Nerodon @TomMalitz)
|
||||||
|
* The `NineSlice` Game Object method `setSize` now recalculates its origin by calling the `updateDisplayOrigin` method. (thanks @dhashvir)
|
||||||
|
|
||||||
## Examples, Documentation, Beta Testing and TypeScript
|
## Examples, Documentation, Beta Testing and TypeScript
|
||||||
|
|
||||||
|
@ -23,4 +26,4 @@ My thanks to the following for helping with the Phaser 3 Examples, Beta Testing,
|
||||||
@AlvaroEstradaDev
|
@AlvaroEstradaDev
|
||||||
@stevenwithaph
|
@stevenwithaph
|
||||||
@paxperscientiam
|
@paxperscientiam
|
||||||
|
@samme
|
||||||
|
|
|
@ -362,7 +362,7 @@ var Animation = new Class({
|
||||||
// When is the first update due?
|
// When is the first update due?
|
||||||
state.accumulator = 0;
|
state.accumulator = 0;
|
||||||
|
|
||||||
state.nextTick = state.msPerFrame + state.currentFrame.duration;
|
state.nextTick = (state.currentFrame.duration) ? state.currentFrame.duration : state.msPerFrame;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -515,7 +515,7 @@ var Animation = new Class({
|
||||||
{
|
{
|
||||||
state.accumulator -= state.nextTick;
|
state.accumulator -= state.nextTick;
|
||||||
|
|
||||||
state.nextTick = state.msPerFrame + state.currentFrame.duration;
|
state.nextTick = (state.currentFrame.duration) ? state.currentFrame.duration : state.msPerFrame;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -115,8 +115,7 @@ var AnimationFrame = new Class({
|
||||||
this.nextFrame = null;
|
this.nextFrame = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional time (in ms) that this frame should appear for during playback.
|
* The duration, in ms, of this frame of the animation.
|
||||||
* The value is added onto the msPerFrame set by the animation.
|
|
||||||
*
|
*
|
||||||
* @name Phaser.Animations.AnimationFrame#duration
|
* @name Phaser.Animations.AnimationFrame#duration
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
|
|
@ -451,14 +451,6 @@ var AnimationManager = new Class({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix duration to play nice with how the next tick is calculated.
|
|
||||||
var msPerFrame = totalDuration / animFrames.length;
|
|
||||||
|
|
||||||
animFrames.forEach(function (entry)
|
|
||||||
{
|
|
||||||
entry.duration -= msPerFrame;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (direction === 'reverse')
|
if (direction === 'reverse')
|
||||||
{
|
{
|
||||||
animFrames = animFrames.reverse();
|
animFrames = animFrames.reverse();
|
||||||
|
|
|
@ -840,6 +840,8 @@ var NineSlice = new Class({
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
|
this.updateDisplayOrigin();
|
||||||
|
|
||||||
var input = this.input;
|
var input = this.input;
|
||||||
|
|
||||||
if (input && !input.customHitArea)
|
if (input && !input.customHitArea)
|
||||||
|
|
|
@ -14,6 +14,7 @@ var GetValue = require('../../utils/object/GetValue');
|
||||||
var RemoveFromDOM = require('../../dom/RemoveFromDOM');
|
var RemoveFromDOM = require('../../dom/RemoveFromDOM');
|
||||||
var TextRender = require('./TextRender');
|
var TextRender = require('./TextRender');
|
||||||
var TextStyle = require('./TextStyle');
|
var TextStyle = require('./TextStyle');
|
||||||
|
var UUID = require('../../utils/string/UUID');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
|
@ -261,8 +262,18 @@ var Text = new Class({
|
||||||
*/
|
*/
|
||||||
this._crop = this.resetCropObject();
|
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
|
// 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
|
// Set the context to be the CanvasTexture context
|
||||||
this.context = this.texture.context;
|
this.context = this.texture.context;
|
||||||
|
@ -1520,7 +1531,12 @@ var Text = new Class({
|
||||||
|
|
||||||
CanvasPool.remove(this.canvas);
|
CanvasPool.remove(this.canvas);
|
||||||
|
|
||||||
this.texture.destroy();
|
var texture = this.texture;
|
||||||
|
|
||||||
|
if (texture)
|
||||||
|
{
|
||||||
|
texture.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,6 +11,7 @@ var GameObject = require('../GameObject');
|
||||||
var GetPowerOfTwo = require('../../math/pow2/GetPowerOfTwo');
|
var GetPowerOfTwo = require('../../math/pow2/GetPowerOfTwo');
|
||||||
var Smoothing = require('../../display/canvas/Smoothing');
|
var Smoothing = require('../../display/canvas/Smoothing');
|
||||||
var TileSpriteRender = require('./TileSpriteRender');
|
var TileSpriteRender = require('./TileSpriteRender');
|
||||||
|
var UUID = require('../../utils/string/UUID');
|
||||||
var Vector2 = require('../../math/Vector2');
|
var Vector2 = require('../../math/Vector2');
|
||||||
|
|
||||||
// bitmask flag for GameObject.renderMask
|
// bitmask flag for GameObject.renderMask
|
||||||
|
@ -219,6 +220,16 @@ var TileSprite = new Class({
|
||||||
*/
|
*/
|
||||||
this._crop = this.resetCropObject();
|
this._crop = this.resetCropObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The internal unique key to refer to the texture in the TextureManager.
|
||||||
|
*
|
||||||
|
* @name Phaser.GameObjects.TileSprite#_textureKey
|
||||||
|
* @type {string}
|
||||||
|
* @private
|
||||||
|
* @since 3.80.0
|
||||||
|
*/
|
||||||
|
this._textureKey = UUID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Texture this Game Object is using to render with.
|
* The Texture this Game Object is using to render with.
|
||||||
*
|
*
|
||||||
|
@ -226,7 +237,7 @@ var TileSprite = new Class({
|
||||||
* @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture}
|
* @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this.texture = scene.sys.textures.addCanvas(null, this.canvas, true);
|
this.texture = scene.sys.textures.addCanvas(this._textureKey, this.canvas);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Texture Frame this Game Object is using to render with.
|
* The Texture Frame this Game Object is using to render with.
|
||||||
|
@ -556,7 +567,12 @@ var TileSprite = new Class({
|
||||||
this.displayTexture = null;
|
this.displayTexture = null;
|
||||||
this.displayFrame = null;
|
this.displayFrame = null;
|
||||||
|
|
||||||
this.texture.destroy();
|
var texture = this.texture;
|
||||||
|
|
||||||
|
if (texture)
|
||||||
|
{
|
||||||
|
texture.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
this.renderer = null;
|
this.renderer = null;
|
||||||
},
|
},
|
||||||
|
|
|
@ -577,7 +577,7 @@ var SceneManager = new Class({
|
||||||
sys.step(time, delta);
|
sys.step(time, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sys.scenePlugin._target)
|
if (sys.scenePlugin && sys.scenePlugin._target)
|
||||||
{
|
{
|
||||||
sys.scenePlugin.step(time, delta);
|
sys.scenePlugin.step(time, delta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,7 @@ var Tilemap = new Class({
|
||||||
|
|
||||||
if (!this.scene.sys.textures.exists(key))
|
if (!this.scene.sys.textures.exists(key))
|
||||||
{
|
{
|
||||||
console.warn('Invalid Tileset Image: ' + key);
|
console.warn('Texture key "%s" not found', key);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ var Tilemap = new Class({
|
||||||
|
|
||||||
if (index === null && this.format === Formats.TILED_JSON)
|
if (index === null && this.format === Formats.TILED_JSON)
|
||||||
{
|
{
|
||||||
console.warn('No data found for Tileset: ' + tilesetName);
|
console.warn('Tilemap has no tileset "%s". Its tilesets are %o', tilesetName, this.tilesets);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue