hugosaintemarie / magic-maze

Online version of board game "Magic Maze"
https://magicmaze.herokuapp.com
MIT License
20 stars 11 forks source link

Ignore mouse positions that are outside the game #44

Closed rcjsuen closed 3 years ago

rcjsuen commented 3 years ago

Depending on how the events are dispatched, the mouse may be recorded as being outside the game if the game window is resized to a smaller size. This means our hovering logic will not return a tile as the mouse is not currently in the game window (and thus not over any tile).

When this happens, ignore such mouse positions and instead only process positions where the mouse is over and inside the game window.

This fix addresses #43.

hugosaintemarie commented 3 years ago

Thanks @rcjsuen! Does the bug occur only when resizing? After a resize, does the game continue running smoothly with your fix?

rcjsuen commented 3 years ago

Does the bug occur only when resizing?

This bug can happen when you resize the window or if you move your mouse in and out of the browser window. In both cases you will probably have to do it many, many times to trigger the bug. I'm testing this with Chrome on a MacBook.

After a resize, does the game continue running smoothly with your fix?

Yes, the game continues to run after the fix.

hugosaintemarie commented 3 years ago

Thanks a lot 🙏