mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-25 13:39:06 -05:00
fix demo for tests
This commit is contained in:
parent
a48d219dfe
commit
5e6b22b0c8
2 changed files with 6 additions and 7 deletions
|
@ -573,7 +573,7 @@
|
|||
|
||||
// use the engine tick event to control our view
|
||||
_sceneEvents.push(
|
||||
Events.on(_runner, 'beforeTick', function() {
|
||||
Events.on(_engine, 'beforeTick', function() {
|
||||
var world = _engine.world,
|
||||
mouse = _mouseConstraint.mouse,
|
||||
render = _engine.render,
|
||||
|
@ -1738,7 +1738,7 @@
|
|||
Events.off(_world, _sceneEvents[i]);
|
||||
}
|
||||
|
||||
if (_runner.events) {
|
||||
if (_runner && _runner.events) {
|
||||
for (i = 0; i < _sceneEvents.length; i++)
|
||||
Events.off(_runner, _sceneEvents[i]);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ var update = arg('--update'),
|
|||
updateAll = typeof arg('--updateAll') !== 'undefined',
|
||||
diff = arg('--diff');
|
||||
|
||||
var resurrect = new Resurrect({ cleanup: true }),
|
||||
var resurrect = new Resurrect({ cleanup: true, revive: false }),
|
||||
created = [],
|
||||
changed = [];
|
||||
|
||||
|
@ -60,12 +60,11 @@ var test = function(status) {
|
|||
}, demo);
|
||||
|
||||
var worldEnd = page.evaluate(function(demo, frames) {
|
||||
var engine = Matter.Demo._engine;
|
||||
var engine = Matter.Demo._engine,
|
||||
runner = Matter.Runner.create();
|
||||
|
||||
for (var j = 0; j <= frames; j += 1) {
|
||||
Matter.Events.trigger(engine, 'tick', { timestamp: engine.timing.timestamp });
|
||||
Matter.Engine.update(engine, engine.timing.delta);
|
||||
Matter.Events.trigger(engine, 'afterTick', { timestamp: engine.timing.timestamp });
|
||||
Matter.Runner.tick(runner, engine, j * runner.delta);
|
||||
}
|
||||
|
||||
return engine.world;
|
||||
|
|
Loading…
Reference in a new issue