mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-30 10:20:52 -05:00
constraints now use a render property
This commit is contained in:
parent
123d391d00
commit
d54ccb90a6
3 changed files with 11 additions and 6 deletions
|
@ -41,9 +41,12 @@ var Constraint = {};
|
|||
|
||||
constraint.length = constraint.length || length || _minLength;
|
||||
|
||||
// render
|
||||
constraint.render = constraint.render || {};
|
||||
constraint.render.lineWidth = constraint.render.lineWidth || 2;
|
||||
constraint.render.strokeStyle = constraint.render.strokeStyle || '#666';
|
||||
|
||||
// option defaults
|
||||
constraint.lineWidth = constraint.lineWidth || 2;
|
||||
constraint.strokeStyle = constraint.strokeStyle || '#666';
|
||||
constraint.stiffness = constraint.stiffness || 1;
|
||||
constraint.angularStiffness = constraint.angularStiffness || 0;
|
||||
constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA;
|
||||
|
|
|
@ -21,8 +21,10 @@ var MouseConstraint = {};
|
|||
length: 0.01,
|
||||
stiffness: 0.1,
|
||||
angularStiffness: 1,
|
||||
strokeStyle: 'lightgreen',
|
||||
render: {
|
||||
strokeStyle: '#90EE90',
|
||||
lineWidth: 3
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
|
@ -191,8 +191,8 @@ var Render = {};
|
|||
c.lineTo(constraint.pointB.x, constraint.pointB.y);
|
||||
}
|
||||
|
||||
c.lineWidth = constraint.lineWidth;
|
||||
c.strokeStyle = constraint.strokeStyle;
|
||||
c.lineWidth = constraint.render.lineWidth;
|
||||
c.strokeStyle = constraint.render.strokeStyle;
|
||||
c.stroke();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue