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

fix issue with mouse when changing renderers, closes #96

This commit is contained in:
liabru 2015-05-24 14:21:24 +01:00
parent 42dc72dabe
commit 796faeb069
2 changed files with 7 additions and 2 deletions

View file

@ -1610,6 +1610,11 @@
_mouseConstraint = MouseConstraint.create(_engine); _mouseConstraint = MouseConstraint.create(_engine);
World.add(_engine.world, _mouseConstraint); World.add(_engine.world, _mouseConstraint);
}); });
// need to rebind mouse on render change
Events.on(_gui, 'setRenderer', function() {
Mouse.setElement(_mouseConstraint.mouse, _engine.render.canvas);
});
} }
// create a Matter.Inspector // create a Matter.Inspector

View file

@ -1,5 +1,5 @@
/** /**
* matter-tools-dev.min.js 0.5.0-dev 2015-05-03 * matter-tools-dev.min.js 0.5.0-dev 2015-05-24
* https://github.com/liabru/matter-tools * https://github.com/liabru/matter-tools
* License: MIT * License: MIT
*/ */
@ -236,7 +236,7 @@
options:options options:options
}); });
engine.render.options = options; engine.render.options = options;
Mouse.setElement(engine.input.mouse, engine.render.canvas); Events.trigger(gui, "setRenderer");
}; };
var _addBody = function(gui) { var _addBody = function(gui) {
var engine = gui.engine; var engine = gui.engine;