fix(mobile): resolve mobile touch runtime errors, webgl transmission GPU stall and add root icon

This commit is contained in:
2026-11-05 11:42:47 +05:30
parent d20f98cb36
commit 35a615f4ea
4 changed files with 184 additions and 76 deletions
+20 -8
View File
@@ -453,18 +453,16 @@ function Hero3DCanvas({ className }: { className?: string }) {
const masterGroup = new THREE.Group();
scene.add(masterGroup);
// 1. Central Optical Translucent Crystal (Icosahedron, non-obstructive)
// 1. Central Optical Translucent Crystal (Icosahedron, mobile GPU safe)
const crystalGeo = new THREE.IcosahedronGeometry(1.25, 0);
const crystalMat = new THREE.MeshPhysicalMaterial({
const crystalMat = new THREE.MeshStandardMaterial({
color: 0x3b82f6,
emissive: 0x1d4ed8,
emissiveIntensity: 0.1,
roughness: 0.15,
emissiveIntensity: 0.12,
roughness: 0.18,
metalness: 0.1,
transmission: 0.9,
transparent: true,
opacity: 0.11,
ior: 1.4,
opacity: 0.14,
});
const crystal = new THREE.Mesh(crystalGeo, crystalMat);
masterGroup.add(crystal);
@@ -568,11 +566,24 @@ function Hero3DCanvas({ className }: { className?: string }) {
particles.rotation.y = elapsed * 0.03;
particles.rotation.x = elapsed * 0.02;
if (renderer) renderer.render(scene, camera);
if (renderer) {
try {
renderer.render(scene, camera);
} catch {
cancelAnimationFrame(animId);
}
}
};
animate();
const canvas = renderer.domElement;
const handleContextLost = (e: Event) => {
e.preventDefault();
cancelAnimationFrame(animId);
};
canvas.addEventListener('webglcontextlost', handleContextLost, false);
const handleResize = () => {
if (!container || !renderer) return;
const w = container.clientWidth;
@@ -587,6 +598,7 @@ function Hero3DCanvas({ className }: { className?: string }) {
return () => {
cancelAnimationFrame(animId);
observer.disconnect();
canvas.removeEventListener('webglcontextlost', handleContextLost);
window.removeEventListener('resize', handleResize);
if (renderer && renderer.domElement && container.contains(renderer.domElement)) {
container.removeChild(renderer.domElement);