mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
fixed rendering of compound bodies
This commit is contained in:
parent
aaffee3b72
commit
99dd6c518a
1 changed files with 15 additions and 3 deletions
|
@ -419,6 +419,7 @@ var Vector = require('../geometry/Vector');
|
|||
var c = context,
|
||||
render = engine.render,
|
||||
options = render.options,
|
||||
showInternalEdges = options.showInternalEdges || !options.wireframes,
|
||||
body,
|
||||
part,
|
||||
i,
|
||||
|
@ -470,9 +471,20 @@ var Vector = require('../geometry/Vector');
|
|||
} else {
|
||||
c.beginPath();
|
||||
c.moveTo(part.vertices[0].x, part.vertices[0].y);
|
||||
for (var j = 1; j < part.vertices.length; j++) {
|
||||
|
||||
for (j = 1; j < part.vertices.length; j++) {
|
||||
if (!part.vertices[j - 1].isInternal || showInternalEdges) {
|
||||
c.lineTo(part.vertices[j].x, part.vertices[j].y);
|
||||
} else {
|
||||
c.moveTo(part.vertices[j].x, part.vertices[j].y);
|
||||
}
|
||||
|
||||
if (part.vertices[j].isInternal && !showInternalEdges) {
|
||||
c.moveTo(part.vertices[(j + 1) % part.vertices.length].x, part.vertices[(j + 1) % part.vertices.length].y);
|
||||
}
|
||||
}
|
||||
|
||||
c.lineTo(part.vertices[0].x, part.vertices[0].y);
|
||||
c.closePath();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue