mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
constraints now support visibility
This commit is contained in:
parent
86457bb719
commit
77c995ab5e
2 changed files with 8 additions and 4 deletions
|
@ -42,9 +42,13 @@ 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';
|
||||
var render = {
|
||||
visible: true,
|
||||
lineWidth: 2,
|
||||
strokeStyle: '#666'
|
||||
};
|
||||
|
||||
constraint.render = Common.extend(render, constraint.render);
|
||||
|
||||
// option defaults
|
||||
constraint.stiffness = constraint.stiffness || 1;
|
||||
|
|
|
@ -188,7 +188,7 @@ var Render = {};
|
|||
bodyB = constraint.bodyB,
|
||||
c = context;
|
||||
|
||||
if (!constraint.pointA || !constraint.pointB)
|
||||
if (!constraint.render.visible || !constraint.pointA || !constraint.pointB)
|
||||
return;
|
||||
|
||||
if (bodyA) {
|
||||
|
|
Loading…
Reference in a new issue