@collabdt/core 0.4.1 → 0.4.4

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.
Files changed (138) hide show
  1. package/dist/core/components/ConfirmDialog.d.ts +2 -1
  2. package/dist/core/components/ConfirmDialog.d.ts.map +1 -1
  3. package/dist/core/components/ConfirmDialog.js +8 -0
  4. package/dist/core/components/ConfirmDialog.js.map +1 -1
  5. package/dist/core/components/authentication/AuthPage.d.ts.map +1 -1
  6. package/dist/core/components/authentication/AuthPage.js +1 -2
  7. package/dist/core/components/authentication/AuthPage.js.map +1 -1
  8. package/dist/core/components/authentication/auth.css +4 -1
  9. package/dist/core/components/organizationConfig/src/CountrySubdivisionFields.d.ts +2 -0
  10. package/dist/core/components/organizationConfig/src/CountrySubdivisionFields.d.ts.map +1 -0
  11. package/dist/core/components/organizationConfig/src/CountrySubdivisionFields.js +180 -0
  12. package/dist/core/components/organizationConfig/src/CountrySubdivisionFields.js.map +1 -0
  13. package/dist/core/components/organizationConfig/src/organizationConfigContent.d.ts.map +1 -1
  14. package/dist/core/components/organizationConfig/src/organizationConfigContent.js +13 -0
  15. package/dist/core/components/organizationConfig/src/organizationConfigContent.js.map +1 -1
  16. package/dist/core/components/settings/index.js +1 -1
  17. package/dist/core/components/settings/index.js.map +1 -1
  18. package/dist/core/components/settings/src/AccountSettingsPanel.d.ts.map +1 -1
  19. package/dist/core/components/settings/src/AccountSettingsPanel.js +6 -7
  20. package/dist/core/components/settings/src/AccountSettingsPanel.js.map +1 -1
  21. package/dist/core/components/ui/AnimatedBackground.d.ts +2 -2
  22. package/dist/core/components/ui/AnimatedBackground.d.ts.map +1 -1
  23. package/dist/core/components/ui/AnimatedBackground.js +7 -8
  24. package/dist/core/components/ui/AnimatedBackground.js.map +1 -1
  25. package/dist/core/components/ui/AppSidebar.js +1 -1
  26. package/dist/core/components/ui/AppSidebar.js.map +1 -1
  27. package/dist/core/components/ui/FilesManager/src/FileItemComponent.d.ts.map +1 -1
  28. package/dist/core/components/ui/FilesManager/src/FileItemComponent.js +1 -1
  29. package/dist/core/components/ui/FilesManager/src/FileItemComponent.js.map +1 -1
  30. package/dist/core/components/ui/InfoSidebar/Header.d.ts.map +1 -1
  31. package/dist/core/components/ui/InfoSidebar/Header.js +12 -5
  32. package/dist/core/components/ui/InfoSidebar/Header.js.map +1 -1
  33. package/dist/core/components/ui/LegendCard.d.ts.map +1 -1
  34. package/dist/core/components/ui/LegendCard.js +1 -1
  35. package/dist/core/components/ui/LegendCard.js.map +1 -1
  36. package/dist/core/components/ui/Progress.js +2 -2
  37. package/dist/core/components/ui/Progress.js.map +1 -1
  38. package/dist/core/components/ui/Sensors/SensorsSection.d.ts.map +1 -1
  39. package/dist/core/components/ui/Sensors/SensorsSection.js +2 -2
  40. package/dist/core/components/ui/Sensors/SensorsSection.js.map +1 -1
  41. package/dist/core/components/ui/Sidebar.d.ts.map +1 -1
  42. package/dist/core/components/ui/Sidebar.js +9 -3
  43. package/dist/core/components/ui/Sidebar.js.map +1 -1
  44. package/dist/core/components/viewers/bim/BimViewer.d.ts.map +1 -1
  45. package/dist/core/components/viewers/bim/BimViewer.js +10 -6
  46. package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
  47. package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.d.ts +161 -0
  48. package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.d.ts.map +1 -0
  49. package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js +382 -0
  50. package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js.map +1 -0
  51. package/dist/core/components/viewers/bim/src/BimMeasurements/measurementSettings.d.ts +80 -0
  52. package/dist/core/components/viewers/bim/src/BimMeasurements/measurementSettings.d.ts.map +1 -0
  53. package/dist/core/components/viewers/bim/src/BimMeasurements/measurementSettings.js +48 -0
  54. package/dist/core/components/viewers/bim/src/BimMeasurements/measurementSettings.js.map +1 -0
  55. package/dist/core/components/viewers/bim/src/BimSidebar/src/SettingsTab/index.d.ts.map +1 -1
  56. package/dist/core/components/viewers/bim/src/BimSidebar/src/SettingsTab/index.js +3 -1
  57. package/dist/core/components/viewers/bim/src/BimSidebar/src/SettingsTab/index.js.map +1 -1
  58. package/dist/core/components/viewers/bim/src/BimSidebar/src/SettingsTab/src/MeasurementSettings.d.ts +11 -0
  59. package/dist/core/components/viewers/bim/src/BimSidebar/src/SettingsTab/src/MeasurementSettings.d.ts.map +1 -0
  60. package/dist/core/components/viewers/bim/src/BimSidebar/src/SettingsTab/src/MeasurementSettings.js +186 -0
  61. package/dist/core/components/viewers/bim/src/BimSidebar/src/SettingsTab/src/MeasurementSettings.js.map +1 -0
  62. package/dist/core/components/viewers/bim/src/Highlighter/index.d.ts +10 -0
  63. package/dist/core/components/viewers/bim/src/Highlighter/index.d.ts.map +1 -1
  64. package/dist/core/components/viewers/bim/src/Highlighter/index.js +28 -6
  65. package/dist/core/components/viewers/bim/src/Highlighter/index.js.map +1 -1
  66. package/dist/core/components/viewers/bim/src/LoadModels.d.ts.map +1 -1
  67. package/dist/core/components/viewers/bim/src/LoadModels.js +5 -2
  68. package/dist/core/components/viewers/bim/src/LoadModels.js.map +1 -1
  69. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/renderCSS2DMarkers.d.ts +5 -0
  70. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/renderCSS2DMarkers.d.ts.map +1 -1
  71. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/renderCSS2DMarkers.js +26 -14
  72. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/renderCSS2DMarkers.js.map +1 -1
  73. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.d.ts.map +1 -1
  74. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.js +4 -2
  75. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.js.map +1 -1
  76. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useSensorMarkers.d.ts.map +1 -1
  77. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useSensorMarkers.js +4 -1
  78. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useSensorMarkers.js.map +1 -1
  79. package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.d.ts.map +1 -1
  80. package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.js +15 -10
  81. package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.js.map +1 -1
  82. package/dist/core/components/viewers/bim/src/tools/measureBimTool.d.ts.map +1 -1
  83. package/dist/core/components/viewers/bim/src/tools/measureBimTool.js +52 -60
  84. package/dist/core/components/viewers/bim/src/tools/measureBimTool.js.map +1 -1
  85. package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
  86. package/dist/core/components/viewers/map/MapViewer.js +1 -1
  87. package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
  88. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.d.ts.map +1 -1
  89. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.js +5 -5
  90. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.js.map +1 -1
  91. package/dist/core/components/viewers/map/src/MapLayers/src/BimLayer/index.d.ts.map +1 -1
  92. package/dist/core/components/viewers/map/src/MapLayers/src/BimLayer/index.js +9 -6
  93. package/dist/core/components/viewers/map/src/MapLayers/src/BimLayer/index.js.map +1 -1
  94. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/src/BuildingSensorMarkers.d.ts.map +1 -1
  95. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/src/BuildingSensorMarkers.js +24 -3
  96. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/src/BuildingSensorMarkers.js.map +1 -1
  97. package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.js +3 -3
  98. package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.js.map +1 -1
  99. package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/index.d.ts.map +1 -1
  100. package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/index.js +22 -2
  101. package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/index.js.map +1 -1
  102. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js +3 -3
  103. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js.map +1 -1
  104. package/dist/core/components/viewers/map/src/SimpleMap.d.ts +1 -1
  105. package/dist/core/components/viewers/map/src/SimpleMap.d.ts.map +1 -1
  106. package/dist/core/components/viewers/map/src/SimpleMap.js +4 -10
  107. package/dist/core/components/viewers/map/src/SimpleMap.js.map +1 -1
  108. package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.d.ts.map +1 -1
  109. package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.js +4 -0
  110. package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.js.map +1 -1
  111. package/dist/core/components/viewers/pointcloud/PointCloudViewer.d.ts.map +1 -1
  112. package/dist/core/components/viewers/pointcloud/PointCloudViewer.js +19 -3
  113. package/dist/core/components/viewers/pointcloud/PointCloudViewer.js.map +1 -1
  114. package/dist/core/components/viewers/pointcloud/src/PointCloudLoadingState/index.d.ts.map +1 -1
  115. package/dist/core/components/viewers/pointcloud/src/PointCloudLoadingState/index.js +16 -3
  116. package/dist/core/components/viewers/pointcloud/src/PointCloudLoadingState/index.js.map +1 -1
  117. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/PointCloudSection.d.ts.map +1 -1
  118. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/PointCloudSection.js +105 -26
  119. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/PointCloudSection.js.map +1 -1
  120. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/SettingsTab/src/PerformanceSettings.js +6 -6
  121. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/SettingsTab/src/PerformanceSettings.js.map +1 -1
  122. package/dist/core/hooks/ui/useResizableSidebarWidth.d.ts +3 -3
  123. package/dist/core/hooks/ui/useResizableSidebarWidth.d.ts.map +1 -1
  124. package/dist/core/hooks/ui/useResizableSidebarWidth.js.map +1 -1
  125. package/dist/core/i18n/messages/en.json +18 -1
  126. package/dist/core/i18n/messages/es.json +18 -1
  127. package/dist/core/i18n/messages/fr.json +18 -1
  128. package/dist/core/store/PointCloud/reducer.js +1 -1
  129. package/dist/core/store/PointCloud/reducer.js.map +1 -1
  130. package/dist/core/utils/markerUtils.d.ts +11 -0
  131. package/dist/core/utils/markerUtils.d.ts.map +1 -1
  132. package/dist/core/utils/markerUtils.js +2 -0
  133. package/dist/core/utils/markerUtils.js.map +1 -1
  134. package/package.json +1 -1
  135. package/dist/core/components/viewers/bim/src/BimMeasurements/LenghtMeasurement.d.ts +0 -21
  136. package/dist/core/components/viewers/bim/src/BimMeasurements/LenghtMeasurement.d.ts.map +0 -1
  137. package/dist/core/components/viewers/bim/src/BimMeasurements/LenghtMeasurement.js +0 -92
  138. package/dist/core/components/viewers/bim/src/BimMeasurements/LenghtMeasurement.js.map +0 -1
@@ -12,11 +12,11 @@ export declare function readStoredSidebarWidth(): number;
12
12
  /** SSR-safe persist of a clamped width. Swallows storage errors (private mode, quota). */
13
13
  export declare function writeStoredSidebarWidth(width: number): void;
14
14
  export interface ResizableSidebarWidth {
15
- /** Current width in px. Only meaningful when `canResize` is true; mobile stays full-width via CSS. */
15
+ /** Current width in px. Only meaningful when `canResize` is true; mobile uses the fixed drawer width. */
16
16
  width: number;
17
17
  /** True while a drag is in progress (for cursor / no-select styling). */
18
18
  isResizing: boolean;
19
- /** True on desktop only. Mobile is full-width and not resizable. */
19
+ /** True on desktop only. Mobile uses a fixed drawer width and is not resizable. */
20
20
  canResize: boolean;
21
21
  /** Attach to the drag handle's onPointerDown. */
22
22
  startResize: (e: React.PointerEvent) => void;
@@ -24,7 +24,7 @@ export interface ResizableSidebarWidth {
24
24
  /**
25
25
  * Drives a user-resizable sidebar width on desktop. Width is restored from and persisted to
26
26
  * localStorage, clamped to [MIN_SIDEBAR_WIDTH, MAX_SIDEBAR_WIDTH]. On mobile (`useIsMobile`)
27
- * resizing is disabled and the sidebar is expected to render full-width via CSS.
27
+ * resizing is disabled and the sidebar renders at the fixed mobile drawer width.
28
28
  */
29
29
  export declare function useResizableSidebarWidth(): ResizableSidebarWidth;
30
30
  //# sourceMappingURL=useResizableSidebarWidth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResizableSidebarWidth.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/ui/useResizableSidebarWidth.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,2GAA2G;AAC3G,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,eAAO,MAAM,qBAAqB,MAAoB,CAAA;AACtD,eAAO,MAAM,yBAAyB,sBAAsB,CAAA;AAE5D,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED,0GAA0G;AAC1G,wBAAgB,sBAAsB,IAAI,MAAM,CAW/C;AAED,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAO3D;AAED,MAAM,WAAW,qBAAqB;IACpC,sGAAsG;IACtG,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAA;IACnB,oEAAoE;IACpE,SAAS,EAAE,OAAO,CAAA;IAClB,iDAAiD;IACjD,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAA;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CA0ChE"}
1
+ {"version":3,"file":"useResizableSidebarWidth.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/ui/useResizableSidebarWidth.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,2GAA2G;AAC3G,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,eAAO,MAAM,qBAAqB,MAAoB,CAAA;AACtD,eAAO,MAAM,yBAAyB,sBAAsB,CAAA;AAE5D,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED,0GAA0G;AAC1G,wBAAgB,sBAAsB,IAAI,MAAM,CAW/C;AAED,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAO3D;AAED,MAAM,WAAW,qBAAqB;IACpC,yGAAyG;IACzG,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAA;IACnB,mFAAmF;IACnF,SAAS,EAAE,OAAO,CAAA;IAClB,iDAAiD;IACjD,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAA;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CA0ChE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/hooks/ui/useResizableSidebarWidth.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { useIsMobile } from './use-mobile'\r\n\r\n/** Minimum sidebar width. Equal to the previous fixed width, so it never shrinks below the old default. */\r\nexport const MIN_SIDEBAR_WIDTH = 410\r\n/** Maximum sidebar width, roughly half a laptop viewport. */\r\nexport const MAX_SIDEBAR_WIDTH = 720\r\nexport const DEFAULT_SIDEBAR_WIDTH = MIN_SIDEBAR_WIDTH\r\nexport const SIDEBAR_WIDTH_STORAGE_KEY = 'cdt:sidebar-width'\r\n\r\n/** Clamp to [MIN, MAX]. NaN falls back to the default; ±Infinity clamps to the bounds. */\r\nexport function clampSidebarWidth(width: number): number {\r\n if (Number.isNaN(width)) return DEFAULT_SIDEBAR_WIDTH\r\n return Math.min(MAX_SIDEBAR_WIDTH, Math.max(MIN_SIDEBAR_WIDTH, width))\r\n}\r\n\r\n/** SSR-safe read of the persisted width, clamped; falls back to the default on missing/corrupt values. */\r\nexport function readStoredSidebarWidth(): number {\r\n if (typeof window === 'undefined') return DEFAULT_SIDEBAR_WIDTH\r\n try {\r\n const raw = window.localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY)\r\n if (raw === null) return DEFAULT_SIDEBAR_WIDTH\r\n const parsed = Number.parseFloat(raw)\r\n if (!Number.isFinite(parsed)) return DEFAULT_SIDEBAR_WIDTH\r\n return clampSidebarWidth(parsed)\r\n } catch {\r\n return DEFAULT_SIDEBAR_WIDTH\r\n }\r\n}\r\n\r\n/** SSR-safe persist of a clamped width. Swallows storage errors (private mode, quota). */\r\nexport function writeStoredSidebarWidth(width: number): void {\r\n if (typeof window === 'undefined') return\r\n try {\r\n window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(clampSidebarWidth(width)))\r\n } catch {\r\n // ignore: storage may be unavailable (private mode / quota)\r\n }\r\n}\r\n\r\nexport interface ResizableSidebarWidth {\r\n /** Current width in px. Only meaningful when `canResize` is true; mobile stays full-width via CSS. */\r\n width: number\r\n /** True while a drag is in progress (for cursor / no-select styling). */\r\n isResizing: boolean\r\n /** True on desktop only. Mobile is full-width and not resizable. */\r\n canResize: boolean\r\n /** Attach to the drag handle's onPointerDown. */\r\n startResize: (e: React.PointerEvent) => void\r\n}\r\n\r\n/**\r\n * Drives a user-resizable sidebar width on desktop. Width is restored from and persisted to\r\n * localStorage, clamped to [MIN_SIDEBAR_WIDTH, MAX_SIDEBAR_WIDTH]. On mobile (`useIsMobile`)\r\n * resizing is disabled and the sidebar is expected to render full-width via CSS.\r\n */\r\nexport function useResizableSidebarWidth(): ResizableSidebarWidth {\r\n const isMobile = useIsMobile()\r\n const canResize = !isMobile\r\n\r\n const [width, setWidth] = React.useState<number>(DEFAULT_SIDEBAR_WIDTH)\r\n const [isResizing, setIsResizing] = React.useState(false)\r\n\r\n // Hydrate from storage after mount (avoids SSR/client mismatch on first paint).\r\n React.useEffect(() => {\r\n setWidth(readStoredSidebarWidth())\r\n }, [])\r\n\r\n const startResize = React.useCallback(\r\n (e: React.PointerEvent) => {\r\n if (!canResize) return\r\n e.preventDefault()\r\n setIsResizing(true)\r\n\r\n const startX = e.clientX\r\n const startWidth = width\r\n\r\n const onMove = (ev: PointerEvent) => {\r\n setWidth(clampSidebarWidth(startWidth + (ev.clientX - startX)))\r\n }\r\n const onUp = () => {\r\n setIsResizing(false)\r\n window.removeEventListener('pointermove', onMove)\r\n window.removeEventListener('pointerup', onUp)\r\n // Persist the final width; read the latest via the functional updater.\r\n setWidth(current => {\r\n writeStoredSidebarWidth(current)\r\n return current\r\n })\r\n }\r\n\r\n window.addEventListener('pointermove', onMove)\r\n window.addEventListener('pointerup', onUp)\r\n },\r\n [canResize, width]\r\n )\r\n\r\n return { width, isResizing, canResize, startResize }\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAGrB,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAC1B,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAGlC,SAAS,kBAAkB,OAAuB;AACvD,MAAI,OAAO,MAAM,KAAK,EAAG,QAAO;AAChC,SAAO,KAAK,IAAI,mBAAmB,KAAK,IAAI,mBAAmB,KAAK,CAAC;AACvE;AAGO,SAAS,yBAAiC;AAC/C,MAA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A,IACA,CAAC,WAAW,KAAK;AAAA,EACnB;AAEA,SAAO,EAAE,OAAO,YAAY,WAAW,YAAY;AACrD;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/hooks/ui/useResizableSidebarWidth.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { useIsMobile } from './use-mobile'\r\n\r\n/** Minimum sidebar width. Equal to the previous fixed width, so it never shrinks below the old default. */\r\nexport const MIN_SIDEBAR_WIDTH = 410\r\n/** Maximum sidebar width, roughly half a laptop viewport. */\r\nexport const MAX_SIDEBAR_WIDTH = 720\r\nexport const DEFAULT_SIDEBAR_WIDTH = MIN_SIDEBAR_WIDTH\r\nexport const SIDEBAR_WIDTH_STORAGE_KEY = 'cdt:sidebar-width'\r\n\r\n/** Clamp to [MIN, MAX]. NaN falls back to the default; ±Infinity clamps to the bounds. */\r\nexport function clampSidebarWidth(width: number): number {\r\n if (Number.isNaN(width)) return DEFAULT_SIDEBAR_WIDTH\r\n return Math.min(MAX_SIDEBAR_WIDTH, Math.max(MIN_SIDEBAR_WIDTH, width))\r\n}\r\n\r\n/** SSR-safe read of the persisted width, clamped; falls back to the default on missing/corrupt values. */\r\nexport function readStoredSidebarWidth(): number {\r\n if (typeof window === 'undefined') return DEFAULT_SIDEBAR_WIDTH\r\n try {\r\n const raw = window.localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY)\r\n if (raw === null) return DEFAULT_SIDEBAR_WIDTH\r\n const parsed = Number.parseFloat(raw)\r\n if (!Number.isFinite(parsed)) return DEFAULT_SIDEBAR_WIDTH\r\n return clampSidebarWidth(parsed)\r\n } catch {\r\n return DEFAULT_SIDEBAR_WIDTH\r\n }\r\n}\r\n\r\n/** SSR-safe persist of a clamped width. Swallows storage errors (private mode, quota). */\r\nexport function writeStoredSidebarWidth(width: number): void {\r\n if (typeof window === 'undefined') return\r\n try {\r\n window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(clampSidebarWidth(width)))\r\n } catch {\r\n // ignore: storage may be unavailable (private mode / quota)\r\n }\r\n}\r\n\r\nexport interface ResizableSidebarWidth {\r\n /** Current width in px. Only meaningful when `canResize` is true; mobile uses the fixed drawer width. */\r\n width: number\r\n /** True while a drag is in progress (for cursor / no-select styling). */\r\n isResizing: boolean\r\n /** True on desktop only. Mobile uses a fixed drawer width and is not resizable. */\r\n canResize: boolean\r\n /** Attach to the drag handle's onPointerDown. */\r\n startResize: (e: React.PointerEvent) => void\r\n}\r\n\r\n/**\r\n * Drives a user-resizable sidebar width on desktop. Width is restored from and persisted to\r\n * localStorage, clamped to [MIN_SIDEBAR_WIDTH, MAX_SIDEBAR_WIDTH]. On mobile (`useIsMobile`)\r\n * resizing is disabled and the sidebar renders at the fixed mobile drawer width.\r\n */\r\nexport function useResizableSidebarWidth(): ResizableSidebarWidth {\r\n const isMobile = useIsMobile()\r\n const canResize = !isMobile\r\n\r\n const [width, setWidth] = React.useState<number>(DEFAULT_SIDEBAR_WIDTH)\r\n const [isResizing, setIsResizing] = React.useState(false)\r\n\r\n // Hydrate from storage after mount (avoids SSR/client mismatch on first paint).\r\n React.useEffect(() => {\r\n setWidth(readStoredSidebarWidth())\r\n }, [])\r\n\r\n const startResize = React.useCallback(\r\n (e: React.PointerEvent) => {\r\n if (!canResize) return\r\n e.preventDefault()\r\n setIsResizing(true)\r\n\r\n const startX = e.clientX\r\n const startWidth = width\r\n\r\n const onMove = (ev: PointerEvent) => {\r\n setWidth(clampSidebarWidth(startWidth + (ev.clientX - startX)))\r\n }\r\n const onUp = () => {\r\n setIsResizing(false)\r\n window.removeEventListener('pointermove', onMove)\r\n window.removeEventListener('pointerup', onUp)\r\n // Persist the final width; read the latest via the functional updater.\r\n setWidth(current => {\r\n writeStoredSidebarWidth(current)\r\n return current\r\n })\r\n }\r\n\r\n window.addEventListener('pointermove', onMove)\r\n window.addEventListener('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ACjB,YAAM,aAAa;AAEnB,YAAM,SAAS,CAAC,OAAqB;AACnC,iBAAS,kBAAkB,cAAc,GAAG,UAAU,OAAO,CAAC;AAAA,MAChE;AACA,YAAM,OAAO,MAAM;AACjB,sBAAc,KAAK;AACnB,eAAO,oBAAoB,eAAe,MAAM;AAChD,eAAO,oBAAoB,aAAa,IAAI;AAE5C,iBAAS,aAAW;AAClB,kCAAwB,OAAO;AAC/B,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AAEA,aAAO,iBAAiB,eAAe,MAAM;AAC7C,aAAO,iBAAiB,aAAa,IAAI;AAAA,IAC3C;AAAA,IACA,CAAC,WAAW,KAAK;AAAA,EACnB;AAEA,SAAO,EAAE,OAAO,YAAY,WAAW,YAAY;AACrD;","names":[]}
@@ -759,7 +759,12 @@
759
759
  "edge": "Edge",
760
760
  "area": "Area",
761
761
  "volume": "Volume",
762
- "clear": "Clear"
762
+ "angle": "Angle",
763
+ "clear": "Clear",
764
+ "hintLength": "Double-click two points to measure a distance. Delete removes the measurement under the cursor. Escape exits.",
765
+ "hintArea": "Double-click each corner, then press Enter to close the shape. Delete removes the measurement under the cursor. Escape exits.",
766
+ "hintVolume": "Double-click each element to add it, then press Enter to total the volume. Delete removes the measurement under the cursor. Escape exits.",
767
+ "hintAngle": "Double-click three points: start, corner, then end. Delete removes the measurement under the cursor. Escape exits."
763
768
  },
764
769
  "MeasureMapTool": {
765
770
  "distance": "Distance",
@@ -772,6 +777,17 @@
772
777
  "point": "Point",
773
778
  "clear": "Clear"
774
779
  },
780
+ "MeasurementSettings": {
781
+ "title": "Measurements",
782
+ "lineColour": "Measurement colour",
783
+ "lengthUnits": "Length units",
784
+ "areaUnits": "Area units",
785
+ "volumeUnits": "Volume units",
786
+ "angleUnits": "Angle units",
787
+ "precision": "Decimal places",
788
+ "snapRange": "Snap range",
789
+ "markerSize": "Snap marker size"
790
+ },
775
791
  "MoreOptions": {
776
792
  "viewMap": "View on Map",
777
793
  "showInMap": "Show boundary on map",
@@ -1003,6 +1019,7 @@
1003
1019
  "readyToView": "Ready",
1004
1020
  "infoTitle": "More information",
1005
1021
  "convertTitle": "Convert to Potree",
1022
+ "retryUploadTitle": "Upload never completed - click to retry",
1006
1023
  "viewTitle": "View in Potree viewer",
1007
1024
  "deleteTitle": "Delete point cloud",
1008
1025
  "uploadedBy": "Uploaded by",
@@ -759,7 +759,12 @@
759
759
  "edge": "Borde",
760
760
  "area": "Área",
761
761
  "volume": "Volumen",
762
- "clear": "Limpiar"
762
+ "angle": "Ángulo",
763
+ "clear": "Limpiar",
764
+ "hintLength": "Haz doble clic en dos puntos para medir una distancia. Suprimir elimina la medición bajo el cursor. Escape sale.",
765
+ "hintArea": "Haz doble clic en cada esquina y luego pulsa Enter para cerrar la forma. Suprimir elimina la medición bajo el cursor. Escape sale.",
766
+ "hintVolume": "Haz doble clic en cada elemento para añadirlo y luego pulsa Enter para sumar el volumen. Suprimir elimina la medición bajo el cursor. Escape sale.",
767
+ "hintAngle": "Haz doble clic en tres puntos: inicio, vértice y final. Suprimir elimina la medición bajo el cursor. Escape sale."
763
768
  },
764
769
  "MeasureMapTool": {
765
770
  "distance": "Distancia",
@@ -772,6 +777,17 @@
772
777
  "point": "Punto",
773
778
  "clear": "Limpiar"
774
779
  },
780
+ "MeasurementSettings": {
781
+ "title": "Mediciones",
782
+ "lineColour": "Color de las mediciones",
783
+ "lengthUnits": "Unidades de longitud",
784
+ "areaUnits": "Unidades de área",
785
+ "volumeUnits": "Unidades de volumen",
786
+ "angleUnits": "Unidades de ángulo",
787
+ "precision": "Decimales",
788
+ "snapRange": "Alcance del ajuste",
789
+ "markerSize": "Tamaño del marcador de ajuste"
790
+ },
775
791
  "MoreOptions": {
776
792
  "viewMap": "Ver en el mapa",
777
793
  "showInMap": "Mostrar límite en el mapa",
@@ -1003,6 +1019,7 @@
1003
1019
  "readyToView": "Lista",
1004
1020
  "infoTitle": "Más información",
1005
1021
  "convertTitle": "Convertir a Potree",
1022
+ "retryUploadTitle": "La subida nunca se completó - haga clic para reintentar",
1006
1023
  "viewTitle": "Ver en el visor Potree",
1007
1024
  "deleteTitle": "Eliminar nube de puntos",
1008
1025
  "uploadedBy": "Subida por",
@@ -759,7 +759,12 @@
759
759
  "edge": "Bord",
760
760
  "area": "Surface",
761
761
  "volume": "Volume",
762
- "clear": "Effacer"
762
+ "angle": "Angle",
763
+ "clear": "Effacer",
764
+ "hintLength": "Double-cliquez sur deux points pour mesurer une distance. Suppr efface la mesure sous le curseur. Échap quitte.",
765
+ "hintArea": "Double-cliquez sur chaque coin, puis appuyez sur Entrée pour fermer la forme. Suppr efface la mesure sous le curseur. Échap quitte.",
766
+ "hintVolume": "Double-cliquez sur chaque élément pour l'ajouter, puis appuyez sur Entrée pour totaliser le volume. Suppr efface la mesure sous le curseur. Échap quitte.",
767
+ "hintAngle": "Double-cliquez sur trois points : début, sommet, puis fin. Suppr efface la mesure sous le curseur. Échap quitte."
763
768
  },
764
769
  "MeasureMapTool": {
765
770
  "distance": "Distance",
@@ -772,6 +777,17 @@
772
777
  "point": "Point",
773
778
  "clear": "Effacer"
774
779
  },
780
+ "MeasurementSettings": {
781
+ "title": "Mesures",
782
+ "lineColour": "Couleur des mesures",
783
+ "lengthUnits": "Unités de longueur",
784
+ "areaUnits": "Unités de surface",
785
+ "volumeUnits": "Unités de volume",
786
+ "angleUnits": "Unités d'angle",
787
+ "precision": "Décimales",
788
+ "snapRange": "Portée d'accrochage",
789
+ "markerSize": "Taille du marqueur d'accrochage"
790
+ },
775
791
  "MoreOptions": {
776
792
  "viewMap": "Voir sur la carte",
777
793
  "showInMap": "Afficher le contour sur la carte",
@@ -1003,6 +1019,7 @@
1003
1019
  "readyToView": "Prêt",
1004
1020
  "infoTitle": "Plus d'informations",
1005
1021
  "convertTitle": "Convertir en Potree",
1022
+ "retryUploadTitle": "Le téléchargement n'a jamais abouti - cliquez pour réessayer",
1006
1023
  "viewTitle": "Voir dans le visualiseur Potree",
1007
1024
  "deleteTitle": "Supprimer le nuage de points",
1008
1025
  "uploadedBy": "Téléchargé par",
@@ -47,7 +47,7 @@ const initialPointCloudState = {
47
47
  const PointCloudReducer = (state, action) => {
48
48
  switch (action.type) {
49
49
  case "INIT":
50
- return __spreadValues(__spreadValues({}, initialPointCloudState), action.payload.initialState);
50
+ return __spreadValues(__spreadValues({}, state), action.payload.initialState);
51
51
  case "SET_READY":
52
52
  return __spreadProps(__spreadValues({}, state), { ready: action.payload.ready });
53
53
  case "SET_ACTIVE_TOOL":
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/store/PointCloud/reducer.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { CameraMode } from \"../../components/viewers/pointcloud/define\";\r\n\r\nimport type { ActionMap } from \"../ActionMap\";\r\n\r\nexport enum PointCloudTools {\r\n NONE = 'NONE',\r\n LINE_MEASUREMENT = 'DISTANCE_MEASUREMENT',\r\n ANGLE_MEASUREMENT = 'ANGLE_MEASUREMENT',\r\n AREA_MEASUREMENT = 'AREA_MEASUREMENT',\r\n VOLUME_MEASUREMENT = 'VOLUME_MEASUREMENT',\r\n\r\n CLIPPING_PLANE = 'CLIPPING_PLANE',\r\n CLIPPING_BOX = 'CLIPPING_BOX',\r\n}\r\n\r\nexport enum CameraControl {\r\n EARTH_CONTROL = 'earth-control',\r\n ORBIT_CONTROL = 'orbit-control',\r\n FIRST_PERSON = 'first-person-control'\r\n}\r\n\r\nexport interface PointCloudState {\r\n ready: boolean;\r\n viewer: any; //potree doesn't have type annoation, so we use type any here\r\n activeTool: PointCloudTools;\r\n cameraProjection: CameraMode;\r\n cameraControl: CameraControl;\r\n moveSpeed: number;\r\n lockElevation: boolean;\r\n loadedPointCloudIds: string[];\r\n}\r\n\r\nexport const initialPointCloudState: PointCloudState = {\r\n ready: false,\r\n viewer: null,\r\n activeTool: PointCloudTools.NONE,\r\n cameraProjection: CameraMode.PERSPECTIVE,\r\n cameraControl: CameraControl.ORBIT_CONTROL,\r\n moveSpeed: 1,\r\n lockElevation: false,\r\n loadedPointCloudIds: [],\r\n};\r\n\r\nexport type PointCloudPayload = {\r\n [\"INIT\"]: { initialState: Partial<PointCloudState> }\r\n [\"SET_READY\"]: { ready: boolean }\r\n [\"SET_ACTIVE_TOOL\"]: {activeTool: PointCloudTools}\r\n [\"SET_CAMERA_PROJECTION\"]: {cameraProjection: CameraMode}\r\n [\"SET_CAMERA_CONTROL\"]: {cameraControl: CameraControl}\r\n [\"SET_MOVE_SPEED\"]: {moveSpeed: number}\r\n [\"SET_LOCK_ELEVATION\"]: {lockElevation: boolean}\r\n [\"LOAD_POINT_CLOUD\"]: { id: string }\r\n [\"UNLOAD_POINT_CLOUD\"]: { id: string }\r\n};\r\n\r\nexport type PointCloudActions =\r\n ActionMap<PointCloudPayload>[keyof ActionMap<PointCloudPayload>];\r\n\r\nexport const PointCloudReducer = (\r\n state: PointCloudState,\r\n action: PointCloudActions\r\n): PointCloudState => {\r\n switch (action.type) {\r\n case \"INIT\":\r\n return { ...initialPointCloudState, ...action.payload.initialState };\r\n case \"SET_READY\":\r\n return {...state, ready: action.payload.ready}\r\n case \"SET_ACTIVE_TOOL\":\r\n return {...state, activeTool: action.payload.activeTool}\r\n case \"SET_CAMERA_PROJECTION\":\r\n return {...state, cameraProjection: action.payload.cameraProjection}\r\n case \"SET_CAMERA_CONTROL\":\r\n return {...state, cameraControl: action.payload.cameraControl}\r\n case \"SET_MOVE_SPEED\":\r\n return {...state, moveSpeed: action.payload.moveSpeed}\r\n case \"SET_LOCK_ELEVATION\":\r\n return {...state, lockElevation: action.payload.lockElevation}\r\n case \"LOAD_POINT_CLOUD\":\r\n if (state.loadedPointCloudIds.includes(action.payload.id)) return state;\r\n return { ...state, loadedPointCloudIds: [...state.loadedPointCloudIds, action.payload.id] }\r\n case \"UNLOAD_POINT_CLOUD\":\r\n return { ...state, loadedPointCloudIds: state.loadedPointCloudIds.filter(id => id !== action.payload.id) }\r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Q,cAAa;AAAA,IAC/D,KAAK;AACH,UAAI,MAAM,oBAAoB,SAAS,OAAO,QAAQ,EAAE,EAAG,QAAO;AAClE,aAAO,iCAAK,QAAL,EAAY,qBAAqB,CAAC,GAAG,MAAM,qBAAqB,OAAO,QAAQ,EAAE,EAAE;AAAA,IAC5F,KAAK;AACH,aAAO,iCAAK,QAAL,EAAY,qBAAqB,MAAM,oBAAoB,OAAO,QAAM,OAAO,OAAO,QAAQ,EAAE,EAAE;AAAA,IAC3G;AACE,aAAO;AAAA,EACX;AACF;","names":["PointCloudTools","CameraControl"]}
1
+ {"version":3,"sources":["../../../../src/core/store/PointCloud/reducer.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { CameraMode } from \"../../components/viewers/pointcloud/define\";\r\n\r\nimport type { ActionMap } from \"../ActionMap\";\r\n\r\nexport enum PointCloudTools {\r\n NONE = 'NONE',\r\n LINE_MEASUREMENT = 'DISTANCE_MEASUREMENT',\r\n ANGLE_MEASUREMENT = 'ANGLE_MEASUREMENT',\r\n AREA_MEASUREMENT = 'AREA_MEASUREMENT',\r\n VOLUME_MEASUREMENT = 'VOLUME_MEASUREMENT',\r\n\r\n CLIPPING_PLANE = 'CLIPPING_PLANE',\r\n CLIPPING_BOX = 'CLIPPING_BOX',\r\n}\r\n\r\nexport enum CameraControl {\r\n EARTH_CONTROL = 'earth-control',\r\n ORBIT_CONTROL = 'orbit-control',\r\n FIRST_PERSON = 'first-person-control'\r\n}\r\n\r\nexport interface PointCloudState {\r\n ready: boolean;\r\n viewer: any; //potree doesn't have type annoation, so we use type any here\r\n activeTool: PointCloudTools;\r\n cameraProjection: CameraMode;\r\n cameraControl: CameraControl;\r\n moveSpeed: number;\r\n lockElevation: boolean;\r\n loadedPointCloudIds: string[];\r\n}\r\n\r\nexport const initialPointCloudState: PointCloudState = {\r\n ready: false,\r\n viewer: null,\r\n activeTool: PointCloudTools.NONE,\r\n cameraProjection: CameraMode.PERSPECTIVE,\r\n cameraControl: CameraControl.ORBIT_CONTROL,\r\n moveSpeed: 1,\r\n lockElevation: false,\r\n loadedPointCloudIds: [],\r\n};\r\n\r\nexport type PointCloudPayload = {\r\n [\"INIT\"]: { initialState: Partial<PointCloudState> }\r\n [\"SET_READY\"]: { ready: boolean }\r\n [\"SET_ACTIVE_TOOL\"]: {activeTool: PointCloudTools}\r\n [\"SET_CAMERA_PROJECTION\"]: {cameraProjection: CameraMode}\r\n [\"SET_CAMERA_CONTROL\"]: {cameraControl: CameraControl}\r\n [\"SET_MOVE_SPEED\"]: {moveSpeed: number}\r\n [\"SET_LOCK_ELEVATION\"]: {lockElevation: boolean}\r\n [\"LOAD_POINT_CLOUD\"]: { id: string }\r\n [\"UNLOAD_POINT_CLOUD\"]: { id: string }\r\n};\r\n\r\nexport type PointCloudActions =\r\n ActionMap<PointCloudPayload>[keyof ActionMap<PointCloudPayload>];\r\n\r\nexport const PointCloudReducer = (\r\n state: PointCloudState,\r\n action: PointCloudActions\r\n): PointCloudState => {\r\n switch (action.type) {\r\n case \"INIT\":\r\n return { ...state, ...action.payload.initialState };\r\n case \"SET_READY\":\r\n return {...state, ready: action.payload.ready}\r\n case \"SET_ACTIVE_TOOL\":\r\n return {...state, activeTool: action.payload.activeTool}\r\n case \"SET_CAMERA_PROJECTION\":\r\n return {...state, cameraProjection: action.payload.cameraProjection}\r\n case \"SET_CAMERA_CONTROL\":\r\n return {...state, cameraControl: action.payload.cameraControl}\r\n case \"SET_MOVE_SPEED\":\r\n return {...state, moveSpeed: action.payload.moveSpeed}\r\n case \"SET_LOCK_ELEVATION\":\r\n return {...state, lockElevation: action.payload.lockElevation}\r\n case \"LOAD_POINT_CLOUD\":\r\n if (state.loadedPointCloudIds.includes(action.payload.id)) return state;\r\n return { ...state, loadedPointCloudIds: [...state.loadedPointCloudIds, action.payload.id] }\r\n case \"UNLOAD_POINT_CLOUD\":\r\n return { ...state, loadedPointCloudIds: state.lo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I,QAAJ,EAAW,eAAe,OAAO,QAAQ,cAAa;AAAA,IAC/D,KAAK;AACH,UAAI,MAAM,oBAAoB,SAAS,OAAO,QAAQ,EAAE,EAAG,QAAO;AAClE,aAAO,iCAAK,QAAL,EAAY,qBAAqB,CAAC,GAAG,MAAM,qBAAqB,OAAO,QAAQ,EAAE,EAAE;AAAA,IAC5F,KAAK;AACH,aAAO,iCAAK,QAAL,EAAY,qBAAqB,MAAM,oBAAoB,OAAO,QAAM,OAAO,OAAO,QAAQ,EAAE,EAAE;AAAA,IAC3G;AACE,aAAO;AAAA,EACX;AACF;","names":["PointCloudTools","CameraControl"]}
@@ -1,5 +1,16 @@
1
1
  /** Platform highlight colour, shared by map + BIM comment/sensor markers. */
2
2
  export declare const HIGHLIGHT_COLOR = "#73cee2";
3
+ /**
4
+ * Props every map `<Marker>` needs so it stays legible when the camera is pitched.
5
+ *
6
+ * MapLibre fades a marker to `opacityWhenCovered` (default `0.2`) once it decides the marker sits
7
+ * behind 3D terrain. Our markers are anchored to the ground, so at a grazing pitch the depth test
8
+ * reads them as covered by the very surface they stand on and half the scene goes translucent.
9
+ * Our markers are annotations rather than objects in the scene, so they should never be occluded.
10
+ */
11
+ export declare const markerOcclusionProps: {
12
+ readonly opacityWhenCovered: 1;
13
+ };
3
14
  export declare const markerStyle: string;
4
15
  export declare const markerStyleHighlight: string;
5
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"markerUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/markerUtils.ts"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,eAAO,MAAM,eAAe,YAAY,CAAA;AAGxC,eAAO,MAAM,WAAW,QAEiB,CAAC;AAG1C,eAAO,MAAM,oBAAoB,QAGQ,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAI5G;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAClG,MAAM,CAKR"}
1
+ {"version":3,"file":"markerUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/markerUtils.ts"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,eAAO,MAAM,eAAe,YAAY,CAAA;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;CAAqC,CAAA;AAGtE,eAAO,MAAM,WAAW,QAEiB,CAAC;AAG1C,eAAO,MAAM,oBAAoB,QAGQ,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAI5G;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAClG,MAAM,CAKR"}
@@ -1,5 +1,6 @@
1
1
  import { withAlpha } from "./colourUtils";
2
2
  const HIGHLIGHT_COLOR = "#73cee2";
3
+ const markerOcclusionProps = { opacityWhenCovered: 1 };
3
4
  const markerStyle = "absolute z-[99999] pointer-events-auto rounded-[16px] transition-[box-shadow] translate-x-[-50%] translate-y-[-90%]";
4
5
  const markerStyleHighlight = "absolute z-[99999] pointer-events-auto rounded-[16px] transition-[box-shadow] shadow-[0_0_0_2px_#73cee2,0_0_16px_4px_rgba(115,206,226,0.5)] translate-x-[-50%] translate-y-[-90%]";
5
6
  function commentRingShadow({ highlight, focused }) {
@@ -16,6 +17,7 @@ function sensorRingShadow({ haloColour, highlight, focused }) {
16
17
  export {
17
18
  HIGHLIGHT_COLOR,
18
19
  commentRingShadow,
20
+ markerOcclusionProps,
19
21
  markerStyle,
20
22
  markerStyleHighlight,
21
23
  sensorRingShadow
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/utils/markerUtils.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { withAlpha } from './colourUtils'\r\n\r\n/** Platform highlight colour, shared by map + BIM comment/sensor markers. */\r\nexport const HIGHLIGHT_COLOR = '#73cee2'\r\n\r\n// Tailwind class string for marker highlight style\r\nexport const markerStyle =\r\n 'absolute z-[99999] pointer-events-auto rounded-[16px] transition-[box-shadow] ' +\r\n 'translate-x-[-50%] translate-y-[-90%]';\r\n\r\n// Tailwind class string for marker style\r\nexport const markerStyleHighlight =\r\n 'absolute z-[99999] pointer-events-auto rounded-[16px] transition-[box-shadow] ' +\r\n 'shadow-[0_0_0_2px_#73cee2,0_0_16px_4px_rgba(115,206,226,0.5)] ' +\r\n 'translate-x-[-50%] translate-y-[-90%]';\r\n\r\n/**\r\n * `box-shadow` ring for a comment marker, shared by every surface so the ring widths stay\r\n * consistent: 1px white (idle), 2px highlight (hover/selected), 3px focus (double-click zoom).\r\n */\r\nexport function commentRingShadow({ highlight, focused }: { highlight?: boolean; focused?: boolean }): string {\r\n if (focused) return `0 0 0 3px ${HIGHLIGHT_COLOR}, 0 0 12px rgba(115, 206, 226, 0.6)`\r\n if (highlight) return `0 0 0 2px ${HIGHLIGHT_COLOR}, 0 0 8px rgba(115, 206, 226, 0.5)`\r\n return '0 0 0 1px white'\r\n}\r\n\r\n/**\r\n * `box-shadow` ring for a sensor marker.\r\n *\r\n * When `haloColour` is given, the ring carries the sensor's current *value* (see\r\n * `sensorColour.ts`), so it can no longer also carry selection. Focus therefore moves to ring\r\n * **width**: 2px at rest, 3px hovered, 4px focused, all in the value colour. Without a value\r\n * colour it degrades to the platform comment tiers so an unconfigured sensor type looks exactly\r\n * as it did before the value ramp existed.\r\n */\r\nexport function sensorRingShadow(\r\n { haloColour, highlight, focused }: { haloColour?: string; highlight?: boolean; focused?: boolean },\r\n): string {\r\n if (!haloColour) return commentRingShadow({ highlight, focused })\r\n const width = focused ? 4 : highlight ? 3 : 2\r\n const spread = focused ? 18 : highlight ? 14 : 10\r\n return `0 0 0 ${width}px ${haloColour}, 0 0 ${spread}px ${withAlpha(haloColour, 0.55)}`\r\n}\r\n\r\n"],"mappings":"AAGA,SAAS,iBAAiB;AAGnB,MAAM,kBAAkB;AAGxB,MAAM,cACX;AAIK,MAAM,uBACX;AAQK,SAAS,kBAAkB,EAAE,WAAW,QAAQ,GAAuD;AAC5G,MAAI,QAAS,QAAO,aAAa,eAAe;AAChD,MAAI,UAAW,QAAO,aAAa,eAAe;AAClD,SAAO;AACT;AAWO,SAAS,iBACd,EAAE,YAAY,WAAW,QAAQ,GACzB;AACR,MAAI,CAAC,WAAY,QAAO,kBAAkB,EAAE,WAAW,QAAQ,CAAC;AAChE,QAAM,QAAQ,UAAU,IAAI,YAAY,IAAI;AAC5C,QAAM,SAAS,UAAU,KAAK,YAAY,KAAK;AAC/C,SAAO,SAAS,KAAK,MAAM,UAAU,SAAS,MAAM,MAAM,UAAU,YAAY,IAAI,CAAC;AACvF;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/utils/markerUtils.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { withAlpha } from './colourUtils'\r\n\r\n/** Platform highlight colour, shared by map + BIM comment/sensor markers. */\r\nexport const HIGHLIGHT_COLOR = '#73cee2'\r\n\r\n/**\r\n * Props every map `<Marker>` needs so it stays legible when the camera is pitched.\r\n *\r\n * MapLibre fades a marker to `opacityWhenCovered` (default `0.2`) once it decides the marker sits\r\n * behind 3D terrain. Our markers are anchored to the ground, so at a grazing pitch the depth test\r\n * reads them as covered by the very surface they stand on and half the scene goes translucent.\r\n * Our markers are annotations rather than objects in the scene, so they should never be occluded.\r\n */\r\nexport const markerOcclusionProps = { opacityWhenCovered: 1 } as const\r\n\r\n// Tailwind class string for marker highlight style\r\nexport const markerStyle =\r\n 'absolute z-[99999] pointer-events-auto rounded-[16px] transition-[box-shadow] ' +\r\n 'translate-x-[-50%] translate-y-[-90%]';\r\n\r\n// Tailwind class string for marker style\r\nexport const markerStyleHighlight =\r\n 'absolute z-[99999] pointer-events-auto rounded-[16px] transition-[box-shadow] ' +\r\n 'shadow-[0_0_0_2px_#73cee2,0_0_16px_4px_rgba(115,206,226,0.5)] ' +\r\n 'translate-x-[-50%] translate-y-[-90%]';\r\n\r\n/**\r\n * `box-shadow` ring for a comment marker, shared by every surface so the ring widths stay\r\n * consistent: 1px white (idle), 2px highlight (hover/selected), 3px focus (double-click zoom).\r\n */\r\nexport function commentRingShadow({ highlight, focused }: { highlight?: boolean; focused?: boolean }): string {\r\n if (focused) return `0 0 0 3px ${HIGHLIGHT_COLOR}, 0 0 12px rgba(115, 206, 226, 0.6)`\r\n if (highlight) return `0 0 0 2px ${HIGHLIGHT_COLOR}, 0 0 8px rgba(115, 206, 226, 0.5)`\r\n return '0 0 0 1px white'\r\n}\r\n\r\n/**\r\n * `box-shadow` ring for a sensor marker.\r\n *\r\n * When `haloColour` is given, the ring carries the sensor's current *value* (see\r\n * `sensorColour.ts`), so it can no longer also carry selection. Focus therefore moves to ring\r\n * **width**: 2px at rest, 3px hovered, 4px focused, all in the value colour. Without a value\r\n * colour it degrades to the platform comment tiers so an unconfigured sensor type looks exactly\r\n * as it did before the value ramp existed.\r\n */\r\nexport function sensorRingShadow(\r\n { haloColour, highlight, focused }: { haloColour?: string; highlight?: boolean; focused?: boolean },\r\n): string {\r\n if (!haloColour) return commentRingShadow({ highlight, focused })\r\n const width = focused ? 4 : highlight ? 3 : 2\r\n const spread = focused ? 18 : highlight ? 14 : 10\r\n return `0 0 0 ${width}px ${haloColour}, 0 0 ${spread}px ${withAlpha(haloColour, 0.55)}`\r\n}\r\n\r\n"],"mappings":"AAGA,SAAS,iBAAiB;AAGnB,MAAM,kBAAkB;AAUxB,MAAM,uBAAuB,EAAE,oBAAoB,EAAE;AAGrD,MAAM,cACX;AAIK,MAAM,uBACX;AAQK,SAAS,kBAAkB,EAAE,WAAW,QAAQ,GAAuD;AAC5G,MAAI,QAAS,QAAO,aAAa,eAAe;AAChD,MAAI,UAAW,QAAO,aAAa,eAAe;AAClD,SAAO;AACT;AAWO,SAAS,iBACd,EAAE,YAAY,WAAW,QAAQ,GACzB;AACR,MAAI,CAAC,WAAY,QAAO,kBAAkB,EAAE,WAAW,QAAQ,CAAC;AAChE,QAAM,QAAQ,UAAU,IAAI,YAAY,IAAI;AAC5C,QAAM,SAAS,UAAU,KAAK,YAAY,KAAK;AAC/C,SAAO,SAAS,KAAK,MAAM,UAAU,SAAS,MAAM,MAAM,UAAU,YAAY,IAAI,CAAC;AACvF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collabdt/core",
3
- "version": "0.4.1",
3
+ "version": "0.4.4",
4
4
  "description": "CDT Core contains all the core technology for your CDT platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,21 +0,0 @@
1
- import * as OBC from '@thatopen/components';
2
- export declare class LengthMeasurement extends OBC.Component {
3
- static readonly uuid: "5f8da1b7-6023-4a21-acc7-569127cdde54";
4
- enabled: boolean;
5
- private measurer;
6
- private world;
7
- readonly onDimensionCreate: OBC.Event<{
8
- length: number;
9
- }>;
10
- constructor(components: OBC.Components);
11
- private setupEventListeners;
12
- private setupDoubleClickListener;
13
- createFreeMeasurements(): void;
14
- createEdgeMeasurements(): void;
15
- create(): void;
16
- delete(): void;
17
- deleteAll(): void;
18
- getAllValues(): number[];
19
- dispose(): void;
20
- }
21
- //# sourceMappingURL=LenghtMeasurement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LenghtMeasurement.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/components/viewers/bim/src/BimMeasurements/LenghtMeasurement.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,sBAAsB,CAAA;AAM3C,qBAAa,iBAAkB,SAAQ,GAAG,CAAC,SAAS;IAEhD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,sCAAsC,CAAS;IAEtE,OAAO,UAAQ;IAEf,OAAO,CAAC,QAAQ,CAAqC;IAErD,OAAO,CAAC,KAAK,CAAyB;IAEtC,QAAQ,CAAC,iBAAiB;gBAA2B,MAAM;OAAK;gBAEpD,UAAU,EAAE,GAAG,CAAC,UAAU;IActC,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,wBAAwB;IAahC,sBAAsB;IAStB,sBAAsB;IAStB,MAAM;IAQN,MAAM;IAQN,SAAS;IAST,YAAY;IAUZ,OAAO;CAUV"}
@@ -1,92 +0,0 @@
1
- import * as OBC from "@thatopen/components";
2
- import * as OBF from "@thatopen/components-front";
3
- import * as THREE from "three";
4
- import { CurrentWorld } from "../CurrentWorld";
5
- const _LengthMeasurement = class _LengthMeasurement extends OBC.Component {
6
- constructor(components) {
7
- super(components);
8
- this.enabled = false;
9
- this.measurer = null;
10
- this.world = null;
11
- this.onDimensionCreate = new OBC.Event();
12
- components.add(_LengthMeasurement.uuid, this);
13
- this.measurer = components.get(OBF.LengthMeasurement);
14
- this.world = components.get(CurrentWorld).world;
15
- if (this.measurer && this.world) {
16
- this.measurer.world = this.world;
17
- this.measurer.color = new THREE.Color(7589602);
18
- this.setupEventListeners();
19
- }
20
- this.enabled = true;
21
- }
22
- setupEventListeners() {
23
- if (!this.measurer) return;
24
- this.measurer.list.onItemAdded.add((dimension) => {
25
- this.onDimensionCreate.trigger({ length: dimension.value });
26
- });
27
- this.setupDoubleClickListener();
28
- }
29
- setupDoubleClickListener() {
30
- var _a;
31
- if (!this.world) return;
32
- const container = (_a = this.world.renderer) == null ? void 0 : _a.three.domElement;
33
- if (!container) return;
34
- container.ondblclick = () => {
35
- var _a2;
36
- if ((_a2 = this.measurer) == null ? void 0 : _a2.enabled) {
37
- void this.measurer.create();
38
- }
39
- };
40
- }
41
- createFreeMeasurements() {
42
- if (!this.measurer || !this.world) return;
43
- this.enabled = true;
44
- this.measurer.enabled = true;
45
- this.measurer.mode = "free";
46
- }
47
- createEdgeMeasurements() {
48
- if (!this.measurer || !this.world) return;
49
- this.enabled = true;
50
- this.measurer.enabled = true;
51
- this.measurer.mode = "edge";
52
- }
53
- create() {
54
- if (!this.measurer) return;
55
- void this.measurer.create();
56
- }
57
- delete() {
58
- if (!this.measurer) return;
59
- this.measurer.delete();
60
- this.measurer.endCreation();
61
- }
62
- deleteAll() {
63
- if (!this.measurer) return;
64
- this.measurer.list.clear();
65
- this.measurer.endCreation();
66
- this.measurer.enabled = false;
67
- }
68
- getAllValues() {
69
- if (!this.measurer) return [];
70
- const lengths = [];
71
- for (const line of this.measurer.list) {
72
- lengths.push(line.value);
73
- }
74
- return lengths;
75
- }
76
- dispose() {
77
- if (this.measurer) {
78
- this.measurer.enabled = false;
79
- this.measurer.list.clear();
80
- }
81
- this.enabled = false;
82
- this.measurer = null;
83
- this.world = null;
84
- this.onDimensionCreate.reset();
85
- }
86
- };
87
- _LengthMeasurement.uuid = "5f8da1b7-6023-4a21-acc7-569127cdde54";
88
- let LengthMeasurement = _LengthMeasurement;
89
- export {
90
- LengthMeasurement
91
- };
92
- //# sourceMappingURL=LenghtMeasurement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/core/components/viewers/bim/src/BimMeasurements/LenghtMeasurement.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as OBC from '@thatopen/components'\r\nimport * as OBF from '@thatopen/components-front'\r\nimport * as THREE from 'three'\r\n\r\nimport { CurrentWorld } from '../CurrentWorld'\r\n\r\nexport class LengthMeasurement extends OBC.Component {\r\n\r\n static readonly uuid = \"5f8da1b7-6023-4a21-acc7-569127cdde54\" as const\r\n\r\n enabled = false\r\n\r\n private measurer: OBF.LengthMeasurement | null = null\r\n\r\n private world: OBC.World | null = null\r\n\r\n readonly onDimensionCreate = new OBC.Event<{ length: number }>()\r\n\r\n constructor(components: OBC.Components) {\r\n super(components)\r\n components.add(LengthMeasurement.uuid, this)\r\n this.measurer = components.get(OBF.LengthMeasurement)\r\n this.world = components.get(CurrentWorld).world\r\n\r\n if (this.measurer && this.world) {\r\n this.measurer.world = this.world\r\n this.measurer.color = new THREE.Color(0x73cee2)\r\n this.setupEventListeners()\r\n }\r\n this.enabled = true\r\n }\r\n\r\n private setupEventListeners() {\r\n if (!this.measurer) return\r\n\r\n // Listen for when measurements are created\r\n this.measurer.list.onItemAdded.add((dimension) => {\r\n this.onDimensionCreate.trigger({ length: dimension.value })\r\n })\r\n\r\n // Set up double-click event for creating measurements\r\n this.setupDoubleClickListener()\r\n }\r\n\r\n private setupDoubleClickListener() {\r\n if (!this.world) return\r\n\r\n const container = this.world.renderer?.three.domElement\r\n if (!container) return\r\n\r\n container.ondblclick = () => {\r\n if (this.measurer?.enabled) {\r\n void this.measurer.create()\r\n }\r\n }\r\n }\r\n\r\n createFreeMeasurements() {\r\n if (!this.measurer || !this.world) return\r\n\r\n\r\n this.enabled = true\r\n this.measurer.enabled = true\r\n this.measurer.mode = 'free'\r\n }\r\n\r\n createEdgeMeasurements() {\r\n if (!this.measurer || !this.world) return\r\n\r\n // Enable the component and edge measurement mode with snapping\r\n this.enabled = true\r\n this.measurer.enabled = true\r\n this.measurer.mode = 'edge'\r\n }\r\n\r\n create() {\r\n if (!this.measurer) return\r\n\r\n // Create a measurement programmatically\r\n // This will start the measurement creation process\r\n void this.measurer.create()\r\n }\r\n\r\n delete() {\r\n if (!this.measurer) return\r\n\r\n // Delete the last created measurement\r\n this.measurer.delete()\r\n this.measurer.endCreation()\r\n }\r\n\r\n deleteAll() {\r\n if (!this.measurer) return\r\n\r\n // Delete all measurements using the list\r\n this.measurer.list.clear()\r\n this.measurer.endCreation()\r\n this.measurer.enabled = false\r\n }\r\n\r\n getAllValues() {\r\n if (!this.measurer) return []\r\n\r\n const lengths: number[] = []\r\n for (const line of this.measurer.list) {\r\n lengths.push(line.value)\r\n }\r\n return lengths\r\n }\r\n\r\n dispose() {\r\n if (this.measurer) {\r\n this.measurer.enabled = false\r\n this.measurer.list.clear()\r\n }\r\n this.enabled = false\r\n this.measurer = null\r\n this.world = null\r\n this.onDimensionCreate.reset()\r\n }\r\n}"],"mappings":"AAGA,YAAY,SAAS;AACrB,YAAY,SAAS;AACrB,YAAY,WAAW;AAEvB,SAAS,oBAAoB;AAEtB,MAAM,qBAAN,MAAM,2BAA0B,IAAI,UAAU;AAAA,EAYjD,YAAY,YAA4B;AACpC,UAAM,UAAU;AATpB,mBAAU;AAEV,SAAQ,WAAyC;AAEjD,SAAQ,QAA0B;AAElC,SAAS,oBAAoB,IAAI,IAAI,MAA0B;AAI3D,eAAW,IAAI,mBAAkB,MAAM,IAAI;AAC3C,SAAK,WAAW,WAAW,IAAI,IAAI,iBAAiB;AACpD,SAAK,QAAQ,WAAW,IAAI,YAAY,EAAE;AAE1C,QAAI,KAAK,YAAY,KAAK,OAAO;AAC7B,WAAK,SAAS,QAAQ,KAAK;AAC3B,WAAK,SAAS,QAAQ,IAAI,MAAM,MAAM,OAAQ;AAC9C,WAAK,oBAAoB;AAAA,IAC7B;AACA,SAAK,UAAU;AAAA,EACnB;AAAA,EAEQ,sBAAsB;AAC1B,QAAI,CAAC,KAAK,SAAU;AAGpB,SAAK,SAAS,KAAK,YAAY,IAAI,CAAC,cAAc;AAC9C,WAAK,kBAAkB,QAAQ,EAAE,QAAQ,UAAU,MAAM,CAAC;AAAA,IAC9D,CAAC;AAGD,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