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

Function toggleModelSelection

renderer.js:11693–11732  ·  view source on GitHub ↗
(fileElement, filePath)

Source from the content-addressed store, hash-verified

11691 // Debug log for initialization
11692 debugLog('Multi-edit panel initialization complete');
11693
11694 } catch (error) {
11695 console.error('Error during application initialization:', error);
11696 }
11697 });
11698
11699 // ... existing code ...
11700});
11701
11702async function updateSelectedCount() {
11703 const countElement = document.querySelector('.selected-count');
11704 if (countElement) {
11705 countElement.textContent = `${selectedModels.size} model${selectedModels.size !== 1 ? 's' : ''} selected`;
11706 }
11707
11708 // Clear tags when selection changes significantly (new group of files selected)
11709 clearTagsOnSelectionChange();
11710
11711 // Clear multi-edit form fields when no models are selected
11712 if (selectedModels.size === 0 && isMultiSelectMode) {
11713 clearMultiEditFormFields();
11714 }
11715
11716 // Refresh the remove tag dropdown when selection changes (if in multi-edit mode)
11717 if (isMultiSelectMode && selectedModels.size > 0) {
11718 await populateRemoveTagSelect();
11719 }
11720}
11721
11722// Track previous selection to detect when a completely new selection is made
11723let previousSelectionHash = '';
11724
11725function clearTagsOnSelectionChange() {
11726 // Create a hash of current selection to detect complete selection changes
11727 const currentSelectionHash = selectedModels.size > 0
11728 ? Array.from(selectedModels).sort().join('|')
11729 : '';
11730
11731 // If selection was cleared (went from >0 to 0), mark for clearing on next selection
11732 if (previousSelectionHash && selectedModels.size === 0) {
11733 previousSelectionHash = ''; // Reset so next selection is treated as new
11734 return;
11735 }

Callers 2

renderFileFunction · 0.85
createModelItemFunction · 0.85

Calls 2

showModelDetailsFunction · 0.85
updateSelectedCountFunction · 0.85

Tested by

no test coverage detected