Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raycasting doesn't update when map resizes #390

Open
jeffmacinnes opened this issue Apr 7, 2023 · 1 comment
Open

Raycasting doesn't update when map resizes #390

jeffmacinnes opened this issue Apr 7, 2023 · 1 comment
Labels
🪲 bug Something isn't working

Comments

@jeffmacinnes
Copy link

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:

raycastingIssue.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

@jeffmacinnes jeffmacinnes added the 🪲 bug Something isn't working label Apr 7, 2023
@pleimer
Copy link

pleimer commented Jan 2, 2025

I was able to fix this by adding the handler to the CameraSynced event:

    map.on('CameraSynced', () => {
      window.tb.camera.updateProjectionMatrix();
    });

I seems the CameraSync object does not invoke this after updating the projection matrix and the values don't go into effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants