vasturiano / react-globe.gl

React component for Globe Data Visualization using ThreeJS/WebGL
https://vasturiano.github.io/react-globe.gl/example/world-population/
MIT License
818 stars 150 forks source link

Performance Issues with globe #164

Open xbugfieldx opened 8 months ago

xbugfieldx commented 8 months ago

<Globe ref={globeRef} width={width} height={(width / 4) * 9} htmlElement={(gData) => { const el = document.createElement("div"); el.className = "custom-markerss"; el.innerHTML = markerSvg; el.style["pointer-events"] = "auto"; el.style.cursor = "pointer"; const tooltip = document.createElement("div"); tooltip.className = "tooltipss"; tooltip.textContent = gData.city; tooltip.style.display = "none"; el.onmouseenter = () => { tooltip.style.display = "block"; }; el.onmouseleave = () => { tooltip.style.display = "none"; }; el.appendChild(tooltip); return el; }} htmlElementsData={gData} backgroundColor="#161616" // markerData={myCordinates} hexPolygonsData={countries.features} hexPolygonResolution={4} hexPolygonMargin={0.6} hexPolygonColor={() => "#FE490C"} showAtmosphere={false} showGlobe={false} /> I have this globe but it is causing performance issues as it is blocking UI and other animations for like three seconds and the user is not able to scroll through the page until the globe loads. Is there any solution by which we can increase the loading speed hence increasing the performance? Thank you for your valuable suggestions.

vasturiano commented 8 months ago

Reducing the hexPolygonResolution will decrease the number of objects and therefore improve the rendering performance. You can also switch to using circular dots via hexPolygonUseDots={true} which alleviates the rendering somewhat.

xbugfieldx commented 7 months ago

Thank you for your response, hexPolygonUseDots={true} does increase the performance when used over hexPolygonResolution but now there are less number of dots which is not exactly like the globe I want. hexPolygonResolution={4} works perfectly and is exactly the way I want. Can I get the same number of dots using hexPolygonUseDots?

vasturiano commented 7 months ago

@xbugfieldx it's quite odd that you would get a different number of dots compared to the hexagons. The number of elements should be exactly the same in both modes. If you're still having this issue, could you please make a simple reproducing example on https://codesandbox.io/ ?