Skip to content

Problem and fix for constraint.render.type: 'pin' in non-minimized code for version 0.20.0. #1340

@Vaiok

Description

@Vaiok

This is for the non-minimized code of version 0.20.0.

Description

The pin type for constraint rendering is causing an error in the Render.constraints function because end.x and end.y are only defined in the else block when the if condition testing constraint.render.type === 'pin' fails.
The following code

if (bodyB) {
    end = Vector.add(bodyB.position, constraint.pointB);
} else {
    end = constraint.pointB;
}

should be moved out of the else condition and put directly beneath this code.

if (bodyA) {
    start = Vector.add(bodyA.position, constraint.pointA);
} else {
    start = constraint.pointA;
}

Images

Console Error:

Image

Place in Code Indicated by the Error Output:

Image

Place in Code Where the Problem is Before Fixed:

Image

Place in Code Where the Problem is After Fixed:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions