GitBrowser/wwwroot/js/logo3d.js
+22
-3
diff --git a/GitBrowser/wwwroot/js/logo3d.js b/GitBrowser/wwwroot/js/logo3d.js
index 87db2e0..7db9a54 100644
@@ -20,6 +20,8 @@ const state = {
friction: 0.95,
animationFrameId: null,
container: null,
faviconElement: null,
blobUrl: null,
};
// === INITIALIZATION ===
@@ -55,6 +57,9 @@ function initScene() {
const fillLight = new THREE.DirectionalLight(0xffffff, 0.3);
fillLight.position.set(-2, 1, -2);
state.scene.add(fillLight);
// Favicon
state.faviconElement = document.querySelector("link[rel=\"icon\"]");
}
// === MODEL LOADING ===
@@ -161,7 +166,24 @@ function animate() {
if (state.renderer && state.scene && state.camera) {
state.renderer.render(state.scene, state.camera);
updateFavicon();
}
}
let updatingFavicon = false;
function updateFavicon() {
if (state.renderer?.domElement == null || updatingFavicon) {
return;
}
updatingFavicon = true;
state.renderer.domElement.toBlob(blob => {
if (state.blobUrl != null) {
URL.revokeObjectURL(state.blobUrl);
}
state.blobUrl = URL.createObjectURL(blob);
state.faviconElement.href = state.blobUrl;
updatingFavicon = false;
});
}
// === EVENT LISTENERS ===
@@ -278,6 +300,3 @@ if (document.readyState === "loading") {
} else {
init();
}
// Export for manual calls if needed
window.replaceLogo3D = replaceLogo;