Describe the bug
I implemented auto-fitting functionality using this code:
// Fit canvas to window size upon resize
window.addEventListener("resize", event => {
globe.camera().aspect = window.innerWidth / window.innerHeight;
globe.camera().updateProjectionMatrix();
globe.renderer().setSize(window.innerWidth, window.innerHeight);
});
and found out it breaks .onPointHover() and tooltips. They basically stop working, unless I hover over random areas (where those points used to be before the window was resized. If I restore window size back to the exact same dimensions it originally had, point hovers and tooltips will start working perfect again.
To Reproduce
Steps to reproduce the behavior:
Use the snippet above
Ensure that .pointLabel() tooltips and .onPointHover() work
Resize window
See that hovering points no longer does anything
Resize back to its original height and width
See that hovering points shows tooltips
Expected behavior
Tooltips and point hovers should work correctly after resizing the scene.
Screenshots
N/A
Desktop (please complete the following information):
OS: Ubuntu 20.04
Browser: Firefox
Version: 89.0.1 (64-bit)
Smartphone (please complete the following information):
Device: iPhone X
OS: iOS14
Browser: Safari
Version: doesn't matter
Additional context
I'm possibly doing something wrong in the resize callback function, but that's the only piece of code that properly resizes the scene, and that's what's recommended for THREE.js.
Describe the bug I implemented auto-fitting functionality using this code:
and found out it breaks
.onPointHover()
and tooltips. They basically stop working, unless I hover over random areas (where those points used to be before the window was resized. If I restore window size back to the exact same dimensions it originally had, point hovers and tooltips will start working perfect again.To Reproduce Steps to reproduce the behavior:
.pointLabel()
tooltips and.onPointHover()
workExpected behavior Tooltips and point hovers should work correctly after resizing the scene.
Screenshots N/A
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context I'm possibly doing something wrong in the resize callback function, but that's the only piece of code that properly resizes the scene, and that's what's recommended for THREE.js.