aaurelions commited on
Commit
e0f547f
·
verified ·
1 Parent(s): 0aceb48

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +24 -7
index.html CHANGED
@@ -81,7 +81,7 @@
81
  <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /></svg>
82
  </button>
83
  </div>
84
- <div id="model-selector" class="panel-content flex-grow overflow-y-auto px-2 space-y-1 pb-5"></div>
85
  </div>
86
  </aside>
87
 
@@ -210,23 +210,40 @@
210
  function setupUI() {
211
  const modelSelector = document.getElementById('model-selector');
212
  modelFiles.forEach(fileName => {
213
- const btn = document.createElement('button');
214
- btn.textContent = fileName.replace('.glb', '').replace(/(\d)/, ' $1').toUpperCase();
215
- btn.className = 'list-item w-full text-left px-4 py-3 rounded-lg text-white';
216
- btn.dataset.model = fileName;
217
- btn.onclick = () => loadAndSwitchModel(fileName);
218
- modelSelector.appendChild(btn);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  });
 
220
  const panoramaGallery = document.getElementById('panorama-gallery');
221
  panoramaFiles.forEach(fileName => {
222
  const container = document.createElement('div');
223
  container.className = 'list-item aspect-video rounded-lg overflow-hidden cursor-pointer ring-2 ring-transparent';
224
  container.dataset.image = fileName;
225
  container.onclick = () => setPanorama(fileName);
 
226
  const thumb = document.createElement('img');
227
  thumb.src = `/jpg/thumbnails/${fileName}`;
228
  thumb.className = 'w-full h-full object-cover';
229
  thumb.alt = `Thumbnail for ${fileName}`;
 
230
  container.appendChild(thumb);
231
  panoramaGallery.appendChild(container);
232
  });
 
81
  <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /></svg>
82
  </button>
83
  </div>
84
+ <div id="model-selector" class="panel-content flex-grow overflow-y-auto px-2 space-y-2 pb-5"></div>
85
  </div>
86
  </aside>
87
 
 
210
  function setupUI() {
211
  const modelSelector = document.getElementById('model-selector');
212
  modelFiles.forEach(fileName => {
213
+ const container = document.createElement('div');
214
+ container.className = 'list-item w-full flex items-center p-2 rounded-lg cursor-pointer';
215
+ container.dataset.model = fileName;
216
+ container.onclick = () => loadAndSwitchModel(fileName);
217
+
218
+ const thumb = document.createElement('img');
219
+ // Assumes a .png thumbnail exists for each .glb model in '/glb/thumbnails/'
220
+ thumb.src = `/glb/thumbnails/${fileName.replace('.glb', '.png')}`;
221
+ thumb.alt = `Thumbnail for ${fileName}`;
222
+ thumb.className = 'w-20 h-16 object-cover rounded-md mr-3 bg-gray-800';
223
+ // Basic error handling for thumbnails
224
+ thumb.onerror = () => { thumb.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; };
225
+
226
+ const name = document.createElement('span');
227
+ name.textContent = fileName.replace('.glb', '').replace(/(\d)/, ' $1').toUpperCase();
228
+ name.className = 'text-white font-medium';
229
+
230
+ container.appendChild(thumb);
231
+ container.appendChild(name);
232
+ modelSelector.appendChild(container);
233
  });
234
+
235
  const panoramaGallery = document.getElementById('panorama-gallery');
236
  panoramaFiles.forEach(fileName => {
237
  const container = document.createElement('div');
238
  container.className = 'list-item aspect-video rounded-lg overflow-hidden cursor-pointer ring-2 ring-transparent';
239
  container.dataset.image = fileName;
240
  container.onclick = () => setPanorama(fileName);
241
+
242
  const thumb = document.createElement('img');
243
  thumb.src = `/jpg/thumbnails/${fileName}`;
244
  thumb.className = 'w-full h-full object-cover';
245
  thumb.alt = `Thumbnail for ${fileName}`;
246
+
247
  container.appendChild(thumb);
248
  panoramaGallery.appendChild(container);
249
  });