Update interface.js
Browse files- interface.js +22 -5
interface.js
CHANGED
|
@@ -141,12 +141,13 @@ const currentScriptTag = document.currentScript;
|
|
| 141 |
'- Cliquez sur ⇱ pour passer en plein écran.<br>';
|
| 142 |
}
|
| 143 |
|
| 144 |
-
|
| 145 |
-
// --- Limit menu-content max size to 80% of the viewer (on mobile) ---
|
| 146 |
function setMenuContentMaxSize() {
|
| 147 |
if (!isMobile) {
|
| 148 |
menuContent.style.maxWidth = "";
|
| 149 |
menuContent.style.maxHeight = "";
|
|
|
|
|
|
|
| 150 |
menuContent.style.overflowY = "";
|
| 151 |
menuContent.style.overflowX = "";
|
| 152 |
return;
|
|
@@ -158,11 +159,15 @@ const currentScriptTag = document.currentScript;
|
|
| 158 |
if (vw && vh) {
|
| 159 |
menuContent.style.maxWidth = Math.round(vw * 0.8) + "px";
|
| 160 |
menuContent.style.maxHeight = Math.round(vh * 0.8) + "px";
|
|
|
|
|
|
|
| 161 |
menuContent.style.overflowY = "auto";
|
| 162 |
menuContent.style.overflowX = "auto";
|
| 163 |
} else {
|
| 164 |
menuContent.style.maxWidth = "80vw";
|
| 165 |
menuContent.style.maxHeight = "80vh";
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
}
|
| 168 |
}
|
|
@@ -170,8 +175,8 @@ const currentScriptTag = document.currentScript;
|
|
| 170 |
window.addEventListener('resize', setMenuContentMaxSize);
|
| 171 |
document.addEventListener('fullscreenchange', setMenuContentMaxSize);
|
| 172 |
window.addEventListener('orientationchange', setMenuContentMaxSize);
|
| 173 |
-
|
| 174 |
|
|
|
|
| 175 |
menuContent.style.display = isMobile ? 'none' : 'block';
|
| 176 |
|
| 177 |
viewerContainerElem.style.display = 'block';
|
|
@@ -270,6 +275,7 @@ const currentScriptTag = document.currentScript;
|
|
| 270 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇱';
|
| 271 |
|
| 272 |
savedState = null;
|
|
|
|
| 273 |
}
|
| 274 |
|
| 275 |
function applyFullscreenStyles() {
|
|
@@ -296,6 +302,7 @@ const currentScriptTag = document.currentScript;
|
|
| 296 |
|
| 297 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇲';
|
| 298 |
isFullscreen = true;
|
|
|
|
| 299 |
}
|
| 300 |
|
| 301 |
function enterFullscreen() {
|
|
@@ -324,6 +331,7 @@ const currentScriptTag = document.currentScript;
|
|
| 324 |
restoreOriginalStyles();
|
| 325 |
isFullscreen = false;
|
| 326 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇱';
|
|
|
|
| 327 |
}
|
| 328 |
|
| 329 |
fullscreenToggle.addEventListener('click', () => {
|
|
@@ -339,12 +347,19 @@ const currentScriptTag = document.currentScript;
|
|
| 339 |
} else if (document.fullscreenElement === widgetContainer) {
|
| 340 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇲';
|
| 341 |
}
|
|
|
|
| 342 |
});
|
| 343 |
|
| 344 |
helpToggle.addEventListener('click', (e) => {
|
| 345 |
hideTooltipPanel();
|
| 346 |
e.stopPropagation();
|
| 347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
});
|
| 349 |
helpCloseBtn.addEventListener('click', hideHelpPanel);
|
| 350 |
|
|
@@ -368,7 +383,7 @@ const currentScriptTag = document.currentScript;
|
|
| 368 |
|
| 369 |
tooltipCloseBtn.addEventListener('click', hideTooltipPanel);
|
| 370 |
|
| 371 |
-
|
| 372 |
// Always show panel, cancel hide first
|
| 373 |
if (dragHide) {
|
| 374 |
viewerContainerElem.removeEventListener('pointermove', dragHide);
|
|
@@ -416,11 +431,13 @@ const currentScriptTag = document.currentScript;
|
|
| 416 |
);
|
| 417 |
}
|
| 418 |
}
|
|
|
|
| 419 |
});
|
| 420 |
|
| 421 |
setTimeout(() => {
|
| 422 |
saveCurrentState();
|
| 423 |
document.dispatchEvent(new CustomEvent('toggle-tooltips', { detail: { visible: !!config.showTooltipsDefault } }));
|
|
|
|
| 424 |
}, 200);
|
| 425 |
|
| 426 |
})();
|
|
|
|
| 141 |
'- Cliquez sur ⇱ pour passer en plein écran.<br>';
|
| 142 |
}
|
| 143 |
|
| 144 |
+
// --- DYNAMIC MENU SIZING ---
|
|
|
|
| 145 |
function setMenuContentMaxSize() {
|
| 146 |
if (!isMobile) {
|
| 147 |
menuContent.style.maxWidth = "";
|
| 148 |
menuContent.style.maxHeight = "";
|
| 149 |
+
menuContent.style.width = "";
|
| 150 |
+
menuContent.style.height = "";
|
| 151 |
menuContent.style.overflowY = "";
|
| 152 |
menuContent.style.overflowX = "";
|
| 153 |
return;
|
|
|
|
| 159 |
if (vw && vh) {
|
| 160 |
menuContent.style.maxWidth = Math.round(vw * 0.8) + "px";
|
| 161 |
menuContent.style.maxHeight = Math.round(vh * 0.8) + "px";
|
| 162 |
+
menuContent.style.width = ""; // Let it shrink if smaller
|
| 163 |
+
menuContent.style.height = "";
|
| 164 |
menuContent.style.overflowY = "auto";
|
| 165 |
menuContent.style.overflowX = "auto";
|
| 166 |
} else {
|
| 167 |
menuContent.style.maxWidth = "80vw";
|
| 168 |
menuContent.style.maxHeight = "80vh";
|
| 169 |
+
menuContent.style.overflowY = "auto";
|
| 170 |
+
menuContent.style.overflowX = "auto";
|
| 171 |
}
|
| 172 |
}
|
| 173 |
}
|
|
|
|
| 175 |
window.addEventListener('resize', setMenuContentMaxSize);
|
| 176 |
document.addEventListener('fullscreenchange', setMenuContentMaxSize);
|
| 177 |
window.addEventListener('orientationchange', setMenuContentMaxSize);
|
|
|
|
| 178 |
|
| 179 |
+
// --- HELP PANEL DEFAULT VISIBILITY ---
|
| 180 |
menuContent.style.display = isMobile ? 'none' : 'block';
|
| 181 |
|
| 182 |
viewerContainerElem.style.display = 'block';
|
|
|
|
| 275 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇱';
|
| 276 |
|
| 277 |
savedState = null;
|
| 278 |
+
setMenuContentMaxSize();
|
| 279 |
}
|
| 280 |
|
| 281 |
function applyFullscreenStyles() {
|
|
|
|
| 302 |
|
| 303 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇲';
|
| 304 |
isFullscreen = true;
|
| 305 |
+
setMenuContentMaxSize();
|
| 306 |
}
|
| 307 |
|
| 308 |
function enterFullscreen() {
|
|
|
|
| 331 |
restoreOriginalStyles();
|
| 332 |
isFullscreen = false;
|
| 333 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇱';
|
| 334 |
+
setMenuContentMaxSize();
|
| 335 |
}
|
| 336 |
|
| 337 |
fullscreenToggle.addEventListener('click', () => {
|
|
|
|
| 347 |
} else if (document.fullscreenElement === widgetContainer) {
|
| 348 |
if (fullscreenToggle) fullscreenToggle.textContent = '⇲';
|
| 349 |
}
|
| 350 |
+
setMenuContentMaxSize();
|
| 351 |
});
|
| 352 |
|
| 353 |
helpToggle.addEventListener('click', (e) => {
|
| 354 |
hideTooltipPanel();
|
| 355 |
e.stopPropagation();
|
| 356 |
+
// Toggle menu panel
|
| 357 |
+
if (menuContent.style.display === 'block') {
|
| 358 |
+
menuContent.style.display = 'none';
|
| 359 |
+
} else {
|
| 360 |
+
menuContent.style.display = 'block';
|
| 361 |
+
setMenuContentMaxSize();
|
| 362 |
+
}
|
| 363 |
});
|
| 364 |
helpCloseBtn.addEventListener('click', hideHelpPanel);
|
| 365 |
|
|
|
|
| 383 |
|
| 384 |
tooltipCloseBtn.addEventListener('click', hideTooltipPanel);
|
| 385 |
|
| 386 |
+
document.addEventListener('tooltip-selected', (evt) => {
|
| 387 |
// Always show panel, cancel hide first
|
| 388 |
if (dragHide) {
|
| 389 |
viewerContainerElem.removeEventListener('pointermove', dragHide);
|
|
|
|
| 431 |
);
|
| 432 |
}
|
| 433 |
}
|
| 434 |
+
setMenuContentMaxSize();
|
| 435 |
});
|
| 436 |
|
| 437 |
setTimeout(() => {
|
| 438 |
saveCurrentState();
|
| 439 |
document.dispatchEvent(new CustomEvent('toggle-tooltips', { detail: { visible: !!config.showTooltipsDefault } }));
|
| 440 |
+
setMenuContentMaxSize();
|
| 441 |
}, 200);
|
| 442 |
|
| 443 |
})();
|