0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

added Composite.move

This commit is contained in:
liabru 2014-04-28 17:02:28 +01:00
parent 59b26132ca
commit 2c601093bf

View file

@ -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;
};
})();