mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
fixed lint issues
This commit is contained in:
parent
bc4186061c
commit
6c58bd9029
1 changed files with 15 additions and 8 deletions
|
@ -68,7 +68,8 @@ var PhysicsEditorLoader = {
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
for (v = 0; v < vertexSets.length; v += 1) {
|
for (v = 0; v < vertexSets.length; v += 1)
|
||||||
|
{
|
||||||
parts.push(Body.create(Common.extend({
|
parts.push(Body.create(Common.extend({
|
||||||
position: Vertices.centre(vertexSets[v]),
|
position: Vertices.centre(vertexSets[v]),
|
||||||
vertices: vertexSets[v]
|
vertices: vertexSets[v]
|
||||||
|
@ -76,27 +77,33 @@ var PhysicsEditorLoader = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag coincident part edges
|
// flag coincident part edges
|
||||||
var coincident_max_dist = 5;
|
var coincidentMaxDist = 5;
|
||||||
|
|
||||||
for (i = 0; i < parts.length; i++) {
|
for (i = 0; i < parts.length; i++)
|
||||||
|
{
|
||||||
var partA = parts[i];
|
var partA = parts[i];
|
||||||
|
|
||||||
for (j = i + 1; j < parts.length; j++) {
|
for (j = i + 1; j < parts.length; j++)
|
||||||
|
{
|
||||||
var partB = parts[j];
|
var partB = parts[j];
|
||||||
|
|
||||||
if (Bounds.overlaps(partA.bounds, partB.bounds)) {
|
if (Bounds.overlaps(partA.bounds, partB.bounds))
|
||||||
|
{
|
||||||
var pav = partA.vertices,
|
var pav = partA.vertices,
|
||||||
pbv = partB.vertices;
|
pbv = partB.vertices;
|
||||||
|
|
||||||
// iterate vertices of both parts
|
// iterate vertices of both parts
|
||||||
for (k = 0; k < partA.vertices.length; k++) {
|
for (k = 0; k < partA.vertices.length; k++)
|
||||||
for (z = 0; z < partB.vertices.length; z++) {
|
{
|
||||||
|
for (z = 0; z < partB.vertices.length; z++)
|
||||||
|
{
|
||||||
// find distances between the vertices
|
// find distances between the vertices
|
||||||
var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])),
|
var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])),
|
||||||
db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length]));
|
db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length]));
|
||||||
|
|
||||||
// if both vertices are very close, consider the edge concident (internal)
|
// if both vertices are very close, consider the edge concident (internal)
|
||||||
if (da < coincident_max_dist && db < coincident_max_dist) {
|
if (da < coincidentMaxDist && db < coincidentMaxDist)
|
||||||
|
{
|
||||||
pav[k].isInternal = true;
|
pav[k].isInternal = true;
|
||||||
pbv[z].isInternal = true;
|
pbv[z].isInternal = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue