bilca commited on
Commit
34146b3
·
verified ·
1 Parent(s): 8df2de6

Update interface.js

Browse files
Files changed (1) hide show
  1. 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"; // always zero; padding-bottom controls aspect
84
  widgetContainer.style.paddingBottom = aspectPercent;
85
  widgetContainer.setAttribute('data-original-aspect', aspectPercent);
86
 
87
- // Add the 3D-viewer HTML + 📍 toggle + tooltip markup
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
- if (isMobile) {
131
- menuContent.innerHTML = `
132
- - Pour vous déplacer, glissez deux doigts sur l'écran.<br>
133
- - Pour orbiter, utilisez un doigt.<br>
134
- - Pour zoomer, pincez avec deux doigts.<br>
135
- - Cliquez sur ⦿ pour afficher/masquer les points d’information.
136
- `;
137
- } else {
138
- menuContent.innerHTML = `
139
- - orbitez avec le clic droit<br>
140
- - zoomez avec la molette<br>
141
- - déplacez vous avec le clic gauche<br>
142
- - Cliquez sur ⦿ pour afficher/masquer les points d’information.
 
 
 
 
 
143
  `;
144
- }
145
- // Show instructions panel by default
146
- menuContent.style.display = 'block';
 
 
147
 
148
- viewerContainerElem.style.display = 'block';
 
 
 
 
149
 
150
- // Attach a ResizeObserver to track viewerContainer size changes (no debug logs)
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
- // 📍 toggle button (now “⦿”)
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';