@collabdt/core 0.11.2 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.js.map +1 -1
- package/dist/core/components/ui/uploadFile.d.ts +3 -2
- package/dist/core/components/ui/uploadFile.d.ts.map +1 -1
- package/dist/core/components/ui/uploadFile.js +8 -7
- package/dist/core/components/ui/uploadFile.js.map +1 -1
- package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
- package/dist/core/components/viewers/Viewer.js +7 -10
- package/dist/core/components/viewers/Viewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/usePlaceableFileRows.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/usePlaceableFileRows.js +12 -13
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/usePlaceableFileRows.js.map +1 -1
- package/dist/core/components/viewers/bim/src/Splats/splatPlacementStore.d.ts +3 -3
- package/dist/core/components/viewers/bim/src/Splats/splatPlacementStore.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/Splats/splatPlacementStore.js +2 -18
- package/dist/core/components/viewers/bim/src/Splats/splatPlacementStore.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts +1 -1
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js +2 -2
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/buildingLocationParams.d.ts +1 -0
- package/dist/core/components/viewers/bim/src/lib/buildingLocationParams.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/buildingLocationParams.js +10 -2
- package/dist/core/components/viewers/bim/src/lib/buildingLocationParams.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/useViewerLocation.d.ts +1 -1
- package/dist/core/components/viewers/bim/src/lib/useViewerLocation.js.map +1 -1
- package/dist/core/components/viewers/bim/utils/setCameraLookAt.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/utils/setCameraLookAt.js +13 -14
- package/dist/core/components/viewers/bim/utils/setCameraLookAt.js.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.js +11 -8
- package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.js +16 -8
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.js.map +1 -1
- package/dist/core/components/viewers/map/src/Geocoder.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/Geocoder.js +23 -20
- package/dist/core/components/viewers/map/src/Geocoder.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.js +7 -6
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/FileModelLayer/FileModelLayer.js +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/FileModelLayer/FileModelLayer.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/utils/CustomModelLayer.js +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/utils/CustomModelLayer.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.js +12 -23
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useDatasetFeatures.d.ts +23 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useDatasetFeatures.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useDatasetFeatures.js +67 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useDatasetFeatures.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useViewportDatasetToast.d.ts +4 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useViewportDatasetToast.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useViewportDatasetToast.js +24 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/useViewportDatasetToast.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/LocationSettings.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/LocationSettings.js +12 -32
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/LocationSettings.js.map +1 -1
- package/dist/core/components/viewers/map/src/Placement/MapPlacementHost.js +1 -1
- package/dist/core/components/viewers/map/src/Placement/MapPlacementHost.js.map +1 -1
- package/dist/core/components/viewers/map/src/Placement/mapPlacementGeo.d.ts +1 -1
- package/dist/core/components/viewers/map/src/Placement/mapPlacementGeo.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/Placement/mapPlacementGeo.js +2 -2
- package/dist/core/components/viewers/map/src/Placement/mapPlacementGeo.js.map +1 -1
- package/dist/core/components/viewers/map/src/Placement/mapPlacementTarget.js +1 -1
- package/dist/core/components/viewers/map/src/Placement/mapPlacementTarget.js.map +1 -1
- package/dist/core/components/viewers/map/src/Placement/useMapPlacementTarget.js +1 -1
- package/dist/core/components/viewers/map/src/Placement/useMapPlacementTarget.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/shareMapTool.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/shareMapTool.js +24 -14
- package/dist/core/components/viewers/map/src/tools/shareMapTool.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoder.d.ts +1 -0
- package/dist/core/components/viewers/map/utils/geocoder.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoder.js +5 -0
- package/dist/core/components/viewers/map/utils/geocoder.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/adapters.d.ts +2 -0
- package/dist/core/components/viewers/map/utils/geocoding/adapters.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/adapters.js +8 -1
- package/dist/core/components/viewers/map/utils/geocoding/adapters.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/index.d.ts +3 -0
- package/dist/core/components/viewers/map/utils/geocoding/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/index.js +20 -3
- package/dist/core/components/viewers/map/utils/geocoding/index.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/osm.d.ts +2 -0
- package/dist/core/components/viewers/map/utils/geocoding/osm.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/osm.js +32 -1
- package/dist/core/components/viewers/map/utils/geocoding/osm.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/pelias.d.ts +2 -0
- package/dist/core/components/viewers/map/utils/geocoding/pelias.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/pelias.js +30 -1
- package/dist/core/components/viewers/map/utils/geocoding/pelias.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/placeSearch.d.ts +17 -0
- package/dist/core/components/viewers/map/utils/geocoding/placeSearch.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/placeSearch.js +26 -0
- package/dist/core/components/viewers/map/utils/geocoding/placeSearch.js.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationParams.d.ts +38 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationParams.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationParams.js +91 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationParams.js.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationTarget.d.ts +25 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationTarget.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationTarget.js +71 -0
- package/dist/core/components/viewers/map/utils/urlLocation/locationTarget.js.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/resolveLocationTarget.d.ts +20 -0
- package/dist/core/components/viewers/map/utils/urlLocation/resolveLocationTarget.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/resolveLocationTarget.js +103 -0
- package/dist/core/components/viewers/map/utils/urlLocation/resolveLocationTarget.js.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/useUrlFlyTo.d.ts +4 -0
- package/dist/core/components/viewers/map/utils/urlLocation/useUrlFlyTo.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/urlLocation/useUrlFlyTo.js +72 -0
- package/dist/core/components/viewers/map/utils/urlLocation/useUrlFlyTo.js.map +1 -0
- package/dist/core/components/viewers/shared/intake/useFileIntake.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/intake/useFileIntake.js +3 -26
- package/dist/core/components/viewers/shared/intake/useFileIntake.js.map +1 -1
- package/dist/core/components/viewers/shared/placement/fileTransform.d.ts +9 -0
- package/dist/core/components/viewers/shared/placement/fileTransform.d.ts.map +1 -0
- package/dist/core/components/viewers/shared/placement/fileTransform.js +32 -0
- package/dist/core/components/viewers/shared/placement/fileTransform.js.map +1 -0
- package/dist/core/components/viewers/shared/placement/objectTarget.js +2 -2
- package/dist/core/components/viewers/shared/placement/objectTarget.js.map +1 -1
- package/dist/core/components/viewers/shared/pointcloud/pointCloudPlacementStore.d.ts +2 -3
- package/dist/core/components/viewers/shared/pointcloud/pointCloudPlacementStore.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/pointcloud/pointCloudPlacementStore.js +4 -14
- package/dist/core/components/viewers/shared/pointcloud/pointCloudPlacementStore.js.map +1 -1
- package/dist/core/hooks/useShareUrl.d.ts.map +1 -1
- package/dist/core/hooks/useShareUrl.js +5 -9
- package/dist/core/hooks/useShareUrl.js.map +1 -1
- package/dist/core/i18n/messages/en.json +4 -0
- package/dist/core/i18n/messages/es.json +4 -0
- package/dist/core/i18n/messages/fr.json +4 -0
- package/dist/core/types/datasetTypes.d.ts +5 -0
- package/dist/core/types/datasetTypes.d.ts.map +1 -1
- package/dist/core/types/dbTypes.d.ts +40 -0
- package/dist/core/types/dbTypes.d.ts.map +1 -1
- package/dist/core/types/dbTypes.js +18 -0
- package/dist/core/types/dbTypes.js.map +1 -1
- package/dist/core/types/index.d.ts +2 -2
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/core/types/index.js +7 -1
- package/dist/core/types/index.js.map +1 -1
- package/dist/core/utils/geo/reprojectGeometry.d.ts +14 -0
- package/dist/core/utils/geo/reprojectGeometry.d.ts.map +1 -0
- package/dist/core/utils/geo/reprojectGeometry.js +58 -0
- package/dist/core/utils/geo/reprojectGeometry.js.map +1 -0
- package/dist/core/utils/geo/wktToGeometry.d.ts +5 -0
- package/dist/core/utils/geo/wktToGeometry.d.ts.map +1 -0
- package/dist/core/utils/geo/wktToGeometry.js +34 -0
- package/dist/core/utils/geo/wktToGeometry.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/core/components/ui/FilesManager/src/FileItemComponent.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as LR from 'lucide-react'\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport { MenusContext, usePermissions } from '../../../../store'\nimport { getFileIcon } from '../../../../utils/getFileIcon'\nimport ConfirmDialog from '../../../ConfirmDialog'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n DropdownMenuSeparator,\n} from '../../DropdownMenu'\n\nimport type { DbFile as DbFile } from '../../../../types/dbTypes'\nimport type { FileAction } from '../../../../types/global'\n\nexport interface FileMenuContentProps {\n file: DbFile & { isVisible?: boolean }\n // Async handlers are supported: the delete flow awaits the result to keep its\n // spinner up (see handleDeleteConfirm), other actions are fire-and-forget.\n onAction: (action: FileAction, file: DbFile) => void | Promise<void>\n options: FileAction[]\n confirmDelete?: boolean\n}\n\n/** Shared menu items used by both FileItemComponent's dropdown and MapContextMenu. */\nexport function FileMenuContent({ file, onAction, options, confirmDelete = true }: FileMenuContentProps) {\n const t = useTranslations('FileItemComponent')\n const tDialog = useTranslations('FileMoreOptions')\n const { ability } = usePermissions()\n const canReadFile = ability.can('read', 'File')\n const canUpdateFile = ability.can('update', 'File')\n const canDeleteFile = ability.can('delete', 'File')\n const [isDeleteDialogOpen, setIsDeleteDialogOpen] = React.useState(false)\n const [isDeleting, setIsDeleting] = React.useState(false)\n\n const { state: menusState } = React.useContext(MenusContext)\n const { currentViewer } = menusState.menus\n\n const isPlaced = currentViewer === 'bim'\n ? true // BIM models are always placed — null x/y/z means origin (0,0,0), use move to reposition\n : currentViewer === 'map'\n ? file.lat != null && file.lng != null\n : false\n\n const isGhost = !!(file as any).isGhost\n const hasPlaceOption = options.includes('view') || options.includes('move')\n\n const isHidden = file.isVisible === false\n // A PDF is never in the scene, so its download must not hang on a visibility it cannot have.\n const isSceneContent = options.includes('ghost') || options.includes('move')\n\n const handleDeleteClick = React.useCallback(() => {\n if (confirmDelete) {\n setIsDeleteDialogOpen(true)\n return\n }\n\n void onAction('delete', file)\n }, [confirmDelete, onAction, file])\n\n const handleDeleteConfirm = React.useCallback(async (e: React.MouseEvent) => {\n e.preventDefault()\n setIsDeleting(true)\n try {\n await Promise.resolve(onAction('delete', file))\n }\n finally {\n setIsDeleting(false)\n setIsDeleteDialogOpen(false)\n }\n }, [onAction, file])\n\n return (\n <>\n {options.includes('download') && !(isSceneContent && isHidden) && (\n <DropdownMenuItem\n onClick={() => { void onAction('download', file) }}\n disabled={!canReadFile}\n >\n <LR.Download className=\"h-4 w-4\" />\n {t('downloadTitle')}\n </DropdownMenuItem>\n )}\n {hasPlaceOption && !isPlaced && (\n <DropdownMenuItem\n onClick={() => { void onAction('move', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n <LR.Locate className=\"h-4 w-4\" />\n {t('placeTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('view') && isPlaced && (\n <DropdownMenuItem\n onClick={() => { void onAction('view', file) }}\n disabled={!canReadFile}\n >\n {file.isVisible === true\n ? <LR.EyeOff className=\"h-4 w-4\" />\n : <LR.Eye className=\"h-4 w-4\" />}\n {file.isVisible === true ? t('hideTitle') : t('showTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('ghost') && !isHidden && (\n <DropdownMenuItem\n onClick={() => { void onAction('ghost', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n {isGhost ? <LR.Box className=\"h-4 w-4\" /> : <LR.Ghost className=\"h-4 w-4\" />}\n {isGhost ? t('unghostTitle') : t('ghostTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('move') && isPlaced && !isHidden && (\n <DropdownMenuItem\n onClick={() => { void onAction('move', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n <LR.Move className=\"h-4 w-4\" />\n {t('moveTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('edit') && (\n <DropdownMenuItem\n onClick={() => { void onAction('edit', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n <LR.Pencil className=\"h-4 w-4\" />\n {t('editTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('info') && (\n <DropdownMenuItem\n onClick={() => { void onAction('info', file) }}\n disabled={!canReadFile}\n >\n <LR.Info className=\"h-4 w-4\" />\n {t('infoTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('delete') && (\n <>\n {options.some(o => o !== 'delete') && <DropdownMenuSeparator />}\n <DropdownMenuItem\n onSelect={(e) => {\n // Always keep the dropdown open past selection — a confirm dialog is about to\n // open (local when confirmDelete, else the caller's own via onAction), and letting\n // Radix auto-close the dropdown in the same tick races its body pointer-events\n // lock against the dialog's, leaving clicks dead across the page afterward.\n e.preventDefault()\n }}\n onClick={handleDeleteClick}\n disabled={!canDeleteFile}\n className=\"focus:text-destructive\"\n >\n <LR.Trash2 className=\"h-4 w-4\" />\n {t('deleteTitle')}\n </DropdownMenuItem>\n </>\n )}\n\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n isDeleting={isDeleting}\n onOpenChange={setIsDeleteDialogOpen}\n handleConfirm={(e) => void handleDeleteConfirm(e)}\n itemName={file.name}\n dataType={tDialog('file')}\n />\n </>\n )\n}\n\nexport interface FileItemComponentProps {\n file: DbFile & { isVisible?: boolean }\n onAction: (action: FileAction, file: DbFile) => void | Promise<void>\n options: FileAction[]\n translationKey?: string\n confirmDelete?: boolean\n}\n\nexport const FileItemComponent = React.memo(function FileItemComponent({\n file,\n onAction,\n options,\n confirmDelete = true,\n}: FileItemComponentProps) {\n const t = useTranslations('FileItemComponent')\n const Icon = getFileIcon(file)\n\n return (\n <div className={`flex items-center justify-between px-2 py-1 hover:bg-accent/50 rounded-md transition-colors ${\n file.isVisible !== false ? '' : 'opacity-50'\n }`}\n >\n <div className=\"flex items-center gap-2 flex-1 min-w-0 \">\n <Icon className=\"h-4 w-4 text-muted-foreground flex-shrink-0\" />\n <span className=\"text-sm text-foreground truncate cursor-pointer\">{file.name}</span>\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n className=\"h-6 w-6 p-0 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground flex-shrink-0\"\n title={t('moreOptions')}\n >\n <LR.MoreVertical className=\"h-4 w-4\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-44\">\n <FileMenuContent\n file={file}\n onAction={onAction}\n options={options}\n confirmDelete={confirmDelete}\n />\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n )\n})\n"],"mappings":";AAmFQ,SAiEA,UA7DE,KAJF;AA9ER,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAEvB,SAAS,cAAc,sBAAsB;AAC7C,SAAS,mBAAmB;AAC5B,OAAO,mBAAmB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAeA,SAAS,gBAAgB,EAAE,MAAM,UAAU,SAAS,gBAAgB,KAAK,GAAyB;AACvG,QAAM,IAAI,gBAAgB,mBAAmB;AAC7C,QAAM,UAAU,gBAAgB,iBAAiB;AACjD,QAAM,EAAE,QAAQ,IAAI,eAAe;AACnC,QAAM,cAAc,QAAQ,IAAI,QAAQ,MAAM;AAC9C,QAAM,gBAAgB,QAAQ,IAAI,UAAU,MAAM;AAClD,QAAM,gBAAgB,QAAQ,IAAI,UAAU,MAAM;AAClD,QAAM,CAAC,oBAAoB,qBAAqB,IAAI,MAAM,SAAS,KAAK;AACxE,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,KAAK;AAExD,QAAM,EAAE,OAAO,WAAW,IAAI,MAAM,WAAW,YAAY;AAC3D,QAAM,EAAE,cAAc,IAAI,WAAW;AAErC,QAAM,WAAW,kBAAkB,QAC/B,OACA,kBAAkB,QAChB,KAAK,OAAO,QAAQ,KAAK,OAAO,OAChC;AAEN,QAAM,UAAU,CAAC,CAAE,KAAa;AAChC,QAAM,iBAAiB,QAAQ,SAAS,MAAM,KAAK,QAAQ,SAAS,MAAM;AAE1E,QAAM,WAAW,KAAK,cAAc;AAEpC,QAAM,iBAAiB,QAAQ,SAAS,OAAO,KAAK,QAAQ,SAAS,MAAM;AAE3E,QAAM,oBAAoB,MAAM,YAAY,MAAM;AAChD,QAAI,eAAe;AAC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A,cACA;AAAA,cACA;AAAA;AAAA,UACF,GACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FileItemComponent"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/core/components/ui/FilesManager/src/FileItemComponent.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as LR from 'lucide-react'\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport { MenusContext, usePermissions } from '../../../../store'\nimport { getFileIcon } from '../../../../utils/getFileIcon'\nimport ConfirmDialog from '../../../ConfirmDialog'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n DropdownMenuSeparator,\n} from '../../DropdownMenu'\n\nimport type { DbFile as DbFile } from '../../../../types/dbTypes'\nimport type { FileAction } from '../../../../types/global'\n\nexport interface FileMenuContentProps {\n file: DbFile & { isVisible?: boolean }\n // Async handlers are supported: the delete flow awaits the result to keep its\n // spinner up (see handleDeleteConfirm), other actions are fire-and-forget.\n onAction: (action: FileAction, file: DbFile) => void | Promise<void>\n options: FileAction[]\n confirmDelete?: boolean\n}\n\n/** Shared menu items used by both FileItemComponent's dropdown and MapContextMenu. */\nexport function FileMenuContent({ file, onAction, options, confirmDelete = true }: FileMenuContentProps) {\n const t = useTranslations('FileItemComponent')\n const tDialog = useTranslations('FileMoreOptions')\n const { ability } = usePermissions()\n const canReadFile = ability.can('read', 'File')\n const canUpdateFile = ability.can('update', 'File')\n const canDeleteFile = ability.can('delete', 'File')\n const [isDeleteDialogOpen, setIsDeleteDialogOpen] = React.useState(false)\n const [isDeleting, setIsDeleting] = React.useState(false)\n\n const { state: menusState } = React.useContext(MenusContext)\n const { currentViewer } = menusState.menus\n\n const isPlaced = currentViewer === 'bim'\n ? true // BIM models are always placed — null fileTransformX/Y/Z means origin (0,0,0), use move to reposition\n : currentViewer === 'map'\n ? file.lat != null && file.lng != null\n : false\n\n const isGhost = !!(file as any).isGhost\n const hasPlaceOption = options.includes('view') || options.includes('move')\n\n const isHidden = file.isVisible === false\n // A PDF is never in the scene, so its download must not hang on a visibility it cannot have.\n const isSceneContent = options.includes('ghost') || options.includes('move')\n\n const handleDeleteClick = React.useCallback(() => {\n if (confirmDelete) {\n setIsDeleteDialogOpen(true)\n return\n }\n\n void onAction('delete', file)\n }, [confirmDelete, onAction, file])\n\n const handleDeleteConfirm = React.useCallback(async (e: React.MouseEvent) => {\n e.preventDefault()\n setIsDeleting(true)\n try {\n await Promise.resolve(onAction('delete', file))\n }\n finally {\n setIsDeleting(false)\n setIsDeleteDialogOpen(false)\n }\n }, [onAction, file])\n\n return (\n <>\n {options.includes('download') && !(isSceneContent && isHidden) && (\n <DropdownMenuItem\n onClick={() => { void onAction('download', file) }}\n disabled={!canReadFile}\n >\n <LR.Download className=\"h-4 w-4\" />\n {t('downloadTitle')}\n </DropdownMenuItem>\n )}\n {hasPlaceOption && !isPlaced && (\n <DropdownMenuItem\n onClick={() => { void onAction('move', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n <LR.Locate className=\"h-4 w-4\" />\n {t('placeTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('view') && isPlaced && (\n <DropdownMenuItem\n onClick={() => { void onAction('view', file) }}\n disabled={!canReadFile}\n >\n {file.isVisible === true\n ? <LR.EyeOff className=\"h-4 w-4\" />\n : <LR.Eye className=\"h-4 w-4\" />}\n {file.isVisible === true ? t('hideTitle') : t('showTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('ghost') && !isHidden && (\n <DropdownMenuItem\n onClick={() => { void onAction('ghost', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n {isGhost ? <LR.Box className=\"h-4 w-4\" /> : <LR.Ghost className=\"h-4 w-4\" />}\n {isGhost ? t('unghostTitle') : t('ghostTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('move') && isPlaced && !isHidden && (\n <DropdownMenuItem\n onClick={() => { void onAction('move', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n <LR.Move className=\"h-4 w-4\" />\n {t('moveTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('edit') && (\n <DropdownMenuItem\n onClick={() => { void onAction('edit', file) }}\n disabled={!canReadFile || !canUpdateFile}\n >\n <LR.Pencil className=\"h-4 w-4\" />\n {t('editTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('info') && (\n <DropdownMenuItem\n onClick={() => { void onAction('info', file) }}\n disabled={!canReadFile}\n >\n <LR.Info className=\"h-4 w-4\" />\n {t('infoTitle')}\n </DropdownMenuItem>\n )}\n {options.includes('delete') && (\n <>\n {options.some(o => o !== 'delete') && <DropdownMenuSeparator />}\n <DropdownMenuItem\n onSelect={(e) => {\n // Always keep the dropdown open past selection — a confirm dialog is about to\n // open (local when confirmDelete, else the caller's own via onAction), and letting\n // Radix auto-close the dropdown in the same tick races its body pointer-events\n // lock against the dialog's, leaving clicks dead across the page afterward.\n e.preventDefault()\n }}\n onClick={handleDeleteClick}\n disabled={!canDeleteFile}\n className=\"focus:text-destructive\"\n >\n <LR.Trash2 className=\"h-4 w-4\" />\n {t('deleteTitle')}\n </DropdownMenuItem>\n </>\n )}\n\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n isDeleting={isDeleting}\n onOpenChange={setIsDeleteDialogOpen}\n handleConfirm={(e) => void handleDeleteConfirm(e)}\n itemName={file.name}\n dataType={tDialog('file')}\n />\n </>\n )\n}\n\nexport interface FileItemComponentProps {\n file: DbFile & { isVisible?: boolean }\n onAction: (action: FileAction, file: DbFile) => void | Promise<void>\n options: FileAction[]\n translationKey?: string\n confirmDelete?: boolean\n}\n\nexport const FileItemComponent = React.memo(function FileItemComponent({\n file,\n onAction,\n options,\n confirmDelete = true,\n}: FileItemComponentProps) {\n const t = useTranslations('FileItemComponent')\n const Icon = getFileIcon(file)\n\n return (\n <div className={`flex items-center justify-between px-2 py-1 hover:bg-accent/50 rounded-md transition-colors ${\n file.isVisible !== false ? '' : 'opacity-50'\n }`}\n >\n <div className=\"flex items-center gap-2 flex-1 min-w-0 \">\n <Icon className=\"h-4 w-4 text-muted-foreground flex-shrink-0\" />\n <span className=\"text-sm text-foreground truncate cursor-pointer\">{file.name}</span>\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n className=\"h-6 w-6 p-0 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground flex-shrink-0\"\n title={t('moreOptions')}\n >\n <LR.MoreVertical className=\"h-4 w-4\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-44\">\n <FileMenuContent\n file={file}\n onAction={onAction}\n options={options}\n confirmDelete={confirmDelete}\n />\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n )\n})\n"],"mappings":";AAmFQ,SAiEA,UA7DE,KAJF;AA9ER,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAEvB,SAAS,cAAc,sBAAsB;AAC7C,SAAS,mBAAmB;AAC5B,OAAO,mBAAmB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAeA,SAAS,gBAAgB,EAAE,MAAM,UAAU,SAAS,gBAAgB,KAAK,GAAyB;AACvG,QAAM,IAAI,gBAAgB,mBAAmB;AAC7C,QAAM,UAAU,gBAAgB,iBAAiB;AACjD,QAAM,EAAE,QAAQ,IAAI,eAAe;AACnC,QAAM,cAAc,QAAQ,IAAI,QAAQ,MAAM;AAC9C,QAAM,gBAAgB,QAAQ,IAAI,UAAU,MAAM;AAClD,QAAM,gBAAgB,QAAQ,IAAI,UAAU,MAAM;AAClD,QAAM,CAAC,oBAAoB,qBAAqB,IAAI,MAAM,SAAS,KAAK;AACxE,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,KAAK;AAExD,QAAM,EAAE,OAAO,WAAW,IAAI,MAAM,WAAW,YAAY;AAC3D,QA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AAK,WAAU,+CAA8C;AAAA,UAC9D,oBAAC,UAAK,WAAU,mDAAmD,eAAK,MAAK;AAAA,WAC/E;AAAA,QACA,qBAAC,gBACC;AAAA,8BAAC,uBAAoB,SAAO,MAC1B;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,aAAa;AAAA,cAEtB,8BAAC,GAAG,cAAH,EAAgB,WAAU,WAAU;AAAA;AAAA,UACvC,GACF;AAAA,UACA,oBAAC,uBAAoB,OAAM,OAAM,WAAU,QACzC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF,GACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FileItemComponent"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SourceUpAxis } from '../../types/dbTypes';
|
|
1
2
|
interface UploadFileArgs {
|
|
2
3
|
file?: File;
|
|
3
4
|
files?: File[];
|
|
@@ -29,8 +30,8 @@ interface UploadFileArgs {
|
|
|
29
30
|
recordType?: string;
|
|
30
31
|
onProgress?: (percent: number) => void;
|
|
31
32
|
existingNames?: string[];
|
|
32
|
-
|
|
33
|
+
sourceUp?: SourceUpAxis;
|
|
33
34
|
}
|
|
34
|
-
export declare function uploadFile({ file, files, buildingId, tag, isVisible, user, uploadFile, position, x, y, z, lat, lng, elevation, rotation, scale, recordType, onProgress, existingNames,
|
|
35
|
+
export declare function uploadFile({ file, files, buildingId, tag, isVisible, user, uploadFile, position, x, y, z, lat, lng, elevation, rotation, scale, recordType, onProgress, existingNames, sourceUp, }: UploadFileArgs): Promise<any[]>;
|
|
35
36
|
export {};
|
|
36
37
|
//# sourceMappingURL=uploadFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../../../../src/core/components/ui/uploadFile.ts"],"names":[],"mappings":"AAQA,UAAU,cAAc;IAEtB,IA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EACH,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE,cAAc,kBA8DhB"}
|
|
@@ -41,7 +41,7 @@ async function uploadFile({
|
|
|
41
41
|
recordType,
|
|
42
42
|
onProgress,
|
|
43
43
|
existingNames,
|
|
44
|
-
|
|
44
|
+
sourceUp
|
|
45
45
|
}) {
|
|
46
46
|
if (!file && (!files || files.length === 0)) return null;
|
|
47
47
|
const filesToProcess = files != null ? files : file ? [file] : [];
|
|
@@ -65,7 +65,7 @@ async function uploadFile({
|
|
|
65
65
|
const name = uniqueFileName(currentFile.name, [...taken]);
|
|
66
66
|
taken.add(name);
|
|
67
67
|
const attachment = buildingId === void 0 ? {} : { [getAttachmentFieldName(tag)]: buildingId };
|
|
68
|
-
const fileData =
|
|
68
|
+
const fileData = __spreadProps(__spreadValues({
|
|
69
69
|
name,
|
|
70
70
|
type: recordType != null ? recordType : "system",
|
|
71
71
|
mimeType: currentFile.type,
|
|
@@ -79,16 +79,17 @@ async function uploadFile({
|
|
|
79
79
|
}, attachment), {
|
|
80
80
|
fileOrganizationId: (user == null ? void 0 : user.organizationId) || null,
|
|
81
81
|
position: JSON.stringify(position) || null,
|
|
82
|
-
x,
|
|
83
|
-
y,
|
|
84
|
-
z,
|
|
82
|
+
fileTransformX: x,
|
|
83
|
+
fileTransformY: y,
|
|
84
|
+
fileTransformZ: z,
|
|
85
85
|
lat,
|
|
86
86
|
lng,
|
|
87
87
|
elevation,
|
|
88
88
|
rotation,
|
|
89
|
-
scale,
|
|
89
|
+
fileScale: scale,
|
|
90
|
+
fileSourceUp: sourceUp,
|
|
90
91
|
isVisible: isVisible != null ? isVisible : false
|
|
91
|
-
})
|
|
92
|
+
});
|
|
92
93
|
const result = await uploadFile2({ fileData, buildingId });
|
|
93
94
|
uploadResults.push(result);
|
|
94
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/components/ui/uploadFile.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { uniqueFileName } from '../../utils/uniqueFileName'\nimport { getFileExtension } from '../../utils/utils'\nimport { getAttachmentFieldName } from '../viewers/Data/details/getAttachmentFileName'\nimport { uploadFileWithProgress } from '../viewers/map/src/tools/AddTools/AddFile/utils/uploadToPresignedURLS'\n\ninterface UploadFileArgs {\n // Support both single and multiple files; prefer `files` when passing many\n file?: File\n files?: File[]\n /** Omitted for a map file that belongs to no building. */\n buildingId?: number\n tag?: string\n user: any\n isVisible?: boolean\n uploadFile: (args: { fileData: any, buildingId?: number }) => Promise<any>\n position?: { lng?: number, lat?: number, rotation?: number, elevation?: number, isVisible?: boolean }\n x?: number\n y?: number\n z?: number\n lat?: number\n lng?: number\n elevation?: number\n rotation?: number\n scale?: number\n /** The File record's `type`. Defaults to 'system'; a buildingless map file is a 'map-file'. */\n recordType?: string\n onProgress?: (percent: number) => void\n existingNames?: string[]\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/components/ui/uploadFile.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { uniqueFileName } from '../../utils/uniqueFileName'\nimport { getFileExtension } from '../../utils/utils'\nimport { getAttachmentFieldName } from '../viewers/Data/details/getAttachmentFileName'\nimport { uploadFileWithProgress } from '../viewers/map/src/tools/AddTools/AddFile/utils/uploadToPresignedURLS'\n\nimport type { SourceUpAxis } from '../../types/dbTypes'\n\ninterface UploadFileArgs {\n // Support both single and multiple files; prefer `files` when passing many\n file?: File\n files?: File[]\n /** Omitted for a map file that belongs to no building. */\n buildingId?: number\n tag?: string\n user: any\n isVisible?: boolean\n uploadFile: (args: { fileData: any, buildingId?: number }) => Promise<any>\n position?: { lng?: number, lat?: number, rotation?: number, elevation?: number, isVisible?: boolean }\n x?: number\n y?: number\n z?: number\n lat?: number\n lng?: number\n elevation?: number\n rotation?: number\n scale?: number\n /** The File record's `type`. Defaults to 'system'; a buildingless map file is a 'map-file'. */\n recordType?: string\n onProgress?: (percent: number) => void\n existingNames?: string[]\n sourceUp?: SourceUpAxis\n}\n\nexport async function uploadFile({\n file,\n files,\n buildingId,\n tag,\n isVisible,\n user,\n uploadFile,\n position,\n x,\n y,\n z,\n lat,\n lng,\n elevation,\n rotation,\n scale,\n recordType,\n onProgress,\n existingNames,\n sourceUp,\n}: UploadFileArgs) {\n if (!file && (!files || files.length === 0)) return null\n\n const filesToProcess: File[] = files ?? (file ? [file] : [])\n\n const uploadResults: any[] = []\n const taken = new Set(existingNames ?? [])\n\n for (const currentFile of filesToProcess) {\n const fileId = crypto.randomUUID()\n const presignedResponse = await fetch(`/api/presigned-url-upload?asset=${fileId}`)\n if (!presignedResponse.ok) throw new Error('Failed to fetch presigned URL')\n const { presignedUrl } = await presignedResponse.json()\n\n if (onProgress) {\n await uploadFileWithProgress(presignedUrl, currentFile, percent => onProgress(percent))\n }\n else {\n const uploadResponse = await fetch(presignedUrl, {\n method: 'PUT',\n body: currentFile,\n headers: { 'Content-Type': currentFile.type },\n })\n if (!uploadResponse.ok) throw new Error(`Failed to upload file to storage: ${uploadResponse.status}`)\n }\n\n const name = uniqueFileName(currentFile.name, [...taken])\n taken.add(name)\n const attachment = buildingId === undefined\n ? {}\n : { [getAttachmentFieldName(tag as string)]: buildingId }\n const fileData = {\n name,\n type: recordType ?? 'system',\n mimeType: currentFile.type,\n extension: getFileExtension(currentFile),\n sizeBytes: currentFile.size,\n tag,\n uploadedAt: new Date().toISOString(),\n url: '',\n assetId: fileId,\n description: '',\n ...attachment,\n fileOrganizationId: user?.organizationId || null,\n position: JSON.stringify(position) || null,\n fileTransformX: x,\n fileTransformY: y,\n fileTransformZ: z,\n lat,\n lng,\n elevation,\n rotation,\n fileScale: scale,\n fileSourceUp: sourceUp,\n isVisible: isVisible ?? false,\n }\n\n const result = await uploadFile({ fileData, buildingId })\n uploadResults.push(result)\n }\n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SAC9B,CAAC,IACD,EAAE,CAAC,uBAAuB,GAAa,CAAC,GAAG,WAAW;AAC1D,UAAM,WAAW;AAAA,MACf;AAAA,MACA,MAAM,kCAAc;AAAA,MACpB,UAAU,YAAY;AAAA,MACtB,WAAW,iBAAiB,WAAW;AAAA,MACvC,WAAW,YAAY;AAAA,MACvB;AAAA,MACA,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACnC,KAAK;AAAA,MACL,SAAS;AAAA,MACT,aAAa;AAAA,OACV,aAXY;AAAA,MAYf,qBAAoB,6BAAM,mBAAkB;AAAA,MAC5C,UAAU,KAAK,UAAU,QAAQ,KAAK;AAAA,MACtC,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,cAAc;AAAA,MACd,WAAW,gCAAa;AAAA,IAC1B;AAEA,UAAM,SAAS,MAAMA,YAAW,EAAE,UAAU,WAAW,CAAC;AACxD,kBAAc,KAAK,MAAM;AAAA,EAC3B;AAEA,SAAO;AACT;","names":["uploadFile"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewer.d.ts","sourceRoot":"","sources":["../../../../src/core/components/viewers/Viewer.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Viewer.d.ts","sourceRoot":"","sources":["../../../../src/core/components/viewers/Viewer.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAiB9B,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,qBAAqB,CAAA;AAqClE,UAAU,WAAW;IACnB,YAAY,EAAE,YAAY,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,MAAM,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,EAAE,WAAW,qBAuIhJ"}
|
|
@@ -14,6 +14,7 @@ import { UserSettings } from "../settings";
|
|
|
14
14
|
import { Toolbar } from "../Toolbar";
|
|
15
15
|
import { UploadProgressToasts } from "../ui/FilesManager/src/UploadProgressBar";
|
|
16
16
|
import { SidebarTrigger } from "../ui/Sidebar";
|
|
17
|
+
import { withBuildingId } from "./bim/src/lib/buildingLocationParams";
|
|
17
18
|
import { MapViewer } from "./map/MapViewer";
|
|
18
19
|
import { isViewerAllowed } from "./viewerAccess";
|
|
19
20
|
const BimViewer = dynamic(
|
|
@@ -55,11 +56,9 @@ function Viewer({ organization, minioBaseUrl, martinBaseUrl, pointcloudApiUrl, m
|
|
|
55
56
|
const validViewer = isViewerValid ? viewer : ViewerNames.map;
|
|
56
57
|
React.useEffect(() => {
|
|
57
58
|
if (isMounted && !isViewerValid && viewer !== ViewerNames.map) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
newSearchParams.set("buildingId", String(building.id));
|
|
62
|
-
}
|
|
59
|
+
const current = new URLSearchParams(searchParams.toString());
|
|
60
|
+
current.delete("viewer");
|
|
61
|
+
const newSearchParams = (building == null ? void 0 : building.id) ? withBuildingId(current, building.id) : current;
|
|
63
62
|
router.replace(`${pathname}?${newSearchParams.toString()}`, { scroll: false });
|
|
64
63
|
}
|
|
65
64
|
}, [isMounted, isViewerValid, viewer, searchParams, pathname, router, building == null ? void 0 : building.id]);
|
|
@@ -83,11 +82,9 @@ function Viewer({ organization, minioBaseUrl, martinBaseUrl, pointcloudApiUrl, m
|
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
85
84
|
isUpdatingRef.current = true;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
newSearchParams.set("buildingId", String(building.id));
|
|
90
|
-
}
|
|
85
|
+
const current = new URLSearchParams(searchParams.toString());
|
|
86
|
+
current.set("viewer", currentViewer);
|
|
87
|
+
const newSearchParams = (building == null ? void 0 : building.id) ? withBuildingId(current, building.id) : current;
|
|
91
88
|
router.replace(`${pathname}?${newSearchParams.toString()}`, { scroll: false });
|
|
92
89
|
setTimeout(() => {
|
|
93
90
|
isUpdatingRef.current = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/components/viewers/Viewer.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Dependencies\nimport { Loader2 } from 'lucide-react'\nimport dynamic from 'next/dynamic'\nimport { useSearchParams, useRouter, usePathname } from 'next/navigation'\nimport * as React from 'react'\n\nimport { parsePluginViewerKey } from '../../plugins/host/pluginViewerKey'\nimport { BuildingsContext, MenusContext } from '../../store'\nimport { ViewerNames } from '../../types'\n\n// Deep import, not the ui barrel: the barrel drags heavy modules into the eager map bundle.\nimport { switchLanguage } from '../../utils/utils'\nimport { UserSettings } from '../settings'\nimport { Toolbar } from '../Toolbar'\nimport { UploadProgressToasts } from '../ui/FilesManager/src/UploadProgressBar'\nimport { SidebarTrigger } from '../ui/Sidebar'\n\nimport { MapViewer } from './map/MapViewer'\nimport { isViewerAllowed } from './viewerAccess'\n\nimport type { Organization, ViewerKey } from '../../types/dbTypes'\n\n// Code-split: map-only sessions must not pay for @thatopen or the Potree stack.\nconst BimViewer = dynamic(\n () => import('./bim/BimViewer').then(m => ({ default: m.BimViewer })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading BIM viewer…\" /> },\n)\n\n// DataMenu reaches BimViewer through FilePreview, so a static import undoes the split above.\nconst PluginsManager = dynamic(\n () => import('./plugins/PluginsManager').then(m => ({ default: m.PluginsManager })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading plugins…\" /> },\n)\n\nconst DataMenu = dynamic(\n () => import('./Data/DataMenu').then(m => ({ default: m.DataMenu })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading data…\" /> },\n)\n\n// Lazy too, or every plugin's page code lands in the eager bundle for every user.\nconst PluginDataPageHost = dynamic(\n () => import('../../plugins/host/PluginDataPageHost').then(m => ({ default: m.PluginDataPageHost })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading page…\" /> },\n)\n\n// Matches BimLoadingState using only Tailwind tokens, so the eager bundle stays light.\nfunction ViewerLoadingFallback({ label }: { label: string }) {\n return (\n <div className=\"absolute inset-0 z-10 flex items-center justify-center bg-background/50 backdrop-blur-[1px]\">\n <div className=\"flex items-center gap-3 rounded-md border border-border bg-card px-5 py-4 shadow-sm\">\n <Loader2 className=\"h-5 w-5 animate-spin text-muted-foreground\" />\n <span className=\"text-foreground text-base font-medium font-['Inter'] leading-7\">{label}</span>\n </div>\n </div>\n )\n}\n\ninterface ViewerProps {\n organization: Organization\n minioBaseUrl?: string\n martinBaseUrl?: string\n pointcloudApiUrl?: string\n maptilerKey?: string\n geocodeEarthApiKey?: string\n geocoderUrl?: string\n}\n\nexport function Viewer({ organization, minioBaseUrl, martinBaseUrl, pointcloudApiUrl, maptilerKey, geocodeEarthApiKey, geocoderUrl }: ViewerProps) {\n\n const searchParams = useSearchParams()\n const viewer = (searchParams.get('viewer') as ViewerKey) || ViewerNames.map\n\n const { dispatch: menusDispatch, state: menusState } = React.useContext(MenusContext)\n const { state: buildingState } = React.useContext(BuildingsContext)\n // const { dispatch: appConfigDispatch } = React.useContext(AppConfigContext)\n const { building } = buildingState.buildings\n const { currentViewer } = menusState.menus\n const router = useRouter()\n const pathname = usePathname()\n const [isMounted, setIsMounted] = React.useState(false)\n\n // Use a ref to track if we're currently updating -> prevent circular updates\n const isUpdatingRef = React.useRef(false)\n\n const { appContent } = organization\n\n const pluginPage = parsePluginViewerKey(viewer)\n const isViewerValid = isViewerAllowed(viewer, appContent)\n\n // Use default viewer (map) if current viewer is not valid\n const validViewer = isViewerValid ? viewer : ViewerNames.map\n\n // Update URL if viewer was not available for the organization\n React.useEffect(() => {\n if (isMounted && !isViewerValid && viewer !== ViewerNames.map) {\n const newSearchParams = new URLSearchParams(searchParams.toString())\n newSearchParams.delete('viewer')\n if (building?.id) {\n newSearchParams.set('buildingId', String(building.id))\n }\n router.replace(`${pathname}?${newSearchParams.toString()}`, { scroll: false })\n }\n }, [isMounted, isViewerValid, viewer, searchParams, pathname, router, building?.id])\n\n // On first mount, respond to URL\n React.useEffect(() => {\n if (!isMounted) {\n menusDispatch({\n type: 'SET_VIEWER',\n payload: { currentViewer: validViewer },\n })\n setIsMounted(true)\n }\n }, [isMounted, validViewer, menusDispatch])\n\n React.useEffect(() => {\n if (!organization) return\n const defaultLanguage = organization.languages?.[0] || 'En'\n if (defaultLanguage) void switchLanguage(defaultLanguage)\n }, [organization])\n\n // Handle context changes (from sidebar, HeaderButtons, etc.)\n React.useEffect(() => {\n if (!isMounted || !currentViewer || currentViewer === validViewer || isUpdatingRef.current) {\n return\n }\n\n isUpdatingRef.current = true\n\n // Create URLSearchParams to preserve existing search params\n\n const newSearchParams = new URLSearchParams(searchParams.toString())\n newSearchParams.set('viewer', currentViewer)\n if (building?.id) {\n newSearchParams.set('buildingId', String(building.id))\n }\n\n\n router.replace(`${pathname}?${newSearchParams.toString()}`, { scroll: false })\n\n // Reset the flag after a brief delay to allow the navigation to complete\n setTimeout(() => {\n isUpdatingRef.current = false\n }, 100)\n }, [currentViewer, isMounted, pathname, router, viewer, searchParams])\n\n // Handle URL changes (direct navigation)\n React.useEffect(() => {\n if (isMounted && currentViewer !== validViewer && !isUpdatingRef.current) {\n isUpdatingRef.current = true\n\n menusDispatch({\n type: 'SET_VIEWER',\n payload: { currentViewer: validViewer },\n })\n\n // Reset the flag after a brief delay\n setTimeout(() => {\n isUpdatingRef.current = false\n }, 100)\n }\n }, [validViewer, menusDispatch, isMounted, currentViewer])\n\n // Null while a plugin page shows, so the branches below stay exhaustive over ViewerNames.\n const builtInViewer = pluginPage ? null : (validViewer as ViewerNames)\n\n const selectedViewer = (\n <>\n {builtInViewer !== null\n && [ViewerNames.map, ViewerNames.bim].includes(builtInViewer)\n && <SidebarTrigger />}\n <div style={{ height: '100%', width: '100%', position: 'relative' }}>\n <div style={{ display: builtInViewer === ViewerNames.map ? 'block' : 'none', width: '100%', height: '100%' }}>\n <MapViewer organization={organization} maptilerKey={maptilerKey} />\n </div>\n {builtInViewer === ViewerNames.bim && <BimViewer pointcloudApiUrl={pointcloudApiUrl} />}\n {builtInViewer !== null\n && [ViewerNames.buildings, ViewerNames.sites, ViewerNames.files, ViewerNames.land, ViewerNames.infrastructure, ViewerNames.users].includes(builtInViewer) && (\n <DataMenu currentViewer={builtInViewer} organization={organization} geocodeEarthApiKey={geocodeEarthApiKey} geocoderUrl={geocoderUrl} />\n )}\n {/* `plugins` used to route through DataMenu, which rendered nothing:\n VIEWER_CONFIG gives it no dataType. It has its own page now. */}\n {builtInViewer === ViewerNames.extensions && (\n <div className=\"h-full w-full overflow-y-auto\">\n <PluginsManager />\n </div>\n )}\n {builtInViewer === ViewerNames.settings && (\n <UserSettings minioBaseUrl={minioBaseUrl} />\n )}\n {pluginPage && (\n <div className=\"h-full w-full overflow-y-auto\">\n <PluginDataPageHost viewer={validViewer} />\n </div>\n )}\n </div>\n </>\n )\n\n return (\n <>\n {selectedViewer}\n <Toolbar viewer={validViewer} minioBaseUrl={minioBaseUrl} martinBaseUrl={martinBaseUrl} organization={organization} geocodeEarthApiKey={geocodeEarthApiKey} geocoderUrl={geocoderUrl} />\n <UploadProgressToasts />\n </>\n )\n}"],"mappings":";AA8B+B,SA8I3B,UA9I2B,KAwBzB,YAxByB;AAxB/B,SAAS,eAAe;AACxB,OAAO,aAAa;AACpB,SAAS,iBAAiB,WAAW,mBAAmB;AAC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AU,WAAW,GAChE;AAAA,0BAAC,SAAI,OAAO,EAAE,SAAS,kBAAkB,YAAY,MAAM,UAAU,QAAQ,OAAO,QAAQ,QAAQ,OAAO,GACzG,8BAAC,aAAU,cAA4B,aAA0B,GACnE;AAAA,MACC,kBAAkB,YAAY,OAAO,oBAAC,aAAU,kBAAoC;AAAA,MACpF,kBAAkB,QACd,CAAC,YAAY,WAAW,YAAY,OAAO,YAAY,OAAO,YAAY,MAAM,YAAY,gBAAgB,YAAY,KAAK,EAAE,SAAS,aAAa,KACxJ,oBAAC,YAAS,eAAe,eAAe,cAA4B,oBAAwC,aAA0B;AAAA,MAIvI,kBAAkB,YAAY,cAC7B,oBAAC,SAAI,WAAU,iCACb,8BAAC,kBAAe,GAClB;AAAA,MAED,kBAAkB,YAAY,YAC7B,oBAAC,gBAAa,cAA4B;AAAA,MAE3C,cACC,oBAAC,SAAI,WAAU,iCACb,8BAAC,sBAAmB,QAAQ,aAAa,GAC3C;AAAA,OAEJ;AAAA,KACF;AAGF,SACE,iCACG;AAAA;AAAA,IACD,oBAAC,WAAQ,QAAQ,aAAa,cAA4B,eAA8B,cAA4B,oBAAwC,aAA0B;AAAA,IACtL,oBAAC,wBAAqB;AAAA,KACxB;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/components/viewers/Viewer.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Dependencies\nimport { Loader2 } from 'lucide-react'\nimport dynamic from 'next/dynamic'\nimport { useSearchParams, useRouter, usePathname } from 'next/navigation'\nimport * as React from 'react'\n\nimport { parsePluginViewerKey } from '../../plugins/host/pluginViewerKey'\nimport { BuildingsContext, MenusContext } from '../../store'\nimport { ViewerNames } from '../../types'\n\n// Deep import, not the ui barrel: the barrel drags heavy modules into the eager map bundle.\nimport { switchLanguage } from '../../utils/utils'\nimport { UserSettings } from '../settings'\nimport { Toolbar } from '../Toolbar'\nimport { UploadProgressToasts } from '../ui/FilesManager/src/UploadProgressBar'\nimport { SidebarTrigger } from '../ui/Sidebar'\n\nimport { withBuildingId } from './bim/src/lib/buildingLocationParams'\nimport { MapViewer } from './map/MapViewer'\nimport { isViewerAllowed } from './viewerAccess'\n\nimport type { Organization, ViewerKey } from '../../types/dbTypes'\n\n// Code-split: map-only sessions must not pay for @thatopen or the Potree stack.\nconst BimViewer = dynamic(\n () => import('./bim/BimViewer').then(m => ({ default: m.BimViewer })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading BIM viewer…\" /> },\n)\n\n// DataMenu reaches BimViewer through FilePreview, so a static import undoes the split above.\nconst PluginsManager = dynamic(\n () => import('./plugins/PluginsManager').then(m => ({ default: m.PluginsManager })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading plugins…\" /> },\n)\n\nconst DataMenu = dynamic(\n () => import('./Data/DataMenu').then(m => ({ default: m.DataMenu })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading data…\" /> },\n)\n\n// Lazy too, or every plugin's page code lands in the eager bundle for every user.\nconst PluginDataPageHost = dynamic(\n () => import('../../plugins/host/PluginDataPageHost').then(m => ({ default: m.PluginDataPageHost })),\n { ssr: false, loading: () => <ViewerLoadingFallback label=\"Loading page…\" /> },\n)\n\n// Matches BimLoadingState using only Tailwind tokens, so the eager bundle stays light.\nfunction ViewerLoadingFallback({ label }: { label: string }) {\n return (\n <div className=\"absolute inset-0 z-10 flex items-center justify-center bg-background/50 backdrop-blur-[1px]\">\n <div className=\"flex items-center gap-3 rounded-md border border-border bg-card px-5 py-4 shadow-sm\">\n <Loader2 className=\"h-5 w-5 animate-spin text-muted-foreground\" />\n <span className=\"text-foreground text-base font-medium font-['Inter'] leading-7\">{label}</span>\n </div>\n </div>\n )\n}\n\ninterface ViewerProps {\n organization: Organization\n minioBaseUrl?: string\n martinBaseUrl?: string\n pointcloudApiUrl?: string\n maptilerKey?: string\n geocodeEarthApiKey?: string\n geocoderUrl?: string\n}\n\nexport function Viewer({ organization, minioBaseUrl, martinBaseUrl, pointcloudApiUrl, maptilerKey, geocodeEarthApiKey, geocoderUrl }: ViewerProps) {\n\n const searchParams = useSearchParams()\n const viewer = (searchParams.get('viewer') as ViewerKey) || ViewerNames.map\n\n const { dispatch: menusDispatch, state: menusState } = React.useContext(MenusContext)\n const { state: buildingState } = React.useContext(BuildingsContext)\n // const { dispatch: appConfigDispatch } = React.useContext(AppConfigContext)\n const { building } = buildingState.buildings\n const { currentViewer } = menusState.menus\n const router = useRouter()\n const pathname = usePathname()\n const [isMounted, setIsMounted] = React.useState(false)\n\n // Use a ref to track if we're currently updating -> prevent circular updates\n const isUpdatingRef = React.useRef(false)\n\n const { appContent } = organization\n\n const pluginPage = parsePluginViewerKey(viewer)\n const isViewerValid = isViewerAllowed(viewer, appContent)\n\n // Use default viewer (map) if current viewer is not valid\n const validViewer = isViewerValid ? viewer : ViewerNames.map\n\n // Update URL if viewer was not available for the organization\n React.useEffect(() => {\n if (isMounted && !isViewerValid && viewer !== ViewerNames.map) {\n const current = new URLSearchParams(searchParams.toString())\n current.delete('viewer')\n const newSearchParams = building?.id ? withBuildingId(current, building.id) : current\n router.replace(`${pathname}?${newSearchParams.toString()}`, { scroll: false })\n }\n }, [isMounted, isViewerValid, viewer, searchParams, pathname, router, building?.id])\n\n // On first mount, respond to URL\n React.useEffect(() => {\n if (!isMounted) {\n menusDispatch({\n type: 'SET_VIEWER',\n payload: { currentViewer: validViewer },\n })\n setIsMounted(true)\n }\n }, [isMounted, validViewer, menusDispatch])\n\n React.useEffect(() => {\n if (!organization) return\n const defaultLanguage = organization.languages?.[0] || 'En'\n if (defaultLanguage) void switchLanguage(defaultLanguage)\n }, [organization])\n\n // Handle context changes (from sidebar, HeaderButtons, etc.)\n React.useEffect(() => {\n if (!isMounted || !currentViewer || currentViewer === validViewer || isUpdatingRef.current) {\n return\n }\n\n isUpdatingRef.current = true\n\n // Create URLSearchParams to preserve existing search params\n\n const current = new URLSearchParams(searchParams.toString())\n current.set('viewer', currentViewer)\n const newSearchParams = building?.id ? withBuildingId(current, building.id) : current\n\n\n router.replace(`${pathname}?${newSearchParams.toString()}`, { scroll: false })\n\n // Reset the flag after a brief delay to allow the navigation to complete\n setTimeout(() => {\n isUpdatingRef.current = false\n }, 100)\n }, [currentViewer, isMounted, pathname, router, viewer, searchParams])\n\n // Handle URL changes (direct navigation)\n React.useEffect(() => {\n if (isMounted && currentViewer !== validViewer && !isUpdatingRef.current) {\n isUpdatingRef.current = true\n\n menusDispatch({\n type: 'SET_VIEWER',\n payload: { currentViewer: validViewer },\n })\n\n // Reset the flag after a brief delay\n setTimeout(() => {\n isUpdatingRef.current = false\n }, 100)\n }\n }, [validViewer, menusDispatch, isMounted, currentViewer])\n\n // Null while a plugin page shows, so the branches below stay exhaustive over ViewerNames.\n const builtInViewer = pluginPage ? null : (validViewer as ViewerNames)\n\n const selectedViewer = (\n <>\n {builtInViewer !== null\n && [ViewerNames.map, ViewerNames.bim].includes(builtInViewer)\n && <SidebarTrigger />}\n <div style={{ height: '100%', width: '100%', position: 'relative' }}>\n <div style={{ display: builtInViewer === ViewerNames.map ? 'block' : 'none', width: '100%', height: '100%' }}>\n <MapViewer organization={organization} maptilerKey={maptilerKey} />\n </div>\n {builtInViewer === ViewerNames.bim && <BimViewer pointcloudApiUrl={pointcloudApiUrl} />}\n {builtInViewer !== null\n && [ViewerNames.buildings, ViewerNames.sites, ViewerNames.files, ViewerNames.land, ViewerNames.infrastructure, ViewerNames.users].includes(builtInViewer) && (\n <DataMenu currentViewer={builtInViewer} organization={organization} geocodeEarthApiKey={geocodeEarthApiKey} geocoderUrl={geocoderUrl} />\n )}\n {/* `plugins` used to route through DataMenu, which rendered nothing:\n VIEWER_CONFIG gives it no dataType. It has its own page now. */}\n {builtInViewer === ViewerNames.extensions && (\n <div className=\"h-full w-full overflow-y-auto\">\n <PluginsManager />\n </div>\n )}\n {builtInViewer === ViewerNames.settings && (\n <UserSettings minioBaseUrl={minioBaseUrl} />\n )}\n {pluginPage && (\n <div className=\"h-full w-full overflow-y-auto\">\n <PluginDataPageHost viewer={validViewer} />\n </div>\n )}\n </div>\n </>\n )\n\n return (\n <>\n {selectedViewer}\n <Toolbar viewer={validViewer} minioBaseUrl={minioBaseUrl} martinBaseUrl={martinBaseUrl} organization={organization} geocodeEarthApiKey={geocodeEarthApiKey} geocoderUrl={geocoderUrl} />\n <UploadProgressToasts />\n </>\n )\n}"],"mappings":";AA+B+B,SA0I3B,UA1I2B,KAwBzB,YAxByB;AAzB/B,SAAS,eAAe;AACxB,OAAO,aAAa;AACpB,SAAS,iBAAiB,WAAW,mBAAmB;AACxD,YAAY,WAAW;AAEvB,SAAS,4BAA4B;AACrC,SAAS,kBAAkB,oBAAoB;AAC/C,SAAS,mBAAmB;AAG5B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAE/B,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAKhC,MAAM,YAAY;AAAA,EAChB,MAAM,OAAO,iBAAiB,EAAE,KAAK,QAAM,EAAE,SAAS,EAAE,UAAU,EAAE;AAAA,EACpE,EAAE,KAAK,OAAO,SAAS,MAAM,oBAAC,yBAAsB,OAAM,4BAAsB,EAAG;AACrF;AAGA,MAAM,iBAAiB;AAAA,EACrB,MAAM,OAAO,0BAA0B,EAAE,KAAK,QAAM,EAAE,SAAS,EAAE,eAAe,EAAE;AAAA,EAClF,EAAE,KAAK,OAAO,SAAS,MAAM,oBAAC,yBAAsB,OAAM,yBAAmB,EAAG;AAClF;AAEA,MAAM,WAAW;AAAA,EACf,MAAM,OAAO,iBAAiB,EAAE,KAAK,QAAM,EAAE,SAAS,EAAE,SAAS,EAAE;AAAA,EACnE,EAAE,KAAK,OAAO,SAAS,MAAM,oBAAC,yBAAsB,OAAM,sBAAgB,EAAG;AAC/E;AAGA,MAAM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els.load(bimFile.url, bimFile.name);
|
|
153
153
|
loaded.push(bimFile);
|
|
154
|
-
if ((bimFile.
|
|
154
|
+
if ((bimFile.fileTransformX != null || bimFile.fileTransformY != null || bimFile.fileTransformZ != null) && fragments) {
|
|
155
155
|
const fragModel = fragments.core.models.list.get(bimFile.name);
|
|
156
156
|
if (fragModel) applyModelPlacement(fragModel.object, bimFile);
|
|
157
157
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/core/components/viewers/bim/src/BimLoadingState/index.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { Upload, Box, Building2, Search, X, SquareArrowOutUpRight, TriangleAlert } from 'lucide-react'\nimport { useSearchParams } from 'next/navigation'\nimport { useTranslations } from 'next-intl'\nimport React from 'react'\n\nimport { useBuilding, useBuildings } from '../../../../../hooks/buildings/buildings'\nimport { useFilesByBuildingId, useUploadFileToBuilding } from '../../../../../hooks/files/files'\nimport { BimContext, BuildingsContext, usePermissions } from '../../../../../store'\nimport { cn } from '../../../../../utils/utils'\nimport { Button } from '../../../../ui/Button'\nimport { Card, CardContent, CardHeader } from '../../../../ui/Card'\nimport { typeOfFile } from '../../../../ui/FilesManager/src/fileType'\nimport { useFileUploadHandler } from '../../../../ui/FilesManager/src/useFileUploadHandler'\nimport { Input } from '../../../../ui/Input'\nimport { LoadingSpinner } from '../../../../ui/LoadingSpinner'\nimport { setCameraLookAt } from '../../utils/setCameraLookAt'\nimport { partitionFileTab } from '../BimSidebar/src/FileTab/src/partitionFileTab'\nimport { ElevationsTool } from '../ElevationsTool'\nimport { FloorplanTool } from '../FloorplanTool'\nimport { applyModelPlacement } from '../lib/applyModelPlacement'\nimport { isBimFile, selectLoadableBimFiles } from '../lib/bimFilesToLoad'\nimport { nextBimViewerState } from '../lib/bimViewerState'\nimport { acceptAttribute, routePickedFile } from '../lib/pickAndRouteFile'\nimport { requestPlacement } from '../lib/placementRequests'\nimport { searchBuildings } from '../lib/searchBuildings'\nimport { useBimFileIntake } from '../lib/useBimFileIntake'\nimport { useOptionListKeys } from '../lib/useOptionListKeys'\nimport { useSelectBuilding } from '../lib/useSelectBuilding'\nimport { LoadModels } from '../LoadModels'\nimport { BimPointClouds } from '../PointClouds'\nimport { BimSceneObjects } from '../SceneObjects'\n\nimport type { DbFile as DbFile } from '../../../../../types/dbTypes'\nimport type { BimViewerState } from '../lib/bimViewerState'\n\n\nexport type bimViewerState = BimViewerState\n\nconst ADDABLE_HERE = ['bim-file', 'point-cloud-file', 'splat-file', '3d-file', 'cad-file'] as const\n\nexport function BimLoadingState() {\n const t = useTranslations('BimLoadingState')\n // Permissions\n const { ability } = usePermissions()\n\n const { state: bimState, dispatch: bimDispatch } = React.useContext(BimContext)\n const { bimComponents, world, fragments, modelUIState, fragmentsStarted } = bimState.bim\n const { state: buildingState, dispatch: buildingDispatch } = React.useContext(BuildingsContext)\n const { building: storeBuilding } = buildingState.buildings\n\n const searchParams = useSearchParams()\n const buildingId = searchParams.get(\"buildingId\")\n const { building: urlBuilding, isLoading: buildingLoading, isError: buildingError } = useBuilding(buildingId ? Number(buildingId) : null)\n const { buildings, isLoading: buildingsLoading } = useBuildings()\n\n // Determine the current building to use\n const building = storeBuilding || urlBuilding\n\n React.useEffect(() => {\n if (!storeBuilding && urlBuilding ) {\n buildingDispatch({ type: \"SET-CURRENT-BUILDING\", payload: { building: urlBuilding } })\n }\n }, [urlBuilding, storeBuilding, buildingDispatch])\n\n const selectBuilding = useSelectBuilding()\n const fileInputRef = React.useRef<HTMLInputElement>(null)\n const loadedBuildingRef = React.useRef<number | null>(null)\n\n // Switching buildings has to drop the previous models, or the guard below keeps the old ones.\n React.useEffect(() => {\n const id = building?.id ?? null\n if (loadedBuildingRef.current === id) return\n\n const previous = loadedBuildingRef.current\n loadedBuildingRef.current = id\n if (previous === null) return\n\n for (const [modelId] of fragments?.list ?? []) {\n void fragments?.core.disposeModel(modelId).catch(() => undefined)\n }\n\n // The drawing tools outlive the building: nothing disposes them per route, so they need an explicit reset.\n try {\n bimComponents?.get(FloorplanTool).resetAll()\n bimComponents?.get(ElevationsTool).resetAll()\n } catch {\n // The drawing tools only exist once the world is built.\n }\n\n // Models, placed objects and clouds all belong to the building that was open.\n try {\n bimComponents?.get(BimSceneObjects).registry?.resetForBuilding(id)\n } catch {\n // The world may not be built yet, in which case there is nothing placed.\n }\n bimDispatch({ type: 'SET_POINT_CLOUD_IDS', payload: { pointCloudIds: [] } })\n\n setHasLoadedModels(false)\n setPlacingFile(false)\n setCurrentState('opening')\n }, [building?.id, fragments, bimComponents, bimDispatch])\n\n // Upload file hooks\n const { uploadFile } = useUploadFileToBuilding(building?.id)\n\n // Use the reusable upload handler\n const { handleFileUpload } = useFileUploadHandler({\n buildingId: building?.id,\n tag: 'bim-file',\n isVisible: true,\n uploadFile,\n })\n\n const [currentState, setCurrentState] = React.useState<BimViewerState>('opening')\n const [hasLoadedModels, setHasLoadedModels] = React.useState(false)\n const [cameraHasMoved, setCameraHasMoved] = React.useState(false)\n const [placingFile, setPlacingFile] = React.useState(false)\n const isLoadingModelsRef = React.useRef(false)\n const [searchTerm, setSearchTerm] = React.useState('')\n const [searchResults, setSearchResults] = React.useState<any[]>([])\n const optionKeys = useOptionListKeys(searchResults.length)\n const [selectedBuilding, setSelectedBuilding] = React.useState<any>(null)\n\n const { files, isLoading: filesLoading, isError: filesError } = useFilesByBuildingId(building?.id)\n const allBimFiles: DbFile[] = React.useMemo(() => files.filter(isBimFile), [files])\n const bimFiles: DbFile[] = React.useMemo(\n () => selectLoadableBimFiles(files, modelUIState),\n [files, modelUIState],\n )\n const sceneFileCount = React.useMemo(() => {\n const buckets = partitionFileTab(files)\n return buckets.bim.length + buckets.models.length + buckets.pointClouds.length\n }, [files])\n\n const intake = useBimFileIntake({\n buildingId: building?.id ?? 0,\n apiBase: bimComponents?.get(BimPointClouds).apiBase ?? '',\n existingNames: files.map(file => file.name),\n uploadFile,\n })\n\n // Handle search\n const handleSearch = React.useCallback((term: string) => {\n setSearchTerm(term)\n if (buildings) {\n setSearchResults(searchBuildings(buildings, term))\n }\n }, [buildings])\n\n const shouldShow = (currentState === 'opening' || currentState === 'noBimFiles' || currentState === 'loading' || currentState === 'noBuilding' || currentState === 'filesUnavailable') && !cameraHasMoved && !placingFile\n // The scrim is there to focus a card the user must act on; while merely loading it just greys the viewer.\n const dimBackdrop = currentState === 'noBuilding' || currentState === 'noBimFiles' || currentState === 'filesUnavailable'\n\n // Once models have loaded, start a fallback timer to dismiss the card if camera doesn't move\n React.useEffect(() => {\n if (currentState === 'loading' && hasLoadedModels) {\n const fallbackTimer = setTimeout(() => {\n setCameraHasMoved(true)\n setCurrentState('ready')\n }, 5000)\n\n return () => clearTimeout(fallbackTimer)\n }\n }, [currentState, hasLoadedModels])\n\n // Set up camera movement detection\n React.useEffect(() => {\n if (bimState.bim.world?.camera?.controls) {\n const controls = bimState.bim.world.camera.controls\n\n const handleCameraChange = () => {\n setCameraHasMoved(true)\n if (hasLoadedModels) {\n setCurrentState('ready')\n }\n }\n\n // Listen for camera control event (when user moves the camera)\n controls.addEventListener('control', handleCameraChange)\n\n return () => {\n controls.removeEventListener('control', handleCameraChange)\n }\n }\n }, [bimState.bim.world, hasLoadedModels])\n\n const loadBimFiles = React.useCallback(async (toLoad: DbFile[]) => {\n if (!bimComponents || toLoad.length === 0) return 0\n const loadModels = bimComponents.get(LoadModels)\n\n const loaded: DbFile[] = []\n for (const bimFile of toLoad) {\n try {\n await loadModels.load(bimFile.url, bimFile.name)\n loaded.push(bimFile)\n if ((bimFile.x != null || bimFile.y != null || bimFile.z != null) && fragments) {\n const fragModel = fragments.core.models.list.get(bimFile.name)\n if (fragModel) applyModelPlacement(fragModel.object, bimFile)\n }\n } catch (e) {\n console.error(\"Error loading BIM file\", bimFile.name, e)\n }\n }\n\n // Force update the fragments to render geometry immediately\n if (fragments) {\n void fragments.core.update(true)\n }\n\n // Only the files that actually arrived, so a failed one reads as hidden and can be retried.\n for (const bimFile of loaded) {\n bimDispatch({ type: 'SET_MODEL_UI_STATE', payload: { fileId: bimFile.id, isVisible: true } })\n }\n\n return loaded.length\n }, [bimComponents, fragments, bimDispatch])\n\n const loadBimModels = React.useCallback(async () => {\n if (!bimComponents || bimFiles.length === 0) return\n if (isLoadingModelsRef.current) return\n\n isLoadingModelsRef.current = true\n bimDispatch({ type: 'SET_FRAGMENTS_STARTED', payload: { fragmentsStarted: true } })\n\n try {\n // State should already be 'loading' when this is called\n const loadModels = bimComponents.get(LoadModels)\n\n const {sharing} = setCameraLookAt(world, searchParams)\n loadModels.sharing = sharing\n\n // An empty count means every file failed, which must not dismiss the card as though loaded.\n if (await loadBimFiles(bimFiles) === 0) {\n setCurrentState('error')\n return\n }\n\n // Signal that models have loaded — the fallback timer will dismiss the card\n setHasLoadedModels(true)\n } catch (error) {\n console.error('Error loading BIM models:', error)\n setCurrentState('error')\n } finally {\n isLoadingModelsRef.current = false\n }\n }, [bimComponents, bimFiles, loadBimFiles, bimDispatch])\n\n // A building with no BIM file has nothing to wait for, so it must open the gate itself.\n React.useEffect(() => {\n if (fragmentsStarted || filesLoading || bimFiles.length > 0) return\n bimDispatch({ type: 'SET_FRAGMENTS_STARTED', payload: { fragmentsStarted: true } })\n }, [fragmentsStarted, filesLoading, bimFiles.length, bimDispatch])\n\n // The state machine stops after the first batch, so a later upload needs its own pass.\n React.useEffect(() => {\n if (!hasLoadedModels || isLoadingModelsRef.current) return\n const loaded = fragments?.core.models.list\n const pending = bimFiles.filter(bimFile => !loaded?.has(bimFile.name))\n if (pending.length === 0) return\n\n isLoadingModelsRef.current = true\n void loadBimFiles(pending).finally(() => { isLoadingModelsRef.current = false })\n }, [bimFiles, hasLoadedModels, fragments, loadBimFiles])\n\n // Handle initial state transitions\n React.useEffect(() => {\n const transition = nextBimViewerState({\n hasComponents: !!bimComponents,\n hasBuildingId: !!buildingId,\n hasBuilding: !!building,\n buildingLoading,\n buildingError: !!buildingError,\n filesLoading,\n filesError: !!filesError,\n bimFileCount: bimFiles.length,\n hiddenBimFileCount: allBimFiles.length - bimFiles.length,\n sceneFileCount,\n hasLoadedModels,\n })\n if (!transition) return\n\n setCurrentState(transition.state)\n if (transition.resetLoadedModels) setHasLoadedModels(false)\n if (transition.loadModels) {\n setCameraHasMoved(false)\n void loadBimModels()\n }\n }, [bimComponents, building, buildingLoading, buildingError, buildingId, filesLoading, filesError, bimFiles.length, allBimFiles.length, sceneFileCount, loadBimModels, hasLoadedModels])\n\n // Don't render if not visible\n if (!shouldShow) {\n return null\n }\n\n const handleUploadClick = () => {\n fileInputRef.current?.click()\n }\n\n const handleBuildingSelect = (building: any) => {\n selectBuilding(building)\n setSelectedBuilding(building)\n setSearchTerm('')\n setSearchResults([])\n }\n\n const uploadBimFile = async (file: File) => {\n try {\n const modelId = file.name\n setCurrentState('loading')\n setCameraHasMoved(false) // Reset camera moved state for new upload\n await handleFileUpload(file)\n\n window.dispatchEvent(new CustomEvent('bim-model-loaded-from-file', { detail: { modelId } }))\n bimDispatch({\n type: 'SET_MODEL', payload: { modelId },\n })\n setCurrentState('ready')\n }\n catch (error) {\n console.error('Error uploading file:', error)\n setCurrentState('error')\n }\n }\n\n const handleFileChange = async (event: React.ChangeEvent<HTMLInputElement>) => {\n const picked = event.target.files?.[0]\n event.target.value = ''\n if (!picked) return\n\n if (typeOfFile(picked) === 'bim-file') {\n await uploadBimFile(picked)\n return\n }\n\n routePickedFile(picked, {\n needsPlacement: intake.needsPlacement,\n // The card covers the viewport the user has to click to place the file.\n onPlace: (file) => {\n setPlacingFile(true)\n if (!requestPlacement(file)) void intake.submit(file)\n },\n onSubmit: file => { void intake.submit(file) },\n })\n }\n\n return (\n <>\n <div\n className={cn(\n 'absolute z-10 inset-0 flex items-center justify-center pointer-events-none',\n dimBackdrop && 'bg-background/50 backdrop-blur-[1px]',\n )}\n >\n <Card className={cn(\"w-[536px] pointer-events-auto flex flex-col justify-start items-center gap-2\")}>\n <CardHeader className=\"flex justify-center items-center\">\n <div className=\"w-12 h-12 p-2 bg-card rounded-md shadow-sm border border-border flex justify-center items-center\">\n {currentState === 'noBuilding' ? (\n <Building2 className={cn(\"w-4 h-5 text-foreground\", buildingsLoading && \"animate-pulse\")} strokeWidth={2} />\n ) : currentState === 'filesUnavailable' ? (\n <TriangleAlert className=\"w-4 h-5 text-foreground\" strokeWidth={2} />\n ) : (\n <Box className={cn(\"w-4 h-5 text-foreground\", currentState === 'opening' && \"animate-pulse\")} strokeWidth={2} />\n )}\n </div>\n </CardHeader>\n\n <CardContent className=\"self-stretch flex flex-col justify-start items-center gap-6 pt-0\">\n <div className=\"self-stretch flex flex-col justify-start items-center gap-2\">\n <div className=\"self-stretch text-center text-foreground text-xl font-semibold font-['Inter'] leading-7 flex items-center justify-center gap-2\">\n {currentState === 'opening' ? (\n <>\n {t('openingText')}\n <LoadingSpinner size={20} />\n </>\n ) : currentState === 'loading' ? (\n <>\n {t('loadingBimModel')}\n <LoadingSpinner size={20} />\n </>\n ) : currentState === 'noBuilding' ? (\n <>\n {t('noBuilding')}\n </>\n ) : currentState === 'filesUnavailable' ? (\n <>\n {t('filesUnavailable')}\n </>\n ) : (\n t('no3DLoaded')\n )}\n </div>\n {(currentState === 'noBimFiles' || currentState === 'noBuilding' || currentState === 'filesUnavailable') && (\n <div className=\"self-stretch text-center text-muted-foreground text-sm font-normal font-['Inter'] leading-tight\">\n {currentState === 'noBuilding'\n ? t('selectBuildingHelpText')\n : currentState === 'filesUnavailable' ? t('filesUnavailableHelpText') : t('helpText')}\n </div>\n )}\n </div>\n\n {currentState === 'noBuilding' && (\n <div className=\"self-stretch flex flex-col gap-3 justify-centre items-center\">\n {buildingsLoading ? (\n <div className=\"flex items-center justify-center gap-2 text-muted-foreground\">\n <LoadingSpinner size={16} />\n <span>{t('loadingBuildings') || 'Loading buildings...'}</span>\n </div>\n ) : buildings && buildings.length > 0 ? (\n <div className=\"w-full relative\">\n {selectedBuilding ? (\n <div className=\"relative flex justify-end items-center\">\n <Input\n type=\"text\"\n value={\n 'Building: '\n + (selectedBuilding.buildingName && selectedBuilding.buildingAddress\n ? `${selectedBuilding.buildingName}, ${selectedBuilding.buildingAddress}`\n : selectedBuilding.buildingName || selectedBuilding.buildingAddress || `Building ${selectedBuilding.id}`)\n }\n readOnly\n className=\"w-full\"\n />\n <X\n className=\"absolute right-2 cursor-pointer w-4 h-4 text-muted-foreground hover:text-foreground\"\n onClick={() => {\n setSelectedBuilding(null)\n setSearchTerm('')\n setSearchResults([])\n }}\n />\n </div>\n ) : (\n <div className=\"relative\">\n <Search className=\"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4\" />\n <Input\n ref={optionKeys.inputRef}\n placeholder={t('searchBuildings') || 'Search buildings...'}\n value={searchTerm}\n onChange={(e) => handleSearch(e.target.value)}\n onKeyDown={optionKeys.onInputKeyDown}\n className=\"w-full pl-10\"\n disabled={!ability.can('read', 'Building')}\n />\n </div>\n )}\n\n {/* Search results dropdown */}\n {searchResults.length > 0 && searchTerm !== '' && !selectedBuilding && (\n <div className=\"absolute top-full left-0 right-0 mt-1 bg-background border border-border rounded-md shadow-lg max-h-60 overflow-y-auto z-20\">\n {searchResults.map((building, index) => (\n <button\n key={building.id}\n type=\"button\"\n ref={optionKeys.optionRef(index)}\n className=\"w-full px-3 py-2 text-sm text-left cursor-pointer hover:bg-muted focus:bg-muted focus:outline-none transition-colors flex gap-2 items-center\"\n onKeyDown={optionKeys.onOptionKeyDown(index)}\n onClick={() => handleBuildingSelect(building)}\n >\n <SquareArrowOutUpRight className=\"w-3 h-3 shrink-0\" />\n {building.buildingName\n ? `${building.buildingName}, ${building.buildingAddress}`\n : building.buildingAddress || `Building ${building.id}`}\n </button>\n ))}\n </div>\n )}\n </div>\n ) : (\n <div className=\"text-muted-foreground text-center\">\n {t('noBuildings') || 'No buildings available'}\n </div>\n )}\n </div>\n )}\n\n {currentState === 'noBimFiles' && (\n <div className=\"self-stretch flex justify-center items-center gap-3\">\n <Input\n ref={fileInputRef}\n type=\"file\"\n accept={acceptAttribute(ADDABLE_HERE)}\n onChange={(event) => void handleFileChange(event)}\n className=\"hidden\"\n />\n <Button\n onClick={handleUploadClick}\n size=\"sm\"\n className=\"gap-2\"\n disabled={!ability.can('create', 'File')}\n >\n <Upload className=\"w-4 h-4\" />\n {t('uploadButton')}\n </Button>\n </div>\n )}\n </CardContent>\n </Card>\n </div>\n </>\n )\n}\n"],"mappings":";AA0WgB,SAaE,UAbF,KAaE,YAbF;AArWhB,SAAS,QAAQ,KAAK,WAAW,QAAQ,GAAG,uBAAuB,qBAAqB;AACxF,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,OAAO,WAAW;AAElB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,sBAAsB,+BAA+B;AAC9D,SAAS,YAAY,kBAAkB,sBAAsB;AAC7D,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,MAAM,aAAa,kBAAkB;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AACrC,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,WAAW,8BAA8B;AAClD,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAQhC,MAAM,eAAe,CAAC,YAAY,oBAAoB,cAAc,WAAW,UAAU;AAElF,SAAS,kBAAkB;AA7ClC;AA8CE,QAAM,IAAI,gBAAgB,iBAAiB;AAE3C,QAAM,EAAE,QAAQ,IAAI,eAAe;AAEnC,QAAM,EAAE,OAAO,UAAU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U,+HACZ,wBAAc,IAAI,CAACE,WAAU,UAC5B;AAAA,cAAC;AAAA;AAAA,gBAEC,MAAK;AAAA,gBACL,KAAK,WAAW,UAAU,KAAK;AAAA,gBAC/B,WAAU;AAAA,gBACV,WAAW,WAAW,gBAAgB,KAAK;AAAA,gBAC3C,SAAS,MAAM,qBAAqBA,SAAQ;AAAA,gBAE5C;AAAA,sCAAC,yBAAsB,WAAU,oBAAmB;AAAA,kBACnDA,UAAS,eACN,GAAGA,UAAS,YAAY,KAAKA,UAAS,eAAe,KACrDA,UAAS,mBAAmB,YAAYA,UAAS,EAAE;AAAA;AAAA;AAAA,cAVlDA,UAAS;AAAA,YAWhB,CACD,GACH;AAAA,aAEJ,IAEA,oBAAC,SAAI,WAAU,qCACZ,YAAE,aAAa,KAAK,0BACvB,GAEJ;AAAA,UAGD,iBAAiB,gBAChB,qBAAC,SAAI,WAAU,uDACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK;AAAA,gBACL,MAAK;AAAA,gBACL,QAAQ,gBAAgB,YAAY;AAAA,gBACpC,UAAU,CAAC,UAAU,KAAK,iBAAiB,KAAK;AAAA,gBAChD,WAAU;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAS;AAAA,gBACT,MAAK;AAAA,gBACL,WAAU;AAAA,gBACV,UAAU,CAAC,QAAQ,IAAI,UAAU,MAAM;AAAA,gBAEvC;AAAA,sCAAC,UAAO,WAAU,WAAU;AAAA,kBAC3B,EAAE,cAAc;AAAA;AAAA;AAAA,YACnB;AAAA,aACF;AAAA,WAEJ;AAAA,SACF;AAAA;AAAA,EACF,GACF;AAEJ;","names":["_a","_b","building"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/core/components/viewers/bim/src/BimLoadingState/index.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { Upload, Box, Building2, Search, X, SquareArrowOutUpRight, TriangleAlert } from 'lucide-react'\nimport { useSearchParams } from 'next/navigation'\nimport { useTranslations } from 'next-intl'\nimport React from 'react'\n\nimport { useBuilding, useBuildings } from '../../../../../hooks/buildings/buildings'\nimport { useFilesByBuildingId, useUploadFileToBuilding } from '../../../../../hooks/files/files'\nimport { BimContext, BuildingsContext, usePermissions } from '../../../../../store'\nimport { cn } from '../../../../../utils/utils'\nimport { Button } from '../../../../ui/Button'\nimport { Card, CardContent, CardHeader } from '../../../../ui/Card'\nimport { typeOfFile } from '../../../../ui/FilesManager/src/fileType'\nimport { useFileUploadHandler } from '../../../../ui/FilesManager/src/useFileUploadHandler'\nimport { Input } from '../../../../ui/Input'\nimport { LoadingSpinner } from '../../../../ui/LoadingSpinner'\nimport { setCameraLookAt } from '../../utils/setCameraLookAt'\nimport { partitionFileTab } from '../BimSidebar/src/FileTab/src/partitionFileTab'\nimport { ElevationsTool } from '../ElevationsTool'\nimport { FloorplanTool } from '../FloorplanTool'\nimport { applyModelPlacement } from '../lib/applyModelPlacement'\nimport { isBimFile, selectLoadableBimFiles } from '../lib/bimFilesToLoad'\nimport { nextBimViewerState } from '../lib/bimViewerState'\nimport { acceptAttribute, routePickedFile } from '../lib/pickAndRouteFile'\nimport { requestPlacement } from '../lib/placementRequests'\nimport { searchBuildings } from '../lib/searchBuildings'\nimport { useBimFileIntake } from '../lib/useBimFileIntake'\nimport { useOptionListKeys } from '../lib/useOptionListKeys'\nimport { useSelectBuilding } from '../lib/useSelectBuilding'\nimport { LoadModels } from '../LoadModels'\nimport { BimPointClouds } from '../PointClouds'\nimport { BimSceneObjects } from '../SceneObjects'\n\nimport type { DbFile as DbFile } from '../../../../../types/dbTypes'\nimport type { BimViewerState } from '../lib/bimViewerState'\n\n\nexport type bimViewerState = BimViewerState\n\nconst ADDABLE_HERE = ['bim-file', 'point-cloud-file', 'splat-file', '3d-file', 'cad-file'] as const\n\nexport function BimLoadingState() {\n const t = useTranslations('BimLoadingState')\n // Permissions\n const { ability } = usePermissions()\n\n const { state: bimState, dispatch: bimDispatch } = React.useContext(BimContext)\n const { bimComponents, world, fragments, modelUIState, fragmentsStarted } = bimState.bim\n const { state: buildingState, dispatch: buildingDispatch } = React.useContext(BuildingsContext)\n const { building: storeBuilding } = buildingState.buildings\n\n const searchParams = useSearchParams()\n const buildingId = searchParams.get(\"buildingId\")\n const { building: urlBuilding, isLoading: buildingLoading, isError: buildingError } = useBuilding(buildingId ? Number(buildingId) : null)\n const { buildings, isLoading: buildingsLoading } = useBuildings()\n\n // Determine the current building to use\n const building = storeBuilding || urlBuilding\n\n React.useEffect(() => {\n if (!storeBuilding && urlBuilding ) {\n buildingDispatch({ type: \"SET-CURRENT-BUILDING\", payload: { building: urlBuilding } })\n }\n }, [urlBuilding, storeBuilding, buildingDispatch])\n\n const selectBuilding = useSelectBuilding()\n const fileInputRef = React.useRef<HTMLInputElement>(null)\n const loadedBuildingRef = React.useRef<number | null>(null)\n\n // Switching buildings has to drop the previous models, or the guard below keeps the old ones.\n React.useEffect(() => {\n const id = building?.id ?? null\n if (loadedBuildingRef.current === id) return\n\n const previous = loadedBuildingRef.current\n loadedBuildingRef.current = id\n if (previous === null) return\n\n for (const [modelId] of fragments?.list ?? []) {\n void fragments?.core.disposeModel(modelId).catch(() => undefined)\n }\n\n // The drawing tools outlive the building: nothing disposes them per route, so they need an explicit reset.\n try {\n bimComponents?.get(FloorplanTool).resetAll()\n bimComponents?.get(ElevationsTool).resetAll()\n } catch {\n // The drawing tools only exist once the world is built.\n }\n\n // Models, placed objects and clouds all belong to the building that was open.\n try {\n bimComponents?.get(BimSceneObjects).registry?.resetForBuilding(id)\n } catch {\n // The world may not be built yet, in which case there is nothing placed.\n }\n bimDispatch({ type: 'SET_POINT_CLOUD_IDS', payload: { pointCloudIds: [] } })\n\n setHasLoadedModels(false)\n setPlacingFile(false)\n setCurrentState('opening')\n }, [building?.id, fragments, bimComponents, bimDispatch])\n\n // Upload file hooks\n const { uploadFile } = useUploadFileToBuilding(building?.id)\n\n // Use the reusable upload handler\n const { handleFileUpload } = useFileUploadHandler({\n buildingId: building?.id,\n tag: 'bim-file',\n isVisible: true,\n uploadFile,\n })\n\n const [currentState, setCurrentState] = React.useState<BimViewerState>('opening')\n const [hasLoadedModels, setHasLoadedModels] = React.useState(false)\n const [cameraHasMoved, setCameraHasMoved] = React.useState(false)\n const [placingFile, setPlacingFile] = React.useState(false)\n const isLoadingModelsRef = React.useRef(false)\n const [searchTerm, setSearchTerm] = React.useState('')\n const [searchResults, setSearchResults] = React.useState<any[]>([])\n const optionKeys = useOptionListKeys(searchResults.length)\n const [selectedBuilding, setSelectedBuilding] = React.useState<any>(null)\n\n const { files, isLoading: filesLoading, isError: filesError } = useFilesByBuildingId(building?.id)\n const allBimFiles: DbFile[] = React.useMemo(() => files.filter(isBimFile), [files])\n const bimFiles: DbFile[] = React.useMemo(\n () => selectLoadableBimFiles(files, modelUIState),\n [files, modelUIState],\n )\n const sceneFileCount = React.useMemo(() => {\n const buckets = partitionFileTab(files)\n return buckets.bim.length + buckets.models.length + buckets.pointClouds.length\n }, [files])\n\n const intake = useBimFileIntake({\n buildingId: building?.id ?? 0,\n apiBase: bimComponents?.get(BimPointClouds).apiBase ?? '',\n existingNames: files.map(file => file.name),\n uploadFile,\n })\n\n // Handle search\n const handleSearch = React.useCallback((term: string) => {\n setSearchTerm(term)\n if (buildings) {\n setSearchResults(searchBuildings(buildings, term))\n }\n }, [buildings])\n\n const shouldShow = (currentState === 'opening' || currentState === 'noBimFiles' || currentState === 'loading' || currentState === 'noBuilding' || currentState === 'filesUnavailable') && !cameraHasMoved && !placingFile\n // The scrim is there to focus a card the user must act on; while merely loading it just greys the viewer.\n const dimBackdrop = currentState === 'noBuilding' || currentState === 'noBimFiles' || currentState === 'filesUnavailable'\n\n // Once models have loaded, start a fallback timer to dismiss the card if camera doesn't move\n React.useEffect(() => {\n if (currentState === 'loading' && hasLoadedModels) {\n const fallbackTimer = setTimeout(() => {\n setCameraHasMoved(true)\n setCurrentState('ready')\n }, 5000)\n\n return () => clearTimeout(fallbackTimer)\n }\n }, [currentState, hasLoadedModels])\n\n // Set up camera movement detection\n React.useEffect(() => {\n if (bimState.bim.world?.camera?.controls) {\n const controls = bimState.bim.world.camera.controls\n\n const handleCameraChange = () => {\n setCameraHasMoved(true)\n if (hasLoadedModels) {\n setCurrentState('ready')\n }\n }\n\n // Listen for camera control event (when user moves the camera)\n controls.addEventListener('control', handleCameraChange)\n\n return () => {\n controls.removeEventListener('control', handleCameraChange)\n }\n }\n }, [bimState.bim.world, hasLoadedModels])\n\n const loadBimFiles = React.useCallback(async (toLoad: DbFile[]) => {\n if (!bimComponents || toLoad.length === 0) return 0\n const loadModels = bimComponents.get(LoadModels)\n\n const loaded: DbFile[] = []\n for (const bimFile of toLoad) {\n try {\n await loadModels.load(bimFile.url, bimFile.name)\n loaded.push(bimFile)\n if ((bimFile.fileTransformX != null || bimFile.fileTransformY != null || bimFile.fileTransformZ != null) && fragments) {\n const fragModel = fragments.core.models.list.get(bimFile.name)\n if (fragModel) applyModelPlacement(fragModel.object, bimFile)\n }\n } catch (e) {\n console.error(\"Error loading BIM file\", bimFile.name, e)\n }\n }\n\n // Force update the fragments to render geometry immediately\n if (fragments) {\n void fragments.core.update(true)\n }\n\n // Only the files that actually arrived, so a failed one reads as hidden and can be retried.\n for (const bimFile of loaded) {\n bimDispatch({ type: 'SET_MODEL_UI_STATE', payload: { fileId: bimFile.id, isVisible: true } })\n }\n\n return loaded.length\n }, [bimComponents, fragments, bimDispatch])\n\n const loadBimModels = React.useCallback(async () => {\n if (!bimComponents || bimFiles.length === 0) return\n if (isLoadingModelsRef.current) return\n\n isLoadingModelsRef.current = true\n bimDispatch({ type: 'SET_FRAGMENTS_STARTED', payload: { fragmentsStarted: true } })\n\n try {\n // State should already be 'loading' when this is called\n const loadModels = bimComponents.get(LoadModels)\n\n const {sharing} = setCameraLookAt(world, searchParams)\n loadModels.sharing = sharing\n\n // An empty count means every file failed, which must not dismiss the card as though loaded.\n if (await loadBimFiles(bimFiles) === 0) {\n setCurrentState('error')\n return\n }\n\n // Signal that models have loaded — the fallback timer will dismiss the card\n setHasLoadedModels(true)\n } catch (error) {\n console.error('Error loading BIM models:', error)\n setCurrentState('error')\n } finally {\n isLoadingModelsRef.current = false\n }\n }, [bimComponents, bimFiles, loadBimFiles, bimDispatch])\n\n // A building with no BIM file has nothing to wait for, so it must open the gate itself.\n React.useEffect(() => {\n if (fragmentsStarted || filesLoading || bimFiles.length > 0) return\n bimDispatch({ type: 'SET_FRAGMENTS_STARTED', payload: { fragmentsStarted: true } })\n }, [fragmentsStarted, filesLoading, bimFiles.length, bimDispatch])\n\n // The state machine stops after the first batch, so a later upload needs its own pass.\n React.useEffect(() => {\n if (!hasLoadedModels || isLoadingModelsRef.current) return\n const loaded = fragments?.core.models.list\n const pending = bimFiles.filter(bimFile => !loaded?.has(bimFile.name))\n if (pending.length === 0) return\n\n isLoadingModelsRef.current = true\n void loadBimFiles(pending).finally(() => { isLoadingModelsRef.current = false })\n }, [bimFiles, hasLoadedModels, fragments, loadBimFiles])\n\n // Handle initial state transitions\n React.useEffect(() => {\n const transition = nextBimViewerState({\n hasComponents: !!bimComponents,\n hasBuildingId: !!buildingId,\n hasBuilding: !!building,\n buildingLoading,\n buildingError: !!buildingError,\n filesLoading,\n filesError: !!filesError,\n bimFileCount: bimFiles.length,\n hiddenBimFileCount: allBimFiles.length - bimFiles.length,\n sceneFileCount,\n hasLoadedModels,\n })\n if (!transition) return\n\n setCurrentState(transition.state)\n if (transition.resetLoadedModels) setHasLoadedModels(false)\n if (transition.loadModels) {\n setCameraHasMoved(false)\n void loadBimModels()\n }\n }, [bimComponents, building, buildingLoading, buildingError, buildingId, filesLoading, filesError, bimFiles.length, allBimFiles.length, sceneFileCount, loadBimModels, hasLoadedModels])\n\n // Don't render if not visible\n if (!shouldShow) {\n return null\n }\n\n const handleUploadClick = () => {\n fileInputRef.current?.click()\n }\n\n const handleBuildingSelect = (building: any) => {\n selectBuilding(building)\n setSelectedBuilding(building)\n setSearchTerm('')\n setSearchResults([])\n }\n\n const uploadBimFile = async (file: File) => {\n try {\n const modelId = file.name\n setCurrentState('loading')\n setCameraHasMoved(false) // Reset camera moved state for new upload\n await handleFileUpload(file)\n\n window.dispatchEvent(new CustomEvent('bim-model-loaded-from-file', { detail: { modelId } }))\n bimDispatch({\n type: 'SET_MODEL', payload: { modelId },\n })\n setCurrentState('ready')\n }\n catch (error) {\n console.error('Error uploading file:', error)\n setCurrentState('error')\n }\n }\n\n const handleFileChange = async (event: React.ChangeEvent<HTMLInputElement>) => {\n const picked = event.target.files?.[0]\n event.target.value = ''\n if (!picked) return\n\n if (typeOfFile(picked) === 'bim-file') {\n await uploadBimFile(picked)\n return\n }\n\n routePickedFile(picked, {\n needsPlacement: intake.needsPlacement,\n // The card covers the viewport the user has to click to place the file.\n onPlace: (file) => {\n setPlacingFile(true)\n if (!requestPlacement(file)) void intake.submit(file)\n },\n onSubmit: file => { void intake.submit(file) },\n })\n }\n\n return (\n <>\n <div\n className={cn(\n 'absolute z-10 inset-0 flex items-center justify-center pointer-events-none',\n dimBackdrop && 'bg-background/50 backdrop-blur-[1px]',\n )}\n >\n <Card className={cn(\"w-[536px] pointer-events-auto flex flex-col justify-start items-center gap-2\")}>\n <CardHeader className=\"flex justify-center items-center\">\n <div className=\"w-12 h-12 p-2 bg-card rounded-md shadow-sm border border-border flex justify-center items-center\">\n {currentState === 'noBuilding' ? (\n <Building2 className={cn(\"w-4 h-5 text-foreground\", buildingsLoading && \"animate-pulse\")} strokeWidth={2} />\n ) : currentState === 'filesUnavailable' ? (\n <TriangleAlert className=\"w-4 h-5 text-foreground\" strokeWidth={2} />\n ) : (\n <Box className={cn(\"w-4 h-5 text-foreground\", currentState === 'opening' && \"animate-pulse\")} strokeWidth={2} />\n )}\n </div>\n </CardHeader>\n\n <CardContent className=\"self-stretch flex flex-col justify-start items-center gap-6 pt-0\">\n <div className=\"self-stretch flex flex-col justify-start items-center gap-2\">\n <div className=\"self-stretch text-center text-foreground text-xl font-semibold font-['Inter'] leading-7 flex items-center justify-center gap-2\">\n {currentState === 'opening' ? (\n <>\n {t('openingText')}\n <LoadingSpinner size={20} />\n </>\n ) : currentState === 'loading' ? (\n <>\n {t('loadingBimModel')}\n <LoadingSpinner size={20} />\n </>\n ) : currentState === 'noBuilding' ? (\n <>\n {t('noBuilding')}\n </>\n ) : currentState === 'filesUnavailable' ? (\n <>\n {t('filesUnavailable')}\n </>\n ) : (\n t('no3DLoaded')\n )}\n </div>\n {(currentState === 'noBimFiles' || currentState === 'noBuilding' || currentState === 'filesUnavailable') && (\n <div className=\"self-stretch text-center text-muted-foreground text-sm font-normal font-['Inter'] leading-tight\">\n {currentState === 'noBuilding'\n ? t('selectBuildingHelpText')\n : currentState === 'filesUnavailable' ? t('filesUnavailableHelpText') : t('helpText')}\n </div>\n )}\n </div>\n\n {currentState === 'noBuilding' && (\n <div className=\"self-stretch flex flex-col gap-3 justify-centre items-center\">\n {buildingsLoading ? (\n <div className=\"flex items-center justify-center gap-2 text-muted-foreground\">\n <LoadingSpinner size={16} />\n <span>{t('loadingBuildings') || 'Loading buildings...'}</span>\n </div>\n ) : buildings && buildings.length > 0 ? (\n <div className=\"w-full relative\">\n {selectedBuilding ? (\n <div className=\"relative flex justify-end items-center\">\n <Input\n type=\"text\"\n value={\n 'Building: '\n + (selectedBuilding.buildingName && selectedBuilding.buildingAddress\n ? `${selectedBuilding.buildingName}, ${selectedBuilding.buildingAddress}`\n : selectedBuilding.buildingName || selectedBuilding.buildingAddress || `Building ${selectedBuilding.id}`)\n }\n readOnly\n className=\"w-full\"\n />\n <X\n className=\"absolute right-2 cursor-pointer w-4 h-4 text-muted-foreground hover:text-foreground\"\n onClick={() => {\n setSelectedBuilding(null)\n setSearchTerm('')\n setSearchResults([])\n }}\n />\n </div>\n ) : (\n <div className=\"relative\">\n <Search className=\"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4\" />\n <Input\n ref={optionKeys.inputRef}\n placeholder={t('searchBuildings') || 'Search buildings...'}\n value={searchTerm}\n onChange={(e) => handleSearch(e.target.value)}\n onKeyDown={optionKeys.onInputKeyDown}\n className=\"w-full pl-10\"\n disabled={!ability.can('read', 'Building')}\n />\n </div>\n )}\n\n {/* Search results dropdown */}\n {searchResults.length > 0 && searchTerm !== '' && !selectedBuilding && (\n <div className=\"absolute top-full left-0 right-0 mt-1 bg-background border border-border rounded-md shadow-lg max-h-60 overflow-y-auto z-20\">\n {searchResults.map((building, index) => (\n <button\n key={building.id}\n type=\"button\"\n ref={optionKeys.optionRef(index)}\n className=\"w-full px-3 py-2 text-sm text-left cursor-pointer hover:bg-muted focus:bg-muted focus:outline-none transition-colors flex gap-2 items-center\"\n onKeyDown={optionKeys.onOptionKeyDown(index)}\n onClick={() => handleBuildingSelect(building)}\n >\n <SquareArrowOutUpRight className=\"w-3 h-3 shrink-0\" />\n {building.buildingName\n ? `${building.buildingName}, ${building.buildingAddress}`\n : building.buildingAddress || `Building ${building.id}`}\n </button>\n ))}\n </div>\n )}\n </div>\n ) : (\n <div className=\"text-muted-foreground text-center\">\n {t('noBuildings') || 'No buildings available'}\n </div>\n )}\n </div>\n )}\n\n {currentState === 'noBimFiles' && (\n <div className=\"self-stretch flex justify-center items-center gap-3\">\n <Input\n ref={fileInputRef}\n type=\"file\"\n accept={acceptAttribute(ADDABLE_HERE)}\n onChange={(event) => void handleFileChange(event)}\n className=\"hidden\"\n />\n <Button\n onClick={handleUploadClick}\n size=\"sm\"\n className=\"gap-2\"\n disabled={!ability.can('create', 'File')}\n >\n <Upload className=\"w-4 h-4\" />\n {t('uploadButton')}\n </Button>\n </div>\n )}\n </CardContent>\n </Card>\n </div>\n </>\n )\n}\n"],"mappings":";AA0WgB,SAaE,UAbF,KAaE,YAbF;AArWhB,SAAS,QAAQ,KAAK,WAAW,QAAQ,GAAG,uBAAuB,qBAAqB;AACxF,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AACh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AAAA,aAEJ,IAEA,oBAAC,SAAI,WAAU,qCACZ,YAAE,aAAa,KAAK,0BACvB,GAEJ;AAAA,UAGD,iBAAiB,gBAChB,qBAAC,SAAI,WAAU,uDACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK;AAAA,gBACL,MAAK;AAAA,gBACL,QAAQ,gBAAgB,YAAY;AAAA,gBACpC,UAAU,CAAC,UAAU,KAAK,iBAAiB,KAAK;AAAA,gBAChD,WAAU;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAS;AAAA,gBACT,MAAK;AAAA,gBACL,WAAU;AAAA,gBACV,UAAU,CAAC,QAAQ,IAAI,UAAU,MAAM;AAAA,gBAEvC;AAAA,sCAAC,UAAO,WAAU,WAAU;AAAA,kBAC3B,EAAE,cAAc;AAAA;AAAA;AAAA,YACnB;AAAA,aACF;AAAA,WAEJ;AAAA,SACF;AAAA;AAAA,EACF,GACF;AAEJ;","names":["_a","_b","building"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaceableFileRows.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/usePlaceableFileRows.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"usePlaceableFileRows.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/usePlaceableFileRows.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAmB9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,KAAK,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B,CAAC,EACnC,KAAK,EACL,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,oBAAoB,GAAG,aAAa,CAyTtC"}
|
package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/usePlaceableFileRows.js
CHANGED
|
@@ -26,6 +26,7 @@ import * as THREE from "three";
|
|
|
26
26
|
import { useFile } from "../../../../../../../../hooks/files/files";
|
|
27
27
|
import { BimContext } from "../../../../../../../../store";
|
|
28
28
|
import { EXTENSIONS_FOR_TYPE } from "../../../../../../../ui/FilesManager/src/fileType";
|
|
29
|
+
import { hasFileTransform } from "../../../../../../shared/placement/fileTransform";
|
|
29
30
|
import { CurrentWorld } from "../../../../CurrentWorld";
|
|
30
31
|
import { Cursor } from "../../../../Cursor";
|
|
31
32
|
import { DXFManager } from "../../../../DXFLoader";
|
|
@@ -48,7 +49,7 @@ const sameRow = (a, b) => {
|
|
|
48
49
|
};
|
|
49
50
|
const PLACE_TOAST_ID = "bim-file-place-toast";
|
|
50
51
|
const DXF_UNPLACED_SCALE = 1e-3;
|
|
51
|
-
const placedPosition = (file) => file
|
|
52
|
+
const placedPosition = (file) => hasFileTransform(file) ? new THREE.Vector3(file.fileTransformX, file.fileTransformY, file.fileTransformZ) : new THREE.Vector3();
|
|
52
53
|
function usePlaceableFileRows({
|
|
53
54
|
files,
|
|
54
55
|
buildingId,
|
|
@@ -138,8 +139,8 @@ function usePlaceableFileRows({
|
|
|
138
139
|
const { presignedUrl } = await res.json();
|
|
139
140
|
const info = await modelManager.load(presignedUrl, key, file.name, {
|
|
140
141
|
position: position != null ? position : placedPosition(file),
|
|
141
|
-
rotation: file.
|
|
142
|
-
scale: (_a = file.
|
|
142
|
+
rotation: file.fileRotationY != null ? new THREE.Euler(0, file.fileRotationY, 0) : void 0,
|
|
143
|
+
scale: (_a = file.fileScale) != null ? _a : void 0,
|
|
143
144
|
extension: (_b = file.extension) != null ? _b : void 0
|
|
144
145
|
});
|
|
145
146
|
if (info) {
|
|
@@ -168,10 +169,9 @@ function usePlaceableFileRows({
|
|
|
168
169
|
if (!res.ok) throw new Error(`Failed to get download URL: ${res.status}`);
|
|
169
170
|
const { presignedUrl } = await res.json();
|
|
170
171
|
const group = await dxfManager.parse(presignedUrl);
|
|
171
|
-
|
|
172
|
-
group.
|
|
173
|
-
|
|
174
|
-
if (file.bimRotation != null) group.rotation.y = file.bimRotation;
|
|
172
|
+
group.position.copy(placedPosition(file));
|
|
173
|
+
group.scale.setScalar((_a = file.fileScale) != null ? _a : DXF_UNPLACED_SCALE);
|
|
174
|
+
if (file.fileRotationY != null) group.rotation.y = file.fileRotationY;
|
|
175
175
|
registry.add({ key, fileId: key, kind: "dxf", root: group });
|
|
176
176
|
} catch (err) {
|
|
177
177
|
console.error(`[FilesSection] Failed to load DXF "${file.name}":`, err);
|
|
@@ -247,17 +247,16 @@ function usePlaceableFileRows({
|
|
|
247
247
|
const mouse = new THREE.Vector2();
|
|
248
248
|
const placeAt = (point) => {
|
|
249
249
|
const { x, y, z } = point;
|
|
250
|
+
const placed = { fileTransformX: x, fileTransformY: y, fileTransformZ: z };
|
|
250
251
|
setMoveFileId(placingFile.id);
|
|
251
252
|
setTimeout(() => {
|
|
252
|
-
updateFileRef.current(
|
|
253
|
+
updateFileRef.current(placed).catch((err) => console.error(`Failed to save placement for "${placingFile.name}":`, err));
|
|
253
254
|
}, 50);
|
|
254
255
|
if (is3DFile(placingFile.extension)) {
|
|
255
256
|
void toggleModelVisibility(placingFile, true, new THREE.Vector3(x, y, z));
|
|
256
257
|
}
|
|
257
|
-
placingFile
|
|
258
|
-
placingFile.
|
|
259
|
-
placingFile.z = z;
|
|
260
|
-
setRows((prev) => prev.map((f) => f.id === placingFile.id ? __spreadProps(__spreadValues({}, f), { x, y, z, isVisible: true }) : f));
|
|
258
|
+
Object.assign(placingFile, placed);
|
|
259
|
+
setRows((prev) => prev.map((f) => f.id === placingFile.id ? __spreadProps(__spreadValues(__spreadValues({}, f), placed), { isVisible: true }) : f));
|
|
261
260
|
setPlacingFile(null);
|
|
262
261
|
if (cursor) cursor.cursor = "";
|
|
263
262
|
};
|
|
@@ -311,7 +310,7 @@ function usePlaceableFileRows({
|
|
|
311
310
|
}, [bimComponents, getSceneObject]);
|
|
312
311
|
const handleMove = React.useCallback((file) => {
|
|
313
312
|
var _a;
|
|
314
|
-
const isPlaced = file
|
|
313
|
+
const isPlaced = hasFileTransform(file);
|
|
315
314
|
if (!isPlaced) {
|
|
316
315
|
setPlacingFile(file);
|
|
317
316
|
setMoveFileId(file.id);
|