HtmlMesh Renders Incorrectly When Browser Window is Resized
In the example [https://www.babylonjs-playground.com/#Y2LIXI#44], when you drag to resize the right-side canvas, you will notice that the overlayMesh and overlayMeshDiv are misaligned. After reviewing the source code, I found that the issue lies in the createGetCanvasRectGenerator function in the utils.ts file. This method uses updateInterval for throttling, which causes the final render to be misaligned. This issue is most noticeable when the browser is zoomed in or out. My solution is to use lodash.throttle(boundOnResize, 500, { leading: true, trailing: true }) for throttling.
https://github.com/user-attachments/assets/f863c15b-b271-4666-99d6-cc0dea4fea73
After making this change, the HtmlMesh renders correctly. I initially positioned it on the yellow sphere, and no matter how the canvas size is changed, it remains properly aligned.
https://github.com/user-attachments/assets/6e9fd3ac-24eb-41c8-8dc3-7738aa7a2247
for anyone looking for a solution that does the resizing immediately by the next render, I wrote about another hacky workaround to solve this in https://github.com/BabylonJS/Babylon.js/issues/15788
Closing as we will tackle it with https://github.com/BabylonJS/Babylon.js/issues/15788