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

Performance Issues with globe #164

Open
xbugfieldx opened this issue Nov 1, 2023 · 3 comments
Open

Performance Issues with globe #164

xbugfieldx opened this issue Nov 1, 2023 · 3 comments

Comments

@xbugfieldx
Copy link

<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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

@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/ ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants