From b3533937d45267661f1d533317ecc5c89e049992 Mon Sep 17 00:00:00 2001 From: liabru Date: Tue, 24 Jan 2017 20:33:37 +0000 Subject: [PATCH] added body.plugin, composite.plugin, constraint.plugin, engine.plugin properties --- src/body/Body.js | 8 ++++++++ src/body/Composite.js | 10 +++++++++- src/constraint/Constraint.js | 8 ++++++++ src/core/Engine.js | 8 ++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/body/Body.js b/src/body/Body.js index 0e15d52..fb0e0dd 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -42,6 +42,7 @@ var Axes = require('../geometry/Axes'); type: 'body', label: 'Body', parts: [], + plugin: {}, angle: 0, vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'), position: { x: 0, y: 0 }, @@ -719,6 +720,13 @@ var Axes = require('../geometry/Axes'); * @type body[] */ + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + /** * A self reference if the body is _not_ a part of another body. * Otherwise this is a reference to the body that this is a part of. diff --git a/src/body/Composite.js b/src/body/Composite.js index 5e5a431..ee15d93 100644 --- a/src/body/Composite.js +++ b/src/body/Composite.js @@ -35,7 +35,8 @@ var Body = require('./Body'); bodies: [], constraints: [], composites: [], - label: 'Composite' + label: 'Composite', + plugin: {} }, options); }; @@ -655,4 +656,11 @@ var Body = require('./Body'); * @default [] */ + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + })(); diff --git a/src/constraint/Constraint.js b/src/constraint/Constraint.js index c3bbd4d..5ba2717 100644 --- a/src/constraint/Constraint.js +++ b/src/constraint/Constraint.js @@ -73,6 +73,7 @@ var Common = require('../core/Common'); constraint.angularStiffness = constraint.angularStiffness || 0; constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; + constraint.plugin = {}; return constraint; }; @@ -391,4 +392,11 @@ var Common = require('../core/Common'); * @type number */ + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + })(); diff --git a/src/core/Engine.js b/src/core/Engine.js index b838f02..33885e9 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -51,6 +51,7 @@ var Body = require('../body/Body'); constraintIterations: 2, enableSleeping: false, events: [], + plugin: {}, timing: { timestamp: 0, timeScale: 1 @@ -491,4 +492,11 @@ var Body = require('../body/Body'); * @default a Matter.World instance */ + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + })();