Skip to content

Commit 9a0218b

Browse files
committed
Fixed line style and updated parameter names.
1 parent f050b14 commit 9a0218b

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

src/physics/matter-js/World.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,6 @@ var World = new Class({
386386
{
387387
render.anchorSize = debugConfig.anchorSize;
388388
}
389-
390-
console.log(obj);
391389
}
392390
}
393391
});
@@ -1055,8 +1053,8 @@ var World = new Class({
10551053
}
10561054

10571055
var opacity = body.render.opacity;
1058-
var lineStyle = body.render.strokeColor;
1059-
var fillStyle = body.render.fillColor;
1056+
var strokeColor = body.render.strokeColor;
1057+
var fillColor = body.render.fillColor;
10601058
var lineThickness = body.render.lineThickness;
10611059

10621060
if (showSleeping && body.isSleeping)
@@ -1067,22 +1065,22 @@ var World = new Class({
10671065
}
10681066
else
10691067
{
1070-
lineStyle = sleepStrokeColor;
1071-
fillStyle = sleepFillColor;
1068+
strokeColor = sleepStrokeColor;
1069+
fillColor = sleepFillColor;
10721070
}
10731071
}
10741072

10751073
if (!renderFill)
10761074
{
1077-
fillStyle = null;
1075+
fillColor = null;
10781076
}
10791077

10801078
if (!renderStroke)
10811079
{
1082-
lineStyle = null;
1080+
strokeColor = null;
10831081
}
10841082

1085-
this.renderBody(body, graphics, showInternalEdges, lineStyle, fillStyle, opacity, lineThickness);
1083+
this.renderBody(body, graphics, showInternalEdges, strokeColor, fillColor, opacity, lineThickness);
10861084

10871085
var partsLength = body.parts.length;
10881086

@@ -1143,17 +1141,27 @@ var World = new Class({
11431141
// Part polygon
11441142
var circleRadius = part.circleRadius;
11451143

1144+
graphics.beginPath();
1145+
1146+
if (fillColor !== null)
1147+
{
1148+
graphics.fillStyle(fillColor, opacity);
1149+
}
1150+
1151+
if (lineColor !== null)
1152+
{
1153+
graphics.lineStyle(lineThickness, lineColor, opacity);
1154+
}
1155+
11461156
if (circleRadius)
11471157
{
1148-
graphics.beginPath();
11491158
graphics.arc(part.position.x, part.position.y, circleRadius, 0, 2 * Math.PI);
11501159
}
11511160
else
11521161
{
11531162
var vertices = part.vertices;
11541163
var vertLength = vertices.length;
11551164

1156-
graphics.beginPath();
11571165
graphics.moveTo(vertices[0].x, vertices[0].y);
11581166

11591167
for (var j = 1; j < vertLength; j++)
@@ -1182,13 +1190,11 @@ var World = new Class({
11821190

11831191
if (fillColor !== null)
11841192
{
1185-
graphics.fillStyle(fillColor, opacity);
11861193
graphics.fillPath();
11871194
}
11881195

11891196
if (lineColor !== null)
11901197
{
1191-
graphics.lineStyle(lineThickness, lineColor, opacity);
11921198
graphics.strokePath();
11931199
}
11941200
}

0 commit comments

Comments
 (0)