Passing a Frame object to Bob.setFrame would fail, as it expected a string or integer. It now checks the type of object, and if a Frame it checks to make sure it's a Frame belonging to the parent Blitter's texture, and if so sets it. Fix #4516

This commit is contained in:
Richard Davey 2019-05-17 14:00:39 +01:00
parent 3504819b33
commit 9959dce57e
2 changed files with 6 additions and 0 deletions

View file

@ -14,6 +14,7 @@
* Tweens created in a paused state couldn't be started by a call to `play`. Fix #4525 (thanks @TonioParis)
* If both Arcade Physics circle body positions and the delta equaled zero, the `separateCircle` function would cause the position to be set `NaN` (thanks @hizzd)
* The `CameraManager` would incorrectly destroy the `default` Camera in its shutdown method, meaning that if you used a fixed mask camera and stopped then resumed a Scene, the masks would stop working. The default camera is now destroyed only in the `destroy` method. Fix #4520 (thanks @telinc1)
* Passing a Frame object to `Bob.setFrame` would fail, as it expected a string or integer. It now checks the type of object, and if a Frame it checks to make sure it's a Frame belonging to the parent Blitter's texture, and if so sets it. Fix #4516 (thanks @NokFrt)

View file

@ -5,6 +5,7 @@
*/
var Class = require('../../utils/Class');
var Frame = require('../../textures/Frame');
/**
* @classdesc
@ -149,6 +150,10 @@ var Bob = new Class({
{
this.frame = this.parent.frame;
}
else if (frame instanceof Frame && frame.texture === this.parent.texture)
{
this.frame = frame;
}
else
{
this.frame = this.parent.texture.get(frame);