From 016fda7660349be1141ec48edc5dd5bcd7339e81 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Thu, 23 Nov 2017 16:55:28 +0000 Subject: [PATCH] Added imageStack Factory function. --- v3/src/physics/matter-js/Factory.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/v3/src/physics/matter-js/Factory.js b/v3/src/physics/matter-js/Factory.js index 1af5d9cf9..4af6ba02b 100644 --- a/v3/src/physics/matter-js/Factory.js +++ b/v3/src/physics/matter-js/Factory.js @@ -72,6 +72,31 @@ var Factory = new Class({ return body; }, + imageStack: function (key, frame, x, y, columns, rows, columnGap, rowGap, options) + { + if (columnGap === undefined) { columnGap = 0; } + if (rowGap === undefined) { rowGap = 0; } + if (options === undefined) { options = {}; } + + var world = this.world; + var displayList = this.sys.displayList; + + options.addToWorld = false; + + var stack = Composites.stack(x, y, columns, rows, columnGap, rowGap, function (x, y) + { + var image = new MatterImage(world, x, y, key, frame, options); + + displayList.add(image); + + return image.body; + }); + + world.add(stack); + + return stack; + }, + stack: function (x, y, columns, rows, columnGap, rowGap, callback) { var stack = Composites.stack(x, y, columns, rows, columnGap, rowGap, callback);