0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-12 16:08:50 -05:00

improved spring and pin rendering

This commit is contained in:
liabru 2017-06-28 00:20:36 +01:00
parent b874f4dbc7
commit 837c43bdb5
2 changed files with 3 additions and 3 deletions

View file

@ -71,7 +71,7 @@ var Common = require('../core/Common');
anchors: true anchors: true
}; };
if (constraint.length === 0) { if (constraint.length === 0 && constraint.stiffness > 0.1) {
render.type = 'pin'; render.type = 'pin';
render.anchors = false; render.anchors = false;
} else if (constraint.stiffness < 0.9) { } else if (constraint.stiffness < 0.9) {

View file

@ -508,7 +508,7 @@ var Mouse = require('../core/Mouse');
if (constraint.render.type === 'pin') { if (constraint.render.type === 'pin') {
c.beginPath(); c.beginPath();
c.arc(start.x, start.y, 4, 0, 2 * Math.PI); c.arc(start.x, start.y, 3, 0, 2 * Math.PI);
c.closePath(); c.closePath();
} else { } else {
if (bodyB) { if (bodyB) {
@ -526,7 +526,7 @@ var Mouse = require('../core/Mouse');
coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)), coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)),
offset; offset;
for (var j = 0; j < coils; j += 1) { for (var j = 1; j < coils; j += 1) {
offset = j % 2 === 0 ? 1 : -1; offset = j % 2 === 0 ? 1 : -1;
c.lineTo( c.lineTo(