Spaces:
Running
Running
LogicalTrue commited on
Commit ·
e9bed98
1
Parent(s): 3a822dd
Fix 3D viewer header bar structure and z-index to make btnBack clickable on mobile touch screens
Browse files- frontend/viewer.html +14 -16
frontend/viewer.html
CHANGED
|
@@ -403,18 +403,18 @@
|
|
| 403 |
</div>
|
| 404 |
|
| 405 |
<!-- 2. Interactive model viewer (shown when active) -->
|
| 406 |
-
<div id="viewer-container" style="display: none; position:
|
| 407 |
-
<!-- Viewer
|
| 408 |
-
<div id="
|
| 409 |
-
<button id="btnBackToGallery" style="
|
| 410 |
⬅ Volver
|
| 411 |
</button>
|
| 412 |
-
<button id="btnDownloadViewerFBX" style="
|
| 413 |
⬇ Descargar FBX
|
| 414 |
</button>
|
| 415 |
</div>
|
| 416 |
|
| 417 |
-
<div id="loading-overlay">
|
| 418 |
<div class="spinner"></div>
|
| 419 |
<div id="loading-text" style="font-size: 0.9rem; color: #a1a1aa;">Cargando archivo 3D...</div>
|
| 420 |
</div>
|
|
@@ -427,7 +427,7 @@
|
|
| 427 |
shadow-intensity="1"
|
| 428 |
auto-rotate
|
| 429 |
interaction-prompt="auto"
|
| 430 |
-
style="width: 100%; height: 100%;">
|
| 431 |
</model-viewer>
|
| 432 |
</div>
|
| 433 |
|
|
@@ -446,6 +446,7 @@
|
|
| 446 |
const galleryGrid = document.getElementById('gallery-grid');
|
| 447 |
|
| 448 |
function exitViewerToGallery() {
|
|
|
|
| 449 |
viewerContainer.style.display = 'none';
|
| 450 |
viewer.src = '';
|
| 451 |
|
|
@@ -484,19 +485,16 @@
|
|
| 484 |
|
| 485 |
// Back button to list models
|
| 486 |
if (btnBack) {
|
| 487 |
-
btnBack.
|
| 488 |
-
e.stopPropagation();
|
| 489 |
-
exitViewerToGallery();
|
| 490 |
-
});
|
| 491 |
-
btnBack.addEventListener('touchend', (e) => {
|
| 492 |
-
e.stopPropagation();
|
| 493 |
exitViewerToGallery();
|
| 494 |
-
}
|
| 495 |
}
|
| 496 |
|
| 497 |
const btnDownloadViewerFBX = document.getElementById('btnDownloadViewerFBX');
|
| 498 |
if (btnDownloadViewerFBX) {
|
| 499 |
-
btnDownloadViewerFBX.
|
|
|
|
| 500 |
if (!currentViewerUrl) return;
|
| 501 |
let fbxUrl = currentViewerUrl;
|
| 502 |
if (fbxUrl.endsWith('.glb')) {
|
|
@@ -508,7 +506,7 @@
|
|
| 508 |
document.body.appendChild(a);
|
| 509 |
a.click();
|
| 510 |
document.body.removeChild(a);
|
| 511 |
-
}
|
| 512 |
}
|
| 513 |
|
| 514 |
// Load 3D model in viewer
|
|
|
|
| 403 |
</div>
|
| 404 |
|
| 405 |
<!-- 2. Interactive model viewer (shown when active) -->
|
| 406 |
+
<div id="viewer-container" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: 9999; background: #121214;">
|
| 407 |
+
<!-- Viewer Header Control Overlay -->
|
| 408 |
+
<div id="viewerHeaderBar" style="position: absolute; top: 0; left: 0; right: 0; z-index: 10000; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(18, 18, 20, 0.9); border-bottom: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px);">
|
| 409 |
+
<button id="btnBackToGallery" style="background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: #ffffff; padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; z-index: 10001;">
|
| 410 |
⬅ Volver
|
| 411 |
</button>
|
| 412 |
+
<button id="btnDownloadViewerFBX" style="background: linear-gradient(135deg, #10b981, #059669); border: none; color: #ffffff; padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; cursor: pointer; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4); display: flex; align-items: center; gap: 6px; z-index: 10001;">
|
| 413 |
⬇ Descargar FBX
|
| 414 |
</button>
|
| 415 |
</div>
|
| 416 |
|
| 417 |
+
<div id="loading-overlay" style="z-index: 9999;">
|
| 418 |
<div class="spinner"></div>
|
| 419 |
<div id="loading-text" style="font-size: 0.9rem; color: #a1a1aa;">Cargando archivo 3D...</div>
|
| 420 |
</div>
|
|
|
|
| 427 |
shadow-intensity="1"
|
| 428 |
auto-rotate
|
| 429 |
interaction-prompt="auto"
|
| 430 |
+
style="width: 100%; height: 100%; padding-top: 50px; box-sizing: border-box;">
|
| 431 |
</model-viewer>
|
| 432 |
</div>
|
| 433 |
|
|
|
|
| 446 |
const galleryGrid = document.getElementById('gallery-grid');
|
| 447 |
|
| 448 |
function exitViewerToGallery() {
|
| 449 |
+
console.log("[Viewer] Exiting 3D viewer mode");
|
| 450 |
viewerContainer.style.display = 'none';
|
| 451 |
viewer.src = '';
|
| 452 |
|
|
|
|
| 485 |
|
| 486 |
// Back button to list models
|
| 487 |
if (btnBack) {
|
| 488 |
+
btnBack.onclick = function(e) {
|
| 489 |
+
if (e) e.stopPropagation();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
exitViewerToGallery();
|
| 491 |
+
};
|
| 492 |
}
|
| 493 |
|
| 494 |
const btnDownloadViewerFBX = document.getElementById('btnDownloadViewerFBX');
|
| 495 |
if (btnDownloadViewerFBX) {
|
| 496 |
+
btnDownloadViewerFBX.onclick = function(e) {
|
| 497 |
+
if (e) e.stopPropagation();
|
| 498 |
if (!currentViewerUrl) return;
|
| 499 |
let fbxUrl = currentViewerUrl;
|
| 500 |
if (fbxUrl.endsWith('.glb')) {
|
|
|
|
| 506 |
document.body.appendChild(a);
|
| 507 |
a.click();
|
| 508 |
document.body.removeChild(a);
|
| 509 |
+
};
|
| 510 |
}
|
| 511 |
|
| 512 |
// Load 3D model in viewer
|