diff --git a/demo/js/Demo.js b/demo/js/Demo.js index c99c19f..ab1e71a 100644 --- a/demo/js/Demo.js +++ b/demo/js/Demo.js @@ -1610,6 +1610,11 @@ _mouseConstraint = MouseConstraint.create(_engine); 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 diff --git a/demo/js/lib/matter-tools/matter-tools-dev.js b/demo/js/lib/matter-tools/matter-tools-dev.js index 44aeccf..93b5bfb 100644 --- a/demo/js/lib/matter-tools/matter-tools-dev.js +++ b/demo/js/lib/matter-tools/matter-tools-dev.js @@ -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 * License: MIT */ @@ -236,7 +236,7 @@ options:options }); engine.render.options = options; - Mouse.setElement(engine.input.mouse, engine.render.canvas); + Events.trigger(gui, "setRenderer"); }; var _addBody = function(gui) { var engine = gui.engine;