From 5f7d3fa4a1d7fa3a774eb82667fb141cd85dc318 Mon Sep 17 00:00:00 2001 From: Matt Chiasson Date: Sat, 7 Apr 2018 17:51:51 -0400 Subject: [PATCH] closes #3520 Phaser.Display.Canvas.CanvasPool.first now returns the available pool item instead of always returning null. --- src/display/canvas/CanvasPool.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/display/canvas/CanvasPool.js b/src/display/canvas/CanvasPool.js index bcf7ea283..8c7ac15e8 100644 --- a/src/display/canvas/CanvasPool.js +++ b/src/display/canvas/CanvasPool.js @@ -126,13 +126,13 @@ var CanvasPool = function () { if (canvasType === undefined) { canvasType = CONST.CANVAS; } - pool.forEach(function (container) - { + for (var i = 0, len = pool.length; i < len; i++) { + var container = pool[i]; if (!container.parent && container.type === canvasType) { return container; } - }); + }; return null; };