0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-24 13:29:01 -05:00

fixed issue with Matter.RenderPixi not being cleared when bodies removed, closes #218

This commit is contained in:
liabru 2016-06-25 18:20:10 +01:00
parent ad033f5255
commit 4972af847e
2 changed files with 7 additions and 1 deletions

View file

@ -158,7 +158,7 @@ var Common = require('./Common');
&& engine.render
&& engine.render.controller
&& engine.render.controller.clear) {
engine.render.controller.clear(engine.render);
engine.render.controller.clear(engine.render); // @deprecated
}
// update

View file

@ -13,6 +13,7 @@ module.exports = RenderPixi;
var Composite = require('../body/Composite');
var Common = require('../core/Common');
var Events = require('../core/Events');
(function() {
@ -98,6 +99,11 @@ var Common = require('../core/Common');
}
};
// event listeners
Events.on(render.engine, 'beforeUpdate', function() {
RenderPixi.clear(render);
});
// caches
render.textures = {};
render.sprites = {};