From 2c601093bf54a8d2c4a347b0d0dbebf07c9f5f5c Mon Sep 17 00:00:00 2001 From: liabru Date: Mon, 28 Apr 2014 17:02:28 +0100 Subject: [PATCH] added Composite.move --- src/body/Composite.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/body/Composite.js b/src/body/Composite.js index 441ecb2..8d9464c 100644 --- a/src/body/Composite.js +++ b/src/body/Composite.js @@ -393,4 +393,18 @@ var Composite = {}; return object.length === 0 ? null : object[0]; }; + /** + * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add) + * @method move + * @param {compositeA} compositeA + * @param {object[]} objects + * @param {compositeB} compositeB + * @return {composite} Returns compositeA + */ + Composite.move = function(compositeA, objects, compositeB) { + Composite.remove(compositeA, objects); + Composite.add(compositeB, objects); + return compositeA; + }; + })(); \ No newline at end of file