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:
parent
59b26132ca
commit
2c601093bf
1 changed files with 14 additions and 0 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
})();
|
Loading…
Reference in a new issue