mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-25 23:46:51 +00:00
fix: auto-fit column width in Dashboard Files no longer scales with row count
Double-clicking a column resize handle is meant to fit the column to its longest cell. The per-row loop did `maxWidth = Math.max(maxWidth + 10, textWidth)`, which forces `maxWidth` to grow by at least 10px on every row regardless of content — so a folder with N files produced a column ~10*N px wide and persisted that runaway width to KV storage. Compare against the running max only (`Math.max(maxWidth, textWidth)`); `textWidth` already includes cell padding.
This commit is contained in:
@@ -1456,7 +1456,7 @@ const TabFiles = {
|
||||
const fullName = $(this).attr('data-name');
|
||||
if ( fullName ) {
|
||||
const textWidth = measureTextWidth(fullName) + padding;
|
||||
maxWidth = Math.max(maxWidth + 10, textWidth);
|
||||
maxWidth = Math.max(maxWidth, textWidth);
|
||||
}
|
||||
});
|
||||
} else if ( column === 'size' ) {
|
||||
@@ -1464,7 +1464,7 @@ const TabFiles = {
|
||||
const text = $(this).text();
|
||||
if ( text ) {
|
||||
const textWidth = measureTextWidth(text) + padding;
|
||||
maxWidth = Math.max(maxWidth + 10, textWidth);
|
||||
maxWidth = Math.max(maxWidth, textWidth);
|
||||
}
|
||||
});
|
||||
} else if ( column === 'modified' ) {
|
||||
@@ -1472,7 +1472,7 @@ const TabFiles = {
|
||||
const text = $(this).text();
|
||||
if ( text ) {
|
||||
const textWidth = measureTextWidth(text) + padding;
|
||||
maxWidth = Math.max(maxWidth + 10, textWidth);
|
||||
maxWidth = Math.max(maxWidth, textWidth);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user