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:
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;
|
constraint.length = constraint.length || length || _minLength;
|
||||||
|
|
||||||
// render
|
// render
|
||||||
constraint.render = constraint.render || {};
|
var render = {
|
||||||
constraint.render.lineWidth = constraint.render.lineWidth || 2;
|
visible: true,
|
||||||
constraint.render.strokeStyle = constraint.render.strokeStyle || '#666';
|
lineWidth: 2,
|
||||||
|
strokeStyle: '#666'
|
||||||
|
};
|
||||||
|
|
||||||
|
constraint.render = Common.extend(render, constraint.render);
|
||||||
|
|
||||||
// option defaults
|
// option defaults
|
||||||
constraint.stiffness = constraint.stiffness || 1;
|
constraint.stiffness = constraint.stiffness || 1;
|
||||||
|
|
|
@ -188,7 +188,7 @@ var Render = {};
|
||||||
bodyB = constraint.bodyB,
|
bodyB = constraint.bodyB,
|
||||||
c = context;
|
c = context;
|
||||||
|
|
||||||
if (!constraint.pointA || !constraint.pointB)
|
if (!constraint.render.visible || !constraint.pointA || !constraint.pointB)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bodyA) {
|
if (bodyA) {
|
||||||
|
|
Loading…
Reference in a new issue