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:
parent
b874f4dbc7
commit
837c43bdb5
2 changed files with 3 additions and 3 deletions
|
@ -71,7 +71,7 @@ var Common = require('../core/Common');
|
|||
anchors: true
|
||||
};
|
||||
|
||||
if (constraint.length === 0) {
|
||||
if (constraint.length === 0 && constraint.stiffness > 0.1) {
|
||||
render.type = 'pin';
|
||||
render.anchors = false;
|
||||
} else if (constraint.stiffness < 0.9) {
|
||||
|
|
|
@ -508,7 +508,7 @@ var Mouse = require('../core/Mouse');
|
|||
|
||||
if (constraint.render.type === 'pin') {
|
||||
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();
|
||||
} else {
|
||||
if (bodyB) {
|
||||
|
@ -526,7 +526,7 @@ var Mouse = require('../core/Mouse');
|
|||
coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)),
|
||||
offset;
|
||||
|
||||
for (var j = 0; j < coils; j += 1) {
|
||||
for (var j = 1; j < coils; j += 1) {
|
||||
offset = j % 2 === 0 ? 1 : -1;
|
||||
|
||||
c.lineTo(
|
||||
|
|
Loading…
Reference in a new issue