mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
fixed getCamera in CameraManager (2d/3d) to work correctly; forEach()-iterator doesn't return values
(https://hacks.mozilla.org/2015/04/es6-in-depth-iterators-and-the-for-of-loop/)
This commit is contained in:
parent
5af8e745d1
commit
b977f096f8
2 changed files with 7 additions and 7 deletions
|
@ -308,11 +308,11 @@ var CameraManager = new Class({
|
||||||
*/
|
*/
|
||||||
getCamera: function (name)
|
getCamera: function (name)
|
||||||
{
|
{
|
||||||
for (var camera of this.cameras)
|
for (var i = 0; i < this.cameras.length; i++)
|
||||||
{
|
{
|
||||||
if (camera.name === name)
|
if (this.cameras[i].name === name)
|
||||||
{
|
{
|
||||||
return camera;
|
return this.cameras[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,13 +155,13 @@ var CameraManager = new Class({
|
||||||
*/
|
*/
|
||||||
getCamera: function (name)
|
getCamera: function (name)
|
||||||
{
|
{
|
||||||
this.cameras.forEach(function (camera)
|
for (var i = 0; i < this.cameras.length; i++)
|
||||||
{
|
{
|
||||||
if (camera.name === name)
|
if (this.cameras[i].name === name)
|
||||||
{
|
{
|
||||||
return camera;
|
return this.cameras[i];
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue