Skip to content

Commit

Permalink
fix issue with mouse when changing renderers, closes #96
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed May 24, 2015
1 parent 42dc72d commit 796faeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions demo/js/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions demo/js/lib/matter-tools/matter-tools-dev.js
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 796faeb

Please sign in to comment.