MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / initializeVirtualScrolling

Function initializeVirtualScrolling

renderer.js:11248–11341  ·  view source on GitHub ↗
(modelRefs)

Source from the content-addressed store, hash-verified

11246 }
11247
11248 } catch (error) {
11249 console.error('Error in thumbnail generation:', error);
11250 } finally {
11251 // Hide progress section after a short delay
11252 if (hasProgressUI) {
11253 setTimeout(() => {
11254 progressSection.classList.add('hidden');
11255 }, 2000);
11256 }
11257 }
11258 }
11259
11260 // Add these constants at the top of the file (if not already present)
11261 const PAGE_SIZE = 100; // Number of models to keep in memory
11262 let allFilteredModels = []; // Store all filtered models (references only)
11263 let visibleModels = []; // Store currently visible models (full data)
11264 let currentPage = 0;
11265 let isVirtualScrolling = false;
11266
11267 // Update the view-library-button click handler
11268 document.getElementById('view-library-button')?.addEventListener('click', async () => {
11269 try {
11270 window.disableGridRefresh = false;
11271 const gridEl = document.querySelector('.file-grid');
11272 if (gridEl) gridEl.currentModels = null;
11273 window.dateAddedFilter = null;
11274 window._lastDateAddedFilter = null;
11275 document.getElementById('designer-select').value = '';
11276 document.getElementById('license-select').value = '';
11277 document.getElementById('parent-select').value = '';
11278 document.getElementById('printed-select').value = 'all';
11279 const newSelVl2 = document.getElementById('new-select');
11280 if (newSelVl2) newSelVl2.value = 'all';
11281 document.getElementById('tag-filter').value = '';
11282 document.getElementById('filetype-select').value = '';
11283 document.getElementById('search-filter-input').value = '';
11284 window.currentDirectoryFilter = "";
11285 const viewLibMsg = document.getElementById("view-library-message");
11286 if (viewLibMsg) viewLibMsg.style.display = "none";
11287 window.viewingEntireLibrary = true;
11288 if (typeof window.resetCurrentFilterPanelShell === "function") {
11289 window.resetCurrentFilterPanelShell();
11290 } else {
11291 const filterIndicator = document.getElementById("current-filter");
11292 if (filterIndicator) {
11293 filterIndicator.innerHTML = "";
11294 filterIndicator.classList.remove("visible");
11295 }
11296 }
11297 if (typeof window.forceGridRefresh === 'function') {
11298 await window.forceGridRefresh();
11299 } else if (typeof window.performCombinedSearch === 'function') {
11300 await window.performCombinedSearch();
11301 }
11302 console.log("Viewing entire library");
11303 } catch (error) {
11304 console.error('Error loading library:', error);
11305 await window.electron.showMessage('Error', 'Failed to load library.');

Callers

nothing calls this directly

Calls 6

updateModelCountsFunction · 0.85
addThumbnailMenuButtonFunction · 0.85
autoSaveModelFunction · 0.85
handleFileClickFunction · 0.85
addContextMenuHandlerFunction · 0.85
loadAndRenderModelsFunction · 0.85

Tested by

no test coverage detected