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:
Bugi Görtz 2018-03-15 17:12:06 +01:00
parent 5af8e745d1
commit b977f096f8
2 changed files with 7 additions and 7 deletions

View file

@ -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];
} }
} }

View file

@ -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;
}, },