Skip to content

Commit a29608e

Browse files
author
Mike Upton
authored
Merge pull request #77 from path2finding/feature/timer-and-legend
Adds in a runtime timer and space legend - WIP
2 parents 626a2a6 + 6786c26 commit a29608e

File tree

13 files changed

+295
-337
lines changed

13 files changed

+295
-337
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
"connected-react-router": "^6.6.1",
2020
"history": "^4.10.1",
2121
"lodash": "^4.17.15",
22+
"moment": "^2.24.0",
2223
"node-sass": "^4.13.1",
2324
"react": "^16.12.0",
2425
"react-dom": "^16.12.0",
26+
"react-moment": "^0.9.7",
2527
"react-redux": "^7.1.3",
2628
"react-router": "^5.1.2",
2729
"react-router-dom": "^5.1.2",

public/lava.png

4.26 KB
Loading

src/components/Maze/Maze.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.Maze {
22
height: 90vh !important;
33
// Tempt style for debugging
4-
border: 1px solid orangered;
54
}

src/components/Maze/Maze.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const populateMaze = (props: Props, openSet: Coord[], closedSet: Coord[]) => {
6565
type={mazeInfo[y][x].type}
6666
visited={mazeInfo[y][x].visited}
6767
path={mazeInfo[y][x].path}
68-
position={{ x, z: 0, y }}
68+
position={{ x: x - mazeSize.x / 2, z: 0, y: y - mazeSize.y / 2 }}
6969
inOpenSet={includesCoord(openSet, { x, y } as Coord)}
7070
inClosedSet={includesCoord(closedSet, { x, y } as Coord)}
7171
key={key}
@@ -335,7 +335,7 @@ const Maze: React.FC<Props> = (props) => {
335335

336336
// If we end up removing the last space we end BFS
337337
if (queue.length === 0) {
338-
handlePauseVisualization();
338+
if (isPlaying) handlePauseVisualization();
339339
return;
340340
}
341341
}
@@ -353,7 +353,7 @@ const Maze: React.FC<Props> = (props) => {
353353
// Update bfsQueue and set curr to visited
354354
progressBFS(queue, curr, currNeighbors);
355355
} else {
356-
handlePauseVisualization();
356+
if (isPlaying) handlePauseVisualization();
357357
progressBFS([], curr, currNeighbors);
358358
}
359359
}
@@ -475,7 +475,7 @@ const Maze: React.FC<Props> = (props) => {
475475
}
476476
} else {
477477
console.log("NO SOLUTION");
478-
handlePauseVisualization();
478+
if (isPlaying) handlePauseVisualization();
479479
return;
480480
}
481481
}, 100 / currentSpeed);
@@ -556,7 +556,7 @@ const Maze: React.FC<Props> = (props) => {
556556
}
557557
} else {
558558
console.log("NO SOLUTION");
559-
handlePauseVisualization();
559+
if (isPlaying) handlePauseVisualization();
560560
return;
561561
}
562562
}, 100 / currentSpeed);
@@ -575,7 +575,7 @@ const Maze: React.FC<Props> = (props) => {
575575
// top: 10
576576
// }}
577577
camera={{
578-
position: new Vector3(0, 10, 0),
578+
position: new Vector3(0, getMazeSize(mazeInfo).x, 0),
579579
}}
580580
>
581581
<CameraController />

0 commit comments

Comments
 (0)