diff --git a/src/display/canvas/CanvasPool.js b/src/display/canvas/CanvasPool.js index 659e83cfe..3572717ee 100644 --- a/src/display/canvas/CanvasPool.js +++ b/src/display/canvas/CanvasPool.js @@ -36,14 +36,16 @@ var CanvasPool = function () * @param {integer} [width=1] - The width of the Canvas. * @param {integer} [height=1] - The height of the Canvas. * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? * * @return {HTMLCanvasElement} [description] */ - var create = function (parent, width, height, canvasType) + var create = function (parent, width, height, canvasType, selfParent) { if (width === undefined) { width = 1; } if (height === undefined) { height = 1; } if (canvasType === undefined) { canvasType = CONST.CANVAS; } + if (selfParent === undefined) { selfParent = false; } var canvas; var container = first(canvasType); @@ -70,6 +72,11 @@ var CanvasPool = function () canvas = container.canvas; } + if (selfParent) + { + container.parent = canvas; + } + canvas.width = width; canvas.height = height;