mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
added labels to bodies, constraints and composites
This commit is contained in:
parent
e1b6f9ba5a
commit
a59abed8ec
5 changed files with 6 additions and 1 deletions
|
@ -22,6 +22,7 @@ var Body = {};
|
|||
var defaults = {
|
||||
id: Body.nextId(),
|
||||
type: 'body',
|
||||
label: null,
|
||||
angle: 0,
|
||||
position: { x: 0, y: 0 },
|
||||
force: { x: 0, y: 0 },
|
||||
|
|
|
@ -27,7 +27,8 @@ var Composite = {};
|
|||
isModified: false,
|
||||
bodies: [],
|
||||
constraints: [],
|
||||
composites: []
|
||||
composites: [],
|
||||
label: null
|
||||
}, options);
|
||||
};
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ var World = {};
|
|||
var composite = Composite.create();
|
||||
|
||||
var defaults = {
|
||||
label: 'World',
|
||||
gravity: { x: 0, y: 1 },
|
||||
bounds: {
|
||||
min: { x: 0, y: 0 },
|
||||
|
|
|
@ -54,6 +54,7 @@ var Constraint = {};
|
|||
|
||||
// option defaults
|
||||
constraint.id = constraint.id || Constraint.nextId();
|
||||
constraint.label = constraint.label;
|
||||
constraint.type = 'constraint';
|
||||
constraint.stiffness = constraint.stiffness || 1;
|
||||
constraint.angularStiffness = constraint.angularStiffness || 0;
|
||||
|
|
|
@ -20,6 +20,7 @@ var MouseConstraint = {};
|
|||
var mouse = engine.input.mouse;
|
||||
|
||||
var constraint = Constraint.create({
|
||||
label: 'Mouse Constraint',
|
||||
pointA: mouse.position,
|
||||
pointB: { x: 0, y: 0 },
|
||||
length: 0.01,
|
||||
|
|
Loading…
Reference in a new issue