0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-03-07 22:53:59 -05:00

added body.plugin, composite.plugin, constraint.plugin, engine.plugin properties

This commit is contained in:
liabru 2017-01-24 20:33:37 +00:00
parent 8cdbb38c91
commit b3533937d4
4 changed files with 33 additions and 1 deletions

View file

@ -42,6 +42,7 @@ var Axes = require('../geometry/Axes');
type: 'body', type: 'body',
label: 'Body', label: 'Body',
parts: [], parts: [],
plugin: {},
angle: 0, angle: 0,
vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'), vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'),
position: { x: 0, y: 0 }, position: { x: 0, y: 0 },
@ -719,6 +720,13 @@ var Axes = require('../geometry/Axes');
* @type body[] * @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. * 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. * Otherwise this is a reference to the body that this is a part of.

View file

@ -35,7 +35,8 @@ var Body = require('./Body');
bodies: [], bodies: [],
constraints: [], constraints: [],
composites: [], composites: [],
label: 'Composite' label: 'Composite',
plugin: {}
}, options); }, options);
}; };
@ -655,4 +656,11 @@ var Body = require('./Body');
* @default [] * @default []
*/ */
/**
* An object reserved for storing plugin-specific properties.
*
* @property plugin
* @type {}
*/
})(); })();

View file

@ -73,6 +73,7 @@ var Common = require('../core/Common');
constraint.angularStiffness = constraint.angularStiffness || 0; constraint.angularStiffness = constraint.angularStiffness || 0;
constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA;
constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB;
constraint.plugin = {};
return constraint; return constraint;
}; };
@ -391,4 +392,11 @@ var Common = require('../core/Common');
* @type number * @type number
*/ */
/**
* An object reserved for storing plugin-specific properties.
*
* @property plugin
* @type {}
*/
})(); })();

View file

@ -51,6 +51,7 @@ var Body = require('../body/Body');
constraintIterations: 2, constraintIterations: 2,
enableSleeping: false, enableSleeping: false,
events: [], events: [],
plugin: {},
timing: { timing: {
timestamp: 0, timestamp: 0,
timeScale: 1 timeScale: 1
@ -491,4 +492,11 @@ var Body = require('../body/Body');
* @default a Matter.World instance * @default a Matter.World instance
*/ */
/**
* An object reserved for storing plugin-specific properties.
*
* @property plugin
* @type {}
*/
})(); })();