Skip to content

Commit

Permalink
fix: handle ol_uid's properly
Browse files Browse the repository at this point in the history
  • Loading branch information
spectrachrome committed Nov 21, 2023
1 parent 6a0b504 commit 67d26a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/plugins/minesweeper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const setupGrid = (map) => {
let imageLayer = new Image({ source: hex });
map.addLayer(imageLayer);

return [imageLayer.ol_uid, hex.ol_uid];
return {
uids: [imageLayer.ol_uid, hex.ol_uid],
grid,
};
};

const updateTileVisuals = (x, y, grid, vectorSource, game) => {
Expand Down Expand Up @@ -173,7 +176,7 @@ const drawGameBoard = (map, game, grid, vectorSource) => {
* @param {Object} map - The OpenLayers map instance.
*/
export const createHexMap = async (map) => {
const grid = setupGrid(map);
const { uids, grid } = setupGrid(map);
const vectorSource = new VectorSource();
const game = new HexSweeperGame(40, 40, 0.2);

Expand All @@ -182,6 +185,8 @@ export const createHexMap = async (map) => {
map.on('click', (e) => handleMapClick(e, game, grid, vectorSource));
drawGameBoard(map, game, grid, vectorSource);
updateAllTileVisuals(game, grid, vectorSource);

return uids;
};

export default {
Expand Down

0 comments on commit 67d26a9

Please sign in to comment.