diff --git a/src/body/.Body.js.swp b/src/body/.Body.js.swp new file mode 100644 index 0000000..53bad27 Binary files /dev/null and b/src/body/.Body.js.swp differ diff --git a/src/body/.Composite.js.swp b/src/body/.Composite.js.swp new file mode 100644 index 0000000..0c06b60 Binary files /dev/null and b/src/body/.Composite.js.swp differ diff --git a/src/body/Body.js b/src/body/Body.js index 2190968..b7767cd 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -634,6 +634,26 @@ var Axes = require('../geometry/Axes'); * */ + /** + * Fired before a body is going to be removed + * + * @event beforeRemoved + * @this {body} The body that is going to be removed + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + + /** + * Fired after a body was removed + * + * @event afterRemoved + * @this {body} The body that was removed + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + /** * Fired when a body starts sleeping (where `this` is the body). * diff --git a/src/body/Composite.js b/src/body/Composite.js index ec04e25..1e9a720 100644 --- a/src/body/Composite.js +++ b/src/body/Composite.js @@ -238,6 +238,7 @@ var Body = require('./Body'); * @return {composite} The original composite with the body removed */ Composite.removeBody = function(composite, body, deep) { + Events.trigger(body, 'beforeRemoved', {}); var position = Common.indexOf(composite.bodies, body); if (position !== -1) { Composite.removeBodyAt(composite, position); @@ -250,6 +251,7 @@ var Body = require('./Body'); } } + Events.trigger(body, 'afterRemoved', {}); return composite; };