open-rmf / rmf_site

Experimental visualizer for dense buildings in RMF
32 stars 13 forks source link

[Bug]: Touchpad scroll causing crash in wasm #234

Open mxgrey opened 1 month ago

mxgrey commented 1 month ago

Description of the bug

When zooming in/out using a touchpad in WASM, there is a very high probability of the application canvas suddenly turning pitch black (leaving only the egui panels) and the whole application becomes completely unresponsive.

The issue only seems to happen in WASM and only when the touchpad is being used to zoom. I can use PgUp/PgDn to zoom without a problem. I can use the scroll wheel on a mouse without crashing, although the zoom increment seems weirdly small. When I load the hotel demo world and scroll 3-5 times in Chrome or Firefox with a touchpad the issue happens very reliably.

When I test with the last published web version the issue is much harder to reproduce. It only seemed to happen once after a whole minute or more of scrolling in and out. There might be something very subtle in the recent camera control changes that is surfacing a problem that existed previously but went unnoticed because it only happened with extreme rarity.

Steps to reproduce the bug

luca-della-vedova commented 1 month ago

Luckily we have panic messages on wasm if you go to the developer console, I can reproduce with the following error, it should help:

librmf_site_editor.js:460 panicked at rmf_site_editor/src/interaction/camera_controls/utils.rs:82:10:
Active camera does not have a valid ray from center of its viewport
mxgrey commented 1 month ago

Nice, I forgot about that, it does help a lot, thanks!