cxong / BlueAlert

1D de-make of a modern RTS for Mini LD 50
MIT License
4 stars 2 forks source link

Scrollbar clicking sees wrong coordinates in scaled or fullscreen mode #10

Closed qubodup closed 2 months ago

qubodup commented 2 months ago

In Chrome and Firefox, playing the game in full screen mode breaks the scrollbar functionality, as the clicks are interpreted wrong, clicking is registered vertically inside the game area and scaled horizontally.

https://github.com/user-attachments/assets/e7642db0-59f9-4a9f-88c5-4381b1c1f2a7

(1.4 MB, 34 seconds) Left: itch version, Right: fixed version

Thanks to https://phaser.discourse.group/t/easy-display-of-mouse-xy-location-in-phaser-3-canvas/3469 I found a solution happens to be to change in scrollbar.js every:

game.input.mousePointer.clientX to game.input.mousePointer.x

and every

game.input.mousePointer.clientY to game.input.mousePointer.y