Spaces:
Running
Running
Update interface.js
Browse files- interface.js +32 -27
interface.js
CHANGED
|
@@ -80,11 +80,11 @@ const currentScriptTag = document.currentScript;
|
|
| 80 |
const widgetContainer = document.createElement('div');
|
| 81 |
widgetContainer.id = 'ply-widget-container-' + instanceId;
|
| 82 |
widgetContainer.classList.add('ply-widget-container');
|
| 83 |
-
widgetContainer.style.height = "0"; //
|
| 84 |
widgetContainer.style.paddingBottom = aspectPercent;
|
| 85 |
widgetContainer.setAttribute('data-original-aspect', aspectPercent);
|
| 86 |
|
| 87 |
-
// Add the 3D-viewer HTML +
|
| 88 |
widgetContainer.innerHTML = `
|
| 89 |
<div id="viewer-container-${instanceId}" class="viewer-container">
|
| 90 |
<div id="progress-dialog-${instanceId}" class="progress-dialog">
|
|
@@ -127,29 +127,38 @@ const currentScriptTag = document.currentScript;
|
|
| 127 |
// Device detection for help text
|
| 128 |
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
| 129 |
const isMobile = isIOS || /Android/i.test(navigator.userAgent);
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
`;
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
| 147 |
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
|
| 151 |
-
const containerObserver = new ResizeObserver(() => { /* no-op */ });
|
| 152 |
-
containerObserver.observe(viewerContainerElem);
|
| 153 |
|
| 154 |
// Variable to hold the drag-hide listener reference
|
| 155 |
let dragHide = null;
|
|
@@ -266,10 +275,6 @@ const currentScriptTag = document.currentScript;
|
|
| 266 |
viewerModule.app.resizeCanvas(vw, vh);
|
| 267 |
}
|
| 268 |
|
| 269 |
-
// Dispatch custom event so viewer.js can also trigger its own resize handlers
|
| 270 |
-
const evt = new CustomEvent('viewerFullscreenExit', { detail: { instanceId } });
|
| 271 |
-
window.dispatchEvent(evt);
|
| 272 |
-
|
| 273 |
// Reset fullscreen button icon back to “⇱”
|
| 274 |
fullscreenToggle.textContent = '⇱';
|
| 275 |
|
|
@@ -417,7 +422,7 @@ const currentScriptTag = document.currentScript;
|
|
| 417 |
}
|
| 418 |
});
|
| 419 |
|
| 420 |
-
//
|
| 421 |
let pointsVisible = !!config.showPointsDefault;
|
| 422 |
if (!pointsVisible) {
|
| 423 |
pointsToggleBtn.style.opacity = '0.5';
|
|
|
|
| 80 |
const widgetContainer = document.createElement('div');
|
| 81 |
widgetContainer.id = 'ply-widget-container-' + instanceId;
|
| 82 |
widgetContainer.classList.add('ply-widget-container');
|
| 83 |
+
widgetContainer.style.height = "0"; // Height is controlled via padding-bottom
|
| 84 |
widgetContainer.style.paddingBottom = aspectPercent;
|
| 85 |
widgetContainer.setAttribute('data-original-aspect', aspectPercent);
|
| 86 |
|
| 87 |
+
// Add the 3D-viewer HTML + ⦿ toggle + tooltip markup + help panel container
|
| 88 |
widgetContainer.innerHTML = `
|
| 89 |
<div id="viewer-container-${instanceId}" class="viewer-container">
|
| 90 |
<div id="progress-dialog-${instanceId}" class="progress-dialog">
|
|
|
|
| 127 |
// Device detection for help text
|
| 128 |
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
| 129 |
const isMobile = isIOS || /Android/i.test(navigator.userAgent);
|
| 130 |
+
|
| 131 |
+
// Populate instructions panel with close button + text, and show it by default
|
| 132 |
+
const instructionsText = isMobile
|
| 133 |
+
? `
|
| 134 |
+
<div style="margin-top: 16px;">
|
| 135 |
+
- Pour vous déplacer, glissez deux doigts sur l'écran.<br>
|
| 136 |
+
- Pour orbiter, utilisez un doigt.<br>
|
| 137 |
+
- Pour zoomer, pincez avec deux doigts.<br>
|
| 138 |
+
- Cliquez sur ⦿ pour afficher/masquer les points d’information.
|
| 139 |
+
</div>
|
| 140 |
+
`
|
| 141 |
+
: `
|
| 142 |
+
<div style="margin-top: 16px;">
|
| 143 |
+
- orbitez avec le clic droit<br>
|
| 144 |
+
- zoomez avec la molette<br>
|
| 145 |
+
- déplacez vous avec le clic gauche<br>
|
| 146 |
+
- Cliquez sur ⦿ pour afficher/masquer les points d’information.
|
| 147 |
+
</div>
|
| 148 |
`;
|
| 149 |
+
menuContent.innerHTML = `
|
| 150 |
+
<button id="help-close-${instanceId}" class="help-close">×</button>
|
| 151 |
+
<div>${instructionsText}</div>
|
| 152 |
+
`;
|
| 153 |
+
menuContent.style.display = 'block'; // open by default
|
| 154 |
|
| 155 |
+
// Listener for the ✕ inside help panel
|
| 156 |
+
const helpCloseBtn = document.getElementById(`help-close-${instanceId}`);
|
| 157 |
+
helpCloseBtn.addEventListener('click', () => {
|
| 158 |
+
menuContent.style.display = 'none';
|
| 159 |
+
});
|
| 160 |
|
| 161 |
+
viewerContainerElem.style.display = 'block';
|
|
|
|
|
|
|
| 162 |
|
| 163 |
// Variable to hold the drag-hide listener reference
|
| 164 |
let dragHide = null;
|
|
|
|
| 275 |
viewerModule.app.resizeCanvas(vw, vh);
|
| 276 |
}
|
| 277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
// Reset fullscreen button icon back to “⇱”
|
| 279 |
fullscreenToggle.textContent = '⇱';
|
| 280 |
|
|
|
|
| 422 |
}
|
| 423 |
});
|
| 424 |
|
| 425 |
+
// ⦿ toggle button
|
| 426 |
let pointsVisible = !!config.showPointsDefault;
|
| 427 |
if (!pointsVisible) {
|
| 428 |
pointsToggleBtn.style.opacity = '0.5';
|