mirror of
https://github.com/liabru/matter-js.git
synced 2025-01-31 18:14:55 -05:00
Make beforeRender can draw something to canvas
```js Events.on(_render, 'beforeRender', function(event) { // draw somethings to canvas has lower z-index... }); ```
This commit is contained in:
parent
2ec247b7af
commit
13c457fa15
1 changed files with 2 additions and 2 deletions
|
@ -306,8 +306,6 @@ var Mouse = require('../core/Mouse');
|
|||
timestamp: engine.timing.timestamp
|
||||
};
|
||||
|
||||
Events.trigger(render, 'beforeRender', event);
|
||||
|
||||
// apply background if it has changed
|
||||
if (render.currentBackground !== background)
|
||||
_applyBackground(render, background);
|
||||
|
@ -318,6 +316,8 @@ var Mouse = require('../core/Mouse');
|
|||
context.fillRect(0, 0, canvas.width, canvas.height);
|
||||
context.globalCompositeOperation = 'source-over';
|
||||
|
||||
Events.trigger(render, 'beforeRender', event);
|
||||
|
||||
// handle bounds
|
||||
if (options.hasBounds) {
|
||||
// filter out bodies that are not in view
|
||||
|
|
Loading…
Add table
Reference in a new issue