I am working in a browser i.e. including my sketch.js file in an html document.
Using the mouseClicked() function I can get left clicks but mouseButton only gives me left click.
I would like to be able to right click or click down on the scroll wheel
I have also tried passing in the event parameter and using event.button to no avail.
It says in the p5.js docs there is an issue with browser support, but does not specify how to resolve the issue, and it doesn’t work even on the p5 editor. I tried both on chrome and firefox and neither seems to give me anything.
Here’s the code I’m using:
`
function mouseClicked(event) {
// Get Array Indices of square selected
let xSquare = Math.floor(mouseX / tile_size);
let ySquare = Math.floor(mouseY / tile_size);
console.log(mouseButton)
console.log(event.button)
if (mouseButton === CENTER) { // Handle Flag on Right Click TODO: add remove flag if already exists
working_board.set_square(xSquare, ySquare, 3)
} else { // Handle any other tile
if (number_board.get_square(xSquare, ySquare) >= 1 && number_board.get_square(xSquare, ySquare) <= 8) { // Handle Number Square
working_board.reveal_single_tile(xSquare, ySquare);
} else if (number_board.get_square(xSquare, ySquare) == 0) { // Handle Clear Square
working_board.reveal_tiles(xSquare, ySquare);
} else if (working_board.get_square(xSquare, ySquare) == 2) { // Handle Bomb Tile
working_board.set_square(xSquare, ySquare, 3);
} // TODO: Add Functionality for Clicking a number tile already cleared
}