Spaces:
Running
Running
Update interface.js
Browse files- interface.js +11 -9
interface.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
// interface.js
|
| 2 |
// ==============================
|
|
|
|
|
|
|
| 3 |
|
| 4 |
// Store a reference to the <script> tag that loaded this file
|
| 5 |
const currentScriptTag = document.currentScript;
|
|
@@ -81,11 +83,11 @@ const currentScriptTag = document.currentScript;
|
|
| 81 |
|
| 82 |
// Conditionally include the “tooltips-toggle” button only if config.tooltips_url is defined
|
| 83 |
const tooltipsButtonHTML = config.tooltips_url
|
| 84 |
-
?
|
| 85 |
: '';
|
| 86 |
|
| 87 |
// Add the 3D-viewer HTML + tooltip + help HTML
|
| 88 |
-
widgetContainer.innerHTML =
|
| 89 |
<div id="viewer-container-${instanceId}" class="viewer-container">
|
| 90 |
<div id="progress-dialog-${instanceId}" class="progress-dialog">
|
| 91 |
<progress id="progress-indicator-${instanceId}" max="100" value="0"></progress>
|
|
@@ -108,7 +110,7 @@ const currentScriptTag = document.currentScript;
|
|
| 108 |
<img id="tooltip-image" class="tooltip-image" src="" alt="" style="display: none;" />
|
| 109 |
</div>
|
| 110 |
</div>
|
| 111 |
-
|
| 112 |
|
| 113 |
// Append the widget container immediately after the <script> tag
|
| 114 |
scriptTag.parentNode.appendChild(widgetContainer);
|
|
@@ -140,23 +142,23 @@ const currentScriptTag = document.currentScript;
|
|
| 140 |
|
| 141 |
// Fill help text with instructions plus the two new French lines
|
| 142 |
if (isMobile) {
|
| 143 |
-
helpTextDiv.innerHTML =
|
| 144 |
- Pour vous déplacer, glissez deux doigts sur l'écran.<br>
|
| 145 |
- Pour orbiter, utilisez un doigt.<br>
|
| 146 |
- Pour zoomer, pincez avec deux doigts.<br>
|
| 147 |
${tooltipInstruction}
|
| 148 |
- ⟲ Réinitialise la caméra.<br>
|
| 149 |
- ⇱ Passe en plein écran.<br>
|
| 150 |
-
|
| 151 |
} else {
|
| 152 |
-
helpTextDiv.innerHTML =
|
| 153 |
- orbitez avec le clic droit<br>
|
| 154 |
- zoomez avec la molette<br>
|
| 155 |
- déplacez vous avec le clic gauche<br>
|
| 156 |
${tooltipInstruction}
|
| 157 |
- ⟲ Réinitialise la caméra.<br>
|
| 158 |
- ⇱ Passe en plein écran.<br>
|
| 159 |
-
|
| 160 |
}
|
| 161 |
|
| 162 |
// Ensure instructions panel is visible by default
|
|
@@ -358,7 +360,7 @@ const currentScriptTag = document.currentScript;
|
|
| 358 |
|
| 359 |
document.addEventListener('tooltip-selected', (evt) => {
|
| 360 |
const { title, description, imgUrl } = evt.detail;
|
| 361 |
-
tooltipTextDiv.innerHTML =
|
| 362 |
if (imgUrl) {
|
| 363 |
tooltipImage.src = imgUrl;
|
| 364 |
tooltipImage.style.display = 'block';
|
|
@@ -399,4 +401,4 @@ const currentScriptTag = document.currentScript;
|
|
| 399 |
document.dispatchEvent(new CustomEvent('toggle-tooltips', { detail: { visible: !!config.showTooltipsDefault } }));
|
| 400 |
}, 200);
|
| 401 |
|
| 402 |
-
})();
|
|
|
|
| 1 |
// interface.js
|
| 2 |
// ==============================
|
| 3 |
+
// interface.js
|
| 4 |
+
// ==============================
|
| 5 |
|
| 6 |
// Store a reference to the <script> tag that loaded this file
|
| 7 |
const currentScriptTag = document.currentScript;
|
|
|
|
| 83 |
|
| 84 |
// Conditionally include the “tooltips-toggle” button only if config.tooltips_url is defined
|
| 85 |
const tooltipsButtonHTML = config.tooltips_url
|
| 86 |
+
? `<button id="tooltips-toggle-${instanceId}" class="widget-button tooltips-toggle">⦿</button>`
|
| 87 |
: '';
|
| 88 |
|
| 89 |
// Add the 3D-viewer HTML + tooltip + help HTML
|
| 90 |
+
widgetContainer.innerHTML = `
|
| 91 |
<div id="viewer-container-${instanceId}" class="viewer-container">
|
| 92 |
<div id="progress-dialog-${instanceId}" class="progress-dialog">
|
| 93 |
<progress id="progress-indicator-${instanceId}" max="100" value="0"></progress>
|
|
|
|
| 110 |
<img id="tooltip-image" class="tooltip-image" src="" alt="" style="display: none;" />
|
| 111 |
</div>
|
| 112 |
</div>
|
| 113 |
+
`;
|
| 114 |
|
| 115 |
// Append the widget container immediately after the <script> tag
|
| 116 |
scriptTag.parentNode.appendChild(widgetContainer);
|
|
|
|
| 142 |
|
| 143 |
// Fill help text with instructions plus the two new French lines
|
| 144 |
if (isMobile) {
|
| 145 |
+
helpTextDiv.innerHTML = `
|
| 146 |
- Pour vous déplacer, glissez deux doigts sur l'écran.<br>
|
| 147 |
- Pour orbiter, utilisez un doigt.<br>
|
| 148 |
- Pour zoomer, pincez avec deux doigts.<br>
|
| 149 |
${tooltipInstruction}
|
| 150 |
- ⟲ Réinitialise la caméra.<br>
|
| 151 |
- ⇱ Passe en plein écran.<br>
|
| 152 |
+
`;
|
| 153 |
} else {
|
| 154 |
+
helpTextDiv.innerHTML = `
|
| 155 |
- orbitez avec le clic droit<br>
|
| 156 |
- zoomez avec la molette<br>
|
| 157 |
- déplacez vous avec le clic gauche<br>
|
| 158 |
${tooltipInstruction}
|
| 159 |
- ⟲ Réinitialise la caméra.<br>
|
| 160 |
- ⇱ Passe en plein écran.<br>
|
| 161 |
+
`;
|
| 162 |
}
|
| 163 |
|
| 164 |
// Ensure instructions panel is visible by default
|
|
|
|
| 360 |
|
| 361 |
document.addEventListener('tooltip-selected', (evt) => {
|
| 362 |
const { title, description, imgUrl } = evt.detail;
|
| 363 |
+
tooltipTextDiv.innerHTML = `<strong>${title}</strong><br>${description}`;
|
| 364 |
if (imgUrl) {
|
| 365 |
tooltipImage.src = imgUrl;
|
| 366 |
tooltipImage.style.display = 'block';
|
|
|
|
| 401 |
document.dispatchEvent(new CustomEvent('toggle-tooltips', { detail: { visible: !!config.showTooltipsDefault } }));
|
| 402 |
}, 200);
|
| 403 |
|
| 404 |
+
})();
|