Skip to content

Commit

Permalink
Merge pull request #28 from Spiderpig02/2-setting-start-and-end-points
Browse files Browse the repository at this point in the history
2 setting start and end points
  • Loading branch information
Spiderpig02 authored Jan 21, 2024
2 parents beeeded + 6e19117 commit f01a4af
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions frontend/src/components/mapGrid/MapGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@ const MapGrid = () => {

// Handle clicking a tile to toggle it
const handleTileClick = (row: number, col: number) => {
console.log("selectionModeSignal.value = ", selectionModeSignal.value);
if (selectionModeSignal.value) {
if (!startPoint) {
setStartPoint(`${row}-${col}`);
} else if (!endPoint) {
setEndPoint(`${row}-${col}`);
selectionModeSignal.value = false;
} else {
setActiveTiles((prev) => ({
...prev,
[`${row}-${col}`]: !prev[`${row}-${col}`],
}));
}
} else {
console.log("Er her");
setActiveTiles((prev) => ({
...prev,
[`${row}-${col}`]: !prev[`${row}-${col}`],
}));
}
};

Expand Down

0 comments on commit f01a4af

Please sign in to comment.