MCPcopy Create free account
hub / github.com/error311/FileRise / syncFolderIconSizeToRowHeight

Function syncFolderIconSizeToRowHeight

public/js/fileListView.js:7078–7113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7076 syncFolderIconSizeToRowHeight();
7077}
7078function syncFolderIconSizeToRowHeight() {
7079 const cs = getComputedStyle(document.documentElement);
7080 const raw = cs.getPropertyValue('--file-row-height') || '44px';
7081 const rowH = parseInt(raw, 10) || 60;
7082
7083 const FUDGE = 1;
7084 const MAX_GROWTH_ROW = 44; // after this, stop growing the icon
7085
7086 const BASE_ROW_FOR_OFFSET = 20; // where icon looks centered
7087 const OFFSET_FACTOR = -0.10;
7088 const effectiveRow = Math.min(rowH, MAX_GROWTH_ROW);
7089
7090 const boxSize = Math.max(20, Math.min(35, effectiveRow - 20 + FUDGE));
7091 const scale = 1.20;
7092
7093 // use existing offset curve
7094 const clampedForOffset = Math.max(30, Math.min(60, rowH));
7095 let offsetY = (clampedForOffset - BASE_ROW_FOR_OFFSET) * OFFSET_FACTOR;
7096 if (rowH > 53) {
7097 offsetY -= -2;
7098 }
7099
7100 document.querySelectorAll(':is(#fileList, #fileListSecondary) .folder-row-icon').forEach(iconSpan => {
7101 iconSpan.style.width = boxSize + 'px';
7102 iconSpan.style.height = boxSize + 'px';
7103 iconSpan.style.overflow = 'visible';
7104
7105 const svg = iconSpan.querySelector('svg');
7106 if (!svg) return;
7107
7108 svg.setAttribute('width', String(boxSize));
7109 svg.setAttribute('height', String(boxSize));
7110 svg.style.transformOrigin = 'left center';
7111 svg.style.transform = `translateY(${offsetY}px) scale(${scale})`;
7112 });
7113}
7114
7115async function sortSubfoldersForCurrentOrder(subfolders) {
7116 const base = Array.isArray(subfolders) ? [...subfolders] : [];

Callers 4

applyRowHeightFunction · 0.85
attachStripIconAsyncFunction · 0.85
injectInlineFolderRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected