MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / useFileDropzone

Function useFileDropzone

src/hooks/useFileDropzone.ts:17–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15import { processFileDropzoneFiles, type FileDropzoneWorkflowOptions } from './fileDropzoneWorkflow';
16
17export function useFileDropzone() {
18 const {
19 setReconstruction,
20 setWasmReconstruction,
21 setLoadedFiles,
22 setDroppedFiles,
23 setError,
24 setSourceInfo,
25 setUrlLoading,
26 setUrlProgress,
27 } = useReconstructionStore();
28 const resetView = useUIStore((s) => s.resetView);
29
30 /**
31 * Process COLMAP files and build reconstruction.
32 * @param files Map of file paths to File objects
33 * @param progressRange Optional range for progress reporting. Default is 0-100.
34 * When called from URL loader (files already downloaded), use { start: 80, end: 100 }
35 */
36 const processFiles = useCallback(async (
37 files: Map<string, File>,
38 progressRange?: { start: number; end: number },
39 options: Pick<FileDropzoneWorkflowOptions, 'onSceneReplaced' | 'replaceSplatScene' | 'throwOnError'> = {}
40 ) => {
41 await processFileDropzoneFiles(files, {
42 addNotification: useNotificationStore.getState().addNotification,
43 clearSplatPsnr: useImageMetricsStore.getState().clearSplatPsnr,
44 getLoadedFiles: () => useReconstructionStore.getState().loadedFiles,
45 getMinTrackLength: () => usePointCloudStore.getState().minTrackLength,
46 getSourceInfo: () => {
47 const { imageUrlBase, sourceType } = useReconstructionStore.getState();
48 return { imageUrlBase, sourceType };
49 },
50 getUrlLoading: () => useReconstructionStore.getState().urlLoading,
51 logger: appLogger,
52 resetView,
53 setDroppedFiles,
54 setError,
55 setLoadedFiles,
56 setReconstruction,
57 setUrlLoading,
58 setUrlProgress,
59 setWasmReconstruction,
60 }, {
61 progressRange,
62 onSceneReplaced: options.onSceneReplaced,
63 replaceSplatScene: options.replaceSplatScene ?? false,
64 throwOnError: options.throwOnError ?? false,
65 });
66 }, [
67 setReconstruction,
68 setWasmReconstruction,
69 setLoadedFiles,
70 setDroppedFiles,
71 setError,
72 setUrlLoading,
73 setUrlProgress,
74 resetView,

Callers 6

ExportPanel.tsxFile · 0.90
TransformPanel.tsxFile · 0.90
DropZoneFunction · 0.90
useUrlLoaderFunction · 0.90

Calls 10

processFileDropzoneFilesFunction · 0.90
loadLocalZipFileFunction · 0.90
isFileDropFunction · 0.90
loadDropPayloadFunction · 0.90
collectFileDropPayloadFunction · 0.90
collectDroppedFilesFunction · 0.90
loadBrowsedDirectoryFunction · 0.90
showDirectoryPickerMethod · 0.80
preventDefaultMethod · 0.65
stopPropagationMethod · 0.65

Tested by

no test coverage detected