From a59abed8ecf764b6924a23c854c824fe9f602da2 Mon Sep 17 00:00:00 2001 From: liabru Date: Fri, 25 Apr 2014 16:56:59 +0100 Subject: [PATCH] added labels to bodies, constraints and composites --- src/body/Body.js | 1 + src/body/Composite.js | 3 ++- src/body/World.js | 1 + src/constraint/Constraint.js | 1 + src/constraint/MouseConstraint.js | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/body/Body.js b/src/body/Body.js index a32ec7b..9f1f7c6 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -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 }, diff --git a/src/body/Composite.js b/src/body/Composite.js index 9cfae5e..b2a8bb7 100644 --- a/src/body/Composite.js +++ b/src/body/Composite.js @@ -27,7 +27,8 @@ var Composite = {}; isModified: false, bodies: [], constraints: [], - composites: [] + composites: [], + label: null }, options); }; diff --git a/src/body/World.js b/src/body/World.js index 6740155..872a181 100644 --- a/src/body/World.js +++ b/src/body/World.js @@ -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 }, diff --git a/src/constraint/Constraint.js b/src/constraint/Constraint.js index ce1324b..d76f2b1 100644 --- a/src/constraint/Constraint.js +++ b/src/constraint/Constraint.js @@ -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; diff --git a/src/constraint/MouseConstraint.js b/src/constraint/MouseConstraint.js index a3d6a00..0c65e6c 100644 --- a/src/constraint/MouseConstraint.js +++ b/src/constraint/MouseConstraint.js @@ -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,