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

Function showDuplicateFiles

renderer.js:15382–15510  ·  view source on GitHub ↗
(duplicates)

Source from the content-addressed store, hash-verified

15380 // Clear multi-edit form fields when no models are selected
15381 if (selectedModels.size === 0 && isMultiSelectMode) {
15382 clearMultiEditFormFields();
15383 }
15384
15385 // Refresh the remove tag dropdown when selection changes (if in multi-edit mode)
15386 if (isMultiSelectMode && selectedModels.size > 0) {
15387 await populateRemoveTagSelect();
15388 }
15389}
15390
15391// Track previous selection to detect when a completely new selection is made
15392let previousSelectionHash = '';
15393
15394function clearTagsOnSelectionChange() {
15395 // Create a hash of current selection to detect complete selection changes
15396 const currentSelectionHash = selectedModels.size > 0
15397 ? Array.from(selectedModels).sort().join('|')
15398 : '';
15399
15400 // If selection was cleared (went from >0 to 0), mark for clearing on next selection
15401 if (previousSelectionHash && selectedModels.size === 0) {
15402 previousSelectionHash = ''; // Reset so next selection is treated as new
15403 return;
15404 }
15405
15406 // If this is a completely new selection (no overlap with previous), clear tags
15407 if (previousSelectionHash && currentSelectionHash &&
15408 previousSelectionHash !== currentSelectionHash &&
15409 selectedModels.size > 0) {
15410 // Check if there's any overlap - if no overlap, it's a completely new selection
15411 const previousFiles = new Set(previousSelectionHash.split('|'));
15412 const currentFiles = new Set(currentSelectionHash.split('|'));
15413 const hasOverlap = Array.from(currentFiles).some(file => previousFiles.has(file));
15414
15415 // If no overlap, clear tags as this is a completely new selection
15416 if (!hasOverlap) {
15417 const multiTagsContainer = document.getElementById('multi-tags');
15418 if (multiTagsContainer) {
15419 multiTagsContainer.innerHTML = '';
15420 }
15421 const multiTagSelect = document.getElementById('multi-tag-select');
15422 if (multiTagSelect) {
15423 multiTagSelect.value = '';
15424 }
15425 }
15426 }
15427
15428 // Update tracking variable
15429 previousSelectionHash = currentSelectionHash;
15430}
15431
15432function isMobileUiActive() {
15433 return document.body.classList.contains('mobile-ui');
15434}
15435
15436function clearMobileTileFocus() {
15437 document.querySelectorAll('.is-mobile-focus').forEach((el) => el.classList.remove('is-mobile-focus'));
15438}
15439

Callers

nothing calls this directly

Calls 2

renderModelToPNGFunction · 0.85
formatFileSizeFunction · 0.85

Tested by

no test coverage detected