Skip to content

Commit

Permalink
Removed useless structures
Browse files Browse the repository at this point in the history
  • Loading branch information
HadaIonut committed Oct 29, 2020
1 parent 1cc86c0 commit b253cad
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/scripts/WallMerger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,13 @@ class WallMerger {
return Math.sqrt(Math.pow(line[2] - line[0], 2) + Math.pow(line[3] - line[1], 2));
}

private _getOverlappingSelectedWalls (selectedWalls: any) {
/**
* Returns an arr
*
* @param selectedWalls
* @private
*/
private _getMainWalls (selectedWalls: any) {
const wallsToMerge = [];

selectedWalls.forEach((wall) => {
Expand All @@ -304,12 +310,7 @@ class WallMerger {
if (this._calculateLineLength(overlappingWall.data.c) < wallLength) shouldMerge.push(overlappingWall);
})

if (shouldMerge.length !== 0){
wallsToMerge.push({
target: wall,
toBeMerged: shouldMerge
})
}
if (shouldMerge.length !== 0) wallsToMerge.push(wall);
})

return wallsToMerge;
Expand Down Expand Up @@ -368,10 +369,10 @@ class WallMerger {

public async mergeAllSelectedWalls() {
const selectedWalls = this._getSelectedWalls();
const wallsToMerge = this._getOverlappingSelectedWalls(selectedWalls);
const wallsToMerge = this._getMainWalls(selectedWalls);

for (const structure of wallsToMerge) {
await this.mergeWalls(structure.target);
await this.mergeWalls(structure);
}
}
}
Expand Down

0 comments on commit b253cad

Please sign in to comment.