mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
MouseConstraint is no longer a composite (as it has only one constraint)
This commit is contained in:
parent
77c995ab5e
commit
e4445bc791
2 changed files with 4 additions and 4 deletions
|
@ -31,7 +31,7 @@ var MouseConstraint = {};
|
|||
mouse: mouse,
|
||||
dragBody: null,
|
||||
dragPoint: null,
|
||||
constraints: [constraint]
|
||||
constraint: constraint
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,7 @@ var MouseConstraint = {};
|
|||
*/
|
||||
MouseConstraint.update = function(mouseConstraint, bodies) {
|
||||
var mouse = mouseConstraint.mouse,
|
||||
constraint = mouseConstraint.constraints[0];
|
||||
constraint = mouseConstraint.constraint;
|
||||
|
||||
if (mouse.button === 0 || mouse.button === 2) {
|
||||
if (!constraint.bodyB) {
|
||||
|
|
|
@ -71,7 +71,7 @@ var Engine = {};
|
|||
engine.metrics = engine.metrics || Metrics.create();
|
||||
engine.input.mouse = engine.input.mouse || Mouse.create(engine.render.canvas);
|
||||
engine.mouseConstraint = engine.mouseConstraint || MouseConstraint.create(engine.input.mouse);
|
||||
World.addComposite(engine.world, engine.mouseConstraint);
|
||||
World.addConstraint(engine.world, engine.mouseConstraint.constraint);
|
||||
|
||||
engine.broadphase = engine.broadphase || {
|
||||
current: 'grid',
|
||||
|
@ -340,7 +340,7 @@ var Engine = {};
|
|||
engine.pairs.table = {};
|
||||
engine.pairs.list = [];
|
||||
|
||||
World.addComposite(engine.world, engine.mouseConstraint);
|
||||
World.addConstraint(engine.world, engine.mouseConstraint.constraint);
|
||||
|
||||
var broadphase = engine.broadphase[engine.broadphase.current];
|
||||
|
||||
|
|
Loading…
Reference in a new issue