0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-27 13:59:01 -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, mouse: mouse,
dragBody: null, dragBody: null,
dragPoint: null, dragPoint: null,
constraints: [constraint] constraint: constraint
}; };
}; };
@ -43,7 +43,7 @@ var MouseConstraint = {};
*/ */
MouseConstraint.update = function(mouseConstraint, bodies) { MouseConstraint.update = function(mouseConstraint, bodies) {
var mouse = mouseConstraint.mouse, var mouse = mouseConstraint.mouse,
constraint = mouseConstraint.constraints[0]; constraint = mouseConstraint.constraint;
if (mouse.button === 0 || mouse.button === 2) { if (mouse.button === 0 || mouse.button === 2) {
if (!constraint.bodyB) { if (!constraint.bodyB) {

View file

@ -71,7 +71,7 @@ var Engine = {};
engine.metrics = engine.metrics || Metrics.create(); engine.metrics = engine.metrics || Metrics.create();
engine.input.mouse = engine.input.mouse || Mouse.create(engine.render.canvas); engine.input.mouse = engine.input.mouse || Mouse.create(engine.render.canvas);
engine.mouseConstraint = engine.mouseConstraint || MouseConstraint.create(engine.input.mouse); 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 || { engine.broadphase = engine.broadphase || {
current: 'grid', current: 'grid',
@ -340,7 +340,7 @@ var Engine = {};
engine.pairs.table = {}; engine.pairs.table = {};
engine.pairs.list = []; engine.pairs.list = [];
World.addComposite(engine.world, engine.mouseConstraint); World.addConstraint(engine.world, engine.mouseConstraint.constraint);
var broadphase = engine.broadphase[engine.broadphase.current]; var broadphase = engine.broadphase[engine.broadphase.current];