Skip to content

Commit

Permalink
Merge pull request #25 from Suke-H/24-矢印セルやパネル設置時の不具合修正
Browse files Browse the repository at this point in the history
#24 矢印セルやパネル設置時の不具合修正
  • Loading branch information
Suke-H authored Jan 16, 2025
2 parents 3393df5 + f73b2c5 commit ed2ca9c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
21 changes: 10 additions & 11 deletions frontend/src/components/editor/grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,7 @@ export const Grid: React.FC<GridProps> = ({
// 通常のセル選択モード
if (!panelPlacementMode.panel) {
const newGrid = [...grid];

// 矢印セルの向きが既にある場合、反転する
const currentCell = newGrid[rowIndex][colIndex];
if (currentCell === 'ArrowUp') newGrid[rowIndex][colIndex] = 'ArrowDown';
else if (currentCell === 'ArrowDown') newGrid[rowIndex][colIndex] = 'ArrowUp';
else if (currentCell === 'ArrowLeft') newGrid[rowIndex][colIndex] = 'ArrowRight';
else if (currentCell === 'ArrowRight') newGrid[rowIndex][colIndex] = 'ArrowLeft';
else newGrid[rowIndex][colIndex] = selectedCellType;
newGrid[rowIndex][colIndex] = selectedCellType;

setGrid(newGrid);
setGridHistory((prev) => [...prev, newGrid]);
Expand All @@ -91,14 +84,20 @@ export const Grid: React.FC<GridProps> = ({
for (let j = 0; j < panelCols; j++) {
if (placingPanel.cells[i][j] === 'Black') {
const targetCell = updatedGrid[rowIndex + i][colIndex + j];
if (targetCell.startsWith('arrow-')) {
// 矢印セルの向きを反転

// 矢印セルの向きを反転
if (targetCell.startsWith('Arrow')) {
if (targetCell === 'ArrowUp') updatedGrid[rowIndex + i][colIndex + j] = 'ArrowDown';
else if (targetCell === 'ArrowDown') updatedGrid[rowIndex + i][colIndex + j] = 'ArrowUp';
else if (targetCell === 'ArrowLeft') updatedGrid[rowIndex + i][colIndex + j] = 'ArrowRight';
else if (targetCell === 'ArrowRight') updatedGrid[rowIndex + i][colIndex + j] = 'ArrowLeft';
} else {
}

// 白黒反転
if (targetCell === 'White') {
updatedGrid[rowIndex + i][colIndex + j] = 'Black';
} else if (targetCell === 'Black') {
updatedGrid[rowIndex + i][colIndex + j] = 'White';
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions local-batch/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker build -t kiro-stage-editor .
docker run --name kiro-stage-editor -d -p 8080:8080 kiro-stage-editor
2 changes: 2 additions & 0 deletions local-batch/remove.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker stop kiro-stage-editor && docker rm kiro-stage-editor
docker rmi kiro-stage-editor

0 comments on commit ed2ca9c

Please sign in to comment.