From 9e80683b9ac15ca73747512742e4c72afa59bfc4 Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 27 Mar 2026 17:59:58 -0600 Subject: [PATCH] Adding model dimensions to STL preview. --- app/src/components/FilePreview.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/components/FilePreview.js b/app/src/components/FilePreview.js index 3c89aa32..4637660a 100644 --- a/app/src/components/FilePreview.js +++ b/app/src/components/FilePreview.js @@ -124,18 +124,29 @@ function getAudioPreviewModal(previewFile) { } -function getSTLPreviewModal(previewFile) { +function STLPreviewModal({previewFile}) { + const [dimensions, setDimensions] = React.useState(null); const url = getMediaPathURL(previewFile); const path = previewFile.primary_path ?? previewFile.path; const name = path.replace(/^.*[\\\/]/, ''); return {name} + {dimensions &&
+ Width: {dimensions.width.toFixed(2)} + {' | '} + Height: {dimensions.height.toFixed(2)} + {' | '} + Length: {dimensions.length.toFixed(2)} + {' | '} + Bounding Radius: {dimensions.boundingRadius.toFixed(2)} +
} setDimensions(dims)} />
@@ -357,11 +368,11 @@ export function FilePreviewProvider({children}) { } else if (mimetype.startsWith('image/')) { setModalContent(getImagePreviewModal(previewFile), url, null, path, taggable); } else if (mimetype.startsWith('model/stl')) { - setModalContent(getSTLPreviewModal(previewFile), null, downloadURL, path, taggable); + setModalContent(, null, downloadURL, path, taggable); } else if (mimetype.startsWith('application/octet-stream') && lowerPath.endsWith('.mp3')) { setModalContent(getAudioPreviewModal(previewFile), url, downloadURL, path, taggable); } else if (mimetype.startsWith('application/octet-stream') && lowerPath.endsWith('.stl')) { - setModalContent(getSTLPreviewModal(previewFile), null, downloadURL, path, taggable); + setModalContent(, null, downloadURL, path, taggable); } else if (mimetype.includes('cbz') || mimetype.includes('cbr') || mimetype.includes('comicbook+zip') || mimetype.includes('comicbook-rar') || lowerPath.endsWith('.cbz') || lowerPath.endsWith('.cbr') || lowerPath.endsWith('.cbt') || lowerPath.endsWith('.cb7')) { setModalContent(, null, downloadURL, path, taggable);