Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Skip out of canvas shapes for gridOutput() table
  • Loading branch information
limzykenneth committed Jul 18, 2024
commit eb441419bad5468f44d36e23cc8cbbf3fd096b08
31 changes: 19 additions & 12 deletions src/accessibility/gridOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,26 @@ function _gridMap(idT, ingredients) {
ingredients[x][y].color
} ${x} midpoint</a>`;
}
//if empty cell of location of shape is undefined
if (!cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX]) {
//fill it with shape info
cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX] = fill;
//if a shape is already in that location
} else {
//add it
cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX] =
cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX] +
' ' +
fill;

// Check if shape is in canvas, skip if not
if(
ingredients[x][y].loc.locY < cells.length &&
ingredients[x][y].loc.locX < cells[ingredients[x][y].loc.locY].length
){
//if empty cell of location of shape is undefined
if (!cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX]) {
//fill it with shape info
cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX] = fill;
//if a shape is already in that location
} else {
//add it
cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX] =
cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX] +
' ' +
fill;
}
shapeNumber++;
}
shapeNumber++;
}
}
//make table based on array
Expand Down