0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

constraints now support visibility

This commit is contained in:
liabru 2014-03-19 22:39:18 +00:00
parent 86457bb719
commit 77c995ab5e
2 changed files with 8 additions and 4 deletions

View file

@ -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;

View file

@ -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) {