0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-25 13:39:06 -05:00

MouseConstraint is no longer a composite (as it has only one constraint)

This commit is contained in:
liabru 2014-03-19 22:51:21 +00:00
parent 77c995ab5e
commit e4445bc791
2 changed files with 4 additions and 4 deletions

View file

@ -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) {

View file

@ -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];