jscastro76 / threebox

A Three.js plugin for Mapbox GL JS, with support for animations and advanced 3D rendering.
Other
549 stars 145 forks source link

Raycasting doesn't update when map resizes #390

Open jeffmacinnes opened 1 year ago

jeffmacinnes commented 1 year ago

Thank you for all of the work on this tool, it's been absolutely instrumental on a big project I've been working on 😄

Describe the bug Mouseover detection on objects works perfectly until the map is resized. Afterward the behavior suggests that the raycaster camera hasn't synced up with the new dimensions of the map. In order to trigger the mouseover detection, the cursor has to be some number of pixels away from the object.

To Reproduce This can be reproduced in the latest release (v2.2.7) by running examples/01_basic.html as seen in this clip:

https://user-images.githubusercontent.com/14912413/230679889-55c6af17-14b4-42be-87d9-b54c94d8e5a0.mp4

Additional context I believe a related issue was described in #383 . That issue mentioned a workaround of manually creating a new cameraSync whenever the map resizes, which I will try. Nevertheless, if this is a bug in the tool, I wanted to document it here with a simple to reproduce example