@collabdt/core 0.13.3 → 0.14.0
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/ConfirmDialog.d.ts +3 -3
- package/dist/core/components/ConfirmDialog.d.ts.map +1 -1
- package/dist/core/components/ConfirmDialog.js +1 -1
- package/dist/core/components/ConfirmDialog.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.js +13 -0
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.d.ts +2 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.js +4 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.js.map +1 -1
- package/dist/core/components/ui/chart.js +3 -3
- package/dist/core/components/ui/chart.js.map +1 -1
- package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
- package/dist/core/components/viewers/Viewer.js +15 -3
- package/dist/core/components/viewers/Viewer.js.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.js +2 -1
- package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js +1 -6
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js +1 -6
- package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.js +5 -2
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js +24 -15
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/CameraNavigation.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/CameraNavigation.js +2 -7
- package/dist/core/components/viewers/bim/src/CameraNavigation.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts +37 -129
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js +193 -395
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.d.ts +1 -12
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.js +3 -5
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.d.ts +15 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.js +61 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.d.ts +37 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.js +264 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.d.ts +56 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.js +337 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.d.ts +51 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.js +238 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.d.ts +1 -6
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js +9 -18
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.d.ts +6 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.js +91 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.d.ts +38 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.js +77 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.d.ts +15 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.js +34 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.d.ts +17 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.js +75 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.d.ts +16 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.js +41 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts +5 -5
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.js +12 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.d.ts +14 -6
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.js +76 -12
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.js.map +1 -1
- package/dist/core/components/viewers/bim/src/LoadModels.d.ts +3 -1
- package/dist/core/components/viewers/bim/src/LoadModels.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/LoadModels.js +10 -14
- package/dist/core/components/viewers/bim/src/LoadModels.js.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.d.ts +7 -0
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.js +78 -0
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.js.map +1 -0
- package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.js +18 -14
- package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.js.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.js +19 -0
- package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.js.map +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.js +22 -3
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/CameraController.d.ts +7 -17
- package/dist/core/components/viewers/bim/src/lib/CameraController.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/CameraController.js +26 -14
- package/dist/core/components/viewers/bim/src/lib/CameraController.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/ChromeController.d.ts +7 -8
- package/dist/core/components/viewers/bim/src/lib/ChromeController.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/ChromeController.js +22 -3
- package/dist/core/components/viewers/bim/src/lib/ChromeController.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts +4 -12
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.js +2 -2
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts +3 -2
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js +6 -2
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/createBimWorld.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/createBimWorld.js +2 -0
- package/dist/core/components/viewers/bim/src/lib/createBimWorld.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.d.ts +3 -25
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.js +2 -35
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.d.ts +38 -0
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.js +58 -0
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.d.ts +14 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.js +126 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.d.ts +19 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.js +41 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts +10 -34
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js +83 -53
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.d.ts +8 -0
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.js +81 -0
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.js.map +1 -0
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js +1 -0
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.js +2 -14
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.js.map +1 -1
- package/dist/core/components/viewers/plugins/PluginsManager.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/PluginsManager.js +7 -4
- package/dist/core/components/viewers/plugins/PluginsManager.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/InstallHereButton.d.ts +9 -0
- package/dist/core/components/viewers/plugins/src/InstallHereButton.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/InstallHereButton.js +33 -0
- package/dist/core/components/viewers/plugins/src/InstallHereButton.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryDetails.js +11 -6
- package/dist/core/components/viewers/plugins/src/RegistryDetails.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js +20 -7
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js.map +1 -1
- package/dist/core/components/viewers/plugins/types.d.ts +11 -1
- package/dist/core/components/viewers/plugins/types.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/objectTarget.d.ts +2 -1
- package/dist/core/components/viewers/shared/placement/objectTarget.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/objectTarget.js +6 -3
- package/dist/core/components/viewers/shared/placement/objectTarget.js.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementCore.d.ts +1 -0
- package/dist/core/components/viewers/shared/placement/placementCore.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementCore.js +12 -1
- package/dist/core/components/viewers/shared/placement/placementCore.js.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementTarget.d.ts +2 -0
- package/dist/core/components/viewers/shared/placement/placementTarget.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementTarget.js.map +1 -1
- package/dist/core/components/viewers/shared/placement/projectNorth.d.ts +22 -0
- package/dist/core/components/viewers/shared/placement/projectNorth.d.ts.map +1 -0
- package/dist/core/components/viewers/shared/placement/projectNorth.js +39 -0
- package/dist/core/components/viewers/shared/placement/projectNorth.js.map +1 -0
- package/dist/core/hooks/plugins/createPluginHooks.d.ts +1 -0
- package/dist/core/hooks/plugins/createPluginHooks.d.ts.map +1 -1
- package/dist/core/hooks/plugins/createPluginHooks.js +5 -4
- package/dist/core/hooks/plugins/createPluginHooks.js.map +1 -1
- package/dist/core/hooks/useUndoRedoShortcuts.d.ts.map +1 -1
- package/dist/core/hooks/useUndoRedoShortcuts.js +1 -6
- package/dist/core/hooks/useUndoRedoShortcuts.js.map +1 -1
- package/dist/core/i18n/messages/en.json +16 -4
- package/dist/core/i18n/messages/es.json +16 -4
- package/dist/core/i18n/messages/fr.json +16 -4
- package/dist/core/plugins/host/PluginDataPageHost.d.ts.map +1 -1
- package/dist/core/plugins/host/PluginDataPageHost.js +30 -25
- package/dist/core/plugins/host/PluginDataPageHost.js.map +1 -1
- package/dist/core/plugins/host/provider.d.ts.map +1 -1
- package/dist/core/plugins/host/provider.js +6 -1
- package/dist/core/plugins/host/provider.js.map +1 -1
- package/dist/core/plugins/host/runtimeMessages.d.ts +13 -0
- package/dist/core/plugins/host/runtimeMessages.d.ts.map +1 -0
- package/dist/core/plugins/host/runtimeMessages.js +21 -0
- package/dist/core/plugins/host/runtimeMessages.js.map +1 -0
- package/dist/core/plugins/host/runtimeShims.d.ts +2 -0
- package/dist/core/plugins/host/runtimeShims.d.ts.map +1 -1
- package/dist/core/plugins/host/runtimeShims.js +28 -1
- package/dist/core/plugins/host/runtimeShims.js.map +1 -1
- package/dist/core/plugins/host/usePluginToolbarTools.d.ts.map +1 -1
- package/dist/core/plugins/host/usePluginToolbarTools.js +6 -2
- package/dist/core/plugins/host/usePluginToolbarTools.js.map +1 -1
- package/dist/core/plugins/sdk/bimViewer.d.ts +25 -5
- package/dist/core/plugins/sdk/bimViewer.d.ts.map +1 -1
- package/dist/core/plugins/sdk/bimViewer.js +66 -10
- package/dist/core/plugins/sdk/bimViewer.js.map +1 -1
- package/dist/core/plugins/sdk/charts.d.ts +4 -0
- package/dist/core/plugins/sdk/charts.d.ts.map +1 -0
- package/dist/core/plugins/sdk/charts.js +46 -0
- package/dist/core/plugins/sdk/charts.js.map +1 -0
- package/dist/core/plugins/sdk/components.d.ts +1 -0
- package/dist/core/plugins/sdk/components.d.ts.map +1 -1
- package/dist/core/plugins/sdk/components.js +2 -0
- package/dist/core/plugins/sdk/components.js.map +1 -1
- package/dist/core/plugins/sdk/floorplan.d.ts +64 -0
- package/dist/core/plugins/sdk/floorplan.d.ts.map +1 -0
- package/dist/core/plugins/sdk/floorplan.js +102 -0
- package/dist/core/plugins/sdk/floorplan.js.map +1 -0
- package/dist/core/plugins/sdk/messages.d.ts.map +1 -1
- package/dist/core/plugins/sdk/messages.js +31 -15
- package/dist/core/plugins/sdk/messages.js.map +1 -1
- package/dist/core/plugins/sdk/types.d.ts +12 -1
- package/dist/core/plugins/sdk/types.d.ts.map +1 -1
- package/dist/core/plugins/sdk/types.js.map +1 -1
- package/dist/core/plugins/sdk/ui.d.ts +6 -0
- package/dist/core/plugins/sdk/ui.d.ts.map +1 -1
- package/dist/core/plugins/sdk/ui.js +13 -0
- package/dist/core/plugins/sdk/ui.js.map +1 -1
- package/dist/core/types/global.d.ts +1 -1
- package/dist/core/types/global.d.ts.map +1 -1
- package/dist/core/types/global.js.map +1 -1
- package/dist/core/utils/utils.d.ts +2 -0
- package/dist/core/utils/utils.d.ts.map +1 -1
- package/dist/core/utils/utils.js +4 -0
- package/dist/core/utils/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,11 +14,18 @@ import { SPACES_LAYER } from "../lib/spaceOverlay";
|
|
|
14
14
|
import { ViewModeCoordinator } from "../lib/ViewModeCoordinator";
|
|
15
15
|
import { stagePercent } from "../lib/viewSection";
|
|
16
16
|
import { FloorplanRenderer } from "./src/FloorplanRenderer";
|
|
17
|
+
import { PlanCutFill } from "./src/PlanCutFill";
|
|
18
|
+
import { requestPlanRender } from "./src/planScene";
|
|
19
|
+
import { PlanShapeEditor } from "./src/PlanShapeEditor";
|
|
20
|
+
import { PlanSketch } from "./src/PlanSketch";
|
|
21
|
+
import { PluginPlanOverlay } from "./src/PluginPlanOverlay";
|
|
17
22
|
import { StoreyProjector } from "./src/StoreyProjector";
|
|
18
23
|
import { CUT_COLOR, FILL_COLOR, FLOORPLAN_TOOL_UUID } from "./src/types";
|
|
19
|
-
import { normalizeElevation, storeyCutPlaneY, storeyLowerClipY } from "./src/utils";
|
|
24
|
+
import { anchorStoreyElevations, normalizeElevation, storeyCutPlaneY, storeyFloorY, storeyLowerClipY } from "./src/utils";
|
|
20
25
|
const SLOT_SECTION = "floorplan:section";
|
|
21
26
|
const SLOT_LOWER = "floorplan:lower";
|
|
27
|
+
const PLAN_OVERLAY_OFFSET = 0.01;
|
|
28
|
+
const FIT_PADDING = 0.05;
|
|
22
29
|
const STAGE_PERCENT = {
|
|
23
30
|
init: 5,
|
|
24
31
|
readingStoreys: 10,
|
|
@@ -40,41 +47,13 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
40
47
|
this.onDrawingsChanged = new OBC.Event();
|
|
41
48
|
this.onActiveDrawingChanged = new OBC.Event();
|
|
42
49
|
this.onGenerationStateChanged = new OBC.Event();
|
|
43
|
-
/** Fires whenever an entry's layer metadata changes (toggle / color). */
|
|
44
50
|
this.onLayersChanged = new OBC.Event();
|
|
45
|
-
/** Fires when the building's true-north angle (in degrees) is updated. */
|
|
46
|
-
this.onNorthAngleChanged = new OBC.Event();
|
|
47
|
-
/** Fires when line-pick mode toggles on/off. */
|
|
48
51
|
this.onPickingNorthChanged = new OBC.Event();
|
|
49
52
|
this._entries = /* @__PURE__ */ new Map();
|
|
50
53
|
this._activeId = null;
|
|
51
|
-
|
|
52
|
-
* succession (e.g. user clicks two storeys), only the last call applies
|
|
53
|
-
* its final state. Prior calls bail out at await boundaries. */
|
|
54
|
+
// Only the latest activate() applies its final state; earlier calls bail out at each await.
|
|
54
55
|
this._activateSeq = 0;
|
|
55
|
-
/** True-north rotation in degrees (clockwise from default screen-up).
|
|
56
|
-
* Persists across storey switches; cleared by `resetAll` on a building change. */
|
|
57
|
-
this._northAngle = 0;
|
|
58
|
-
/** True while the user is drawing the two-point north line. */
|
|
59
56
|
this._pickingNorth = false;
|
|
60
|
-
this._pickHandler = null;
|
|
61
|
-
this._moveHandler = null;
|
|
62
|
-
this._keyHandler = null;
|
|
63
|
-
/** First clicked point of the north line, in drawing-local space (Y=0).
|
|
64
|
-
* Null until the user places the first point. */
|
|
65
|
-
this._drawStart = null;
|
|
66
|
-
/** Cached snap targets — projected-geometry vertices flattened as
|
|
67
|
-
* [x0,z0, x1,z1, …] in drawing-local space. Rebuilt each time draw mode
|
|
68
|
-
* starts so it reflects the active storey's lines. */
|
|
69
|
-
this._snapVerts = null;
|
|
70
|
-
/** Rubber-band preview line + cursor snap marker, parented to the active
|
|
71
|
-
* drawing so they inherit its world transform. */
|
|
72
|
-
this._previewLine = null;
|
|
73
|
-
this._snapMarker = null;
|
|
74
|
-
/** Canvas cursor before draw mode swapped in the crosshair — typically the
|
|
75
|
-
* floorplan-mode "grab" hand. Restored (not cleared) on exit so panning
|
|
76
|
-
* keeps the hand; only leaving floorplan mode reverts to the default. */
|
|
77
|
-
this._savedPickCursor = null;
|
|
78
57
|
// Unloading a model has to take its drawings with it, or they outlive the building they describe.
|
|
79
58
|
this.onModelRemoved = (modelId) => {
|
|
80
59
|
this.disposeEntriesForModel(modelId);
|
|
@@ -85,13 +64,41 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
85
64
|
this.camera = new CameraController(components);
|
|
86
65
|
this.chrome = new ChromeController(components);
|
|
87
66
|
this.clip = new ClipController(components);
|
|
67
|
+
this.cutFill = new PlanCutFill(components);
|
|
88
68
|
this.grid = new GridController(components);
|
|
69
|
+
const planY = () => this.activePlanY;
|
|
70
|
+
const snapSegments = () => this.activeDrawing ? this._collectSnapSegments(this.activeDrawing) : null;
|
|
71
|
+
this.sketch = new PlanSketch(components, {
|
|
72
|
+
planY,
|
|
73
|
+
snapSegments,
|
|
74
|
+
setLeftButtonPans: (pans) => this.camera.setLeftButtonPans(pans)
|
|
75
|
+
});
|
|
76
|
+
this.editor = new PlanShapeEditor(components, { planY, snapSegments });
|
|
77
|
+
this.overlay = new PluginPlanOverlay(components, () => this.isPointerBusy);
|
|
78
|
+
this.overlay.onReplacedSpacesChanged.add(() => this._hideReplacedSpaces());
|
|
79
|
+
this.sketch.onActiveChanged.add((active) => this._onPointerToolChanged(active, this.editor));
|
|
80
|
+
this.editor.onActiveChanged.add((active) => this._onPointerToolChanged(active, this.sketch));
|
|
89
81
|
const fragments = components.get(OBC.FragmentsManager);
|
|
90
82
|
fragments.core.onModelLoaded.add((model) => {
|
|
91
83
|
void this.generate(model.modelId);
|
|
92
84
|
});
|
|
93
85
|
fragments.list.onItemDeleted.add(this.onModelRemoved);
|
|
94
86
|
}
|
|
87
|
+
/** True while a sketch or a shape edit owns the plan pointer. */
|
|
88
|
+
get isPointerBusy() {
|
|
89
|
+
return this.sketch.isActive || this.editor.isActive;
|
|
90
|
+
}
|
|
91
|
+
// Sketching and reshaping both own the pointer, so starting one ends the other.
|
|
92
|
+
_onPointerToolChanged(active, other) {
|
|
93
|
+
if (!active) return;
|
|
94
|
+
other.cancel();
|
|
95
|
+
this.overlay.releasePointer();
|
|
96
|
+
}
|
|
97
|
+
_hideReplacedSpaces() {
|
|
98
|
+
var _a;
|
|
99
|
+
for (const entry of this._entries.values()) (_a = entry.spaces) == null ? void 0 : _a.setHidden(this.overlay.replacedSpaces(entry.modelId));
|
|
100
|
+
requestPlanRender(this.components);
|
|
101
|
+
}
|
|
95
102
|
get drawings() {
|
|
96
103
|
return Array.from(this._entries.values()).sort(
|
|
97
104
|
(a, b) => a.elevation - b.elevation
|
|
@@ -104,12 +111,15 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
104
111
|
var _a;
|
|
105
112
|
return this._activeId ? (_a = this._entries.get(this._activeId)) != null ? _a : null : null;
|
|
106
113
|
}
|
|
107
|
-
/**
|
|
108
|
-
|
|
114
|
+
/** World height plugin sketches and overlays sit at, or null with no plan open. */
|
|
115
|
+
get activePlanY() {
|
|
116
|
+
const entry = this.activeDrawing;
|
|
117
|
+
return entry ? storeyCutPlaneY(entry.elevation) - PLAN_OVERLAY_OFFSET : null;
|
|
118
|
+
}
|
|
119
|
+
/** Without an injected grid the tool falls back to looking it up via `OBC.Grids`. */
|
|
109
120
|
setGrid(grid) {
|
|
110
121
|
this.grid.setGrid(grid);
|
|
111
122
|
}
|
|
112
|
-
/** Toggle visibility of a single per-class layer on an entry's drawing. */
|
|
113
123
|
setLayerVisible(entryId, className, visible) {
|
|
114
124
|
const entry = this._entries.get(entryId);
|
|
115
125
|
if (!(entry == null ? void 0 : entry.drawing)) return;
|
|
@@ -118,7 +128,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
118
128
|
entry.spaces.setVisible(visible);
|
|
119
129
|
const spaceMeta = entry.layers.find((l) => l.className === SPACES_LAYER);
|
|
120
130
|
if (spaceMeta) spaceMeta.visible = visible;
|
|
121
|
-
this.
|
|
131
|
+
requestPlanRender(this.components);
|
|
122
132
|
this.onLayersChanged.trigger(entry);
|
|
123
133
|
return;
|
|
124
134
|
}
|
|
@@ -126,14 +136,10 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
126
136
|
entry.drawing.layers.setVisibility(className, visible);
|
|
127
137
|
const meta = entry.layers.find((l) => l.className === className);
|
|
128
138
|
if (meta) meta.visible = visible;
|
|
129
|
-
this.
|
|
139
|
+
requestPlanRender(this.components);
|
|
130
140
|
this.onLayersChanged.trigger(entry);
|
|
131
141
|
}
|
|
132
|
-
/**
|
|
133
|
-
* both the projected-line color in the drawing AND the 3D highlight
|
|
134
|
-
* color for FILL (slabs / roofs) and CUT (walls / columns / curtain-
|
|
135
|
-
* walls) classes — so changing the IFCSLAB color repaints both its
|
|
136
|
-
* outline and its solid fill underneath. */
|
|
142
|
+
/** Recolours a class's projected lines and, for fill and cut classes, its 3D highlight too. */
|
|
137
143
|
async setLayerColor(entryId, className, color) {
|
|
138
144
|
const entry = this._entries.get(entryId);
|
|
139
145
|
if (!(entry == null ? void 0 : entry.drawing)) return;
|
|
@@ -142,7 +148,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
142
148
|
entry.spaces.setColor(color);
|
|
143
149
|
const spaceMeta = entry.layers.find((l) => l.className === SPACES_LAYER);
|
|
144
150
|
if (spaceMeta) spaceMeta.color = color;
|
|
145
|
-
this.
|
|
151
|
+
requestPlanRender(this.components);
|
|
146
152
|
this.onLayersChanged.trigger(entry);
|
|
147
153
|
return;
|
|
148
154
|
}
|
|
@@ -153,17 +159,20 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
153
159
|
if (FILL_CLASSES.has(className) || CUT_CLASSES.has(className)) {
|
|
154
160
|
await this._updateClassHighlight(entry, className, color);
|
|
155
161
|
}
|
|
156
|
-
this.
|
|
162
|
+
requestPlanRender(this.components);
|
|
157
163
|
this.onLayersChanged.trigger(entry);
|
|
158
164
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* — removes any existing group entries before re-inserting. */
|
|
162
|
-
_injectGroupColorLayers(entry) {
|
|
163
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
165
|
+
_groupColor(index, fallback) {
|
|
166
|
+
var _a, _b, _c, _d, _e;
|
|
164
167
|
const groups = (_c = (_b = (_a = this.renderer._highlighter) == null ? void 0 : _a.config) == null ? void 0 : _b.groups) != null ? _c : [];
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
return (_e = (_d = groups[index]) == null ? void 0 : _d.color) != null ? _e : fallback;
|
|
169
|
+
}
|
|
170
|
+
_cutColor() {
|
|
171
|
+
return this._groupColor(0, CUT_COLOR);
|
|
172
|
+
}
|
|
173
|
+
_injectGroupColorLayers(entry) {
|
|
174
|
+
const cutColor = this._cutColor();
|
|
175
|
+
const fillColor = this._groupColor(1, FILL_COLOR);
|
|
167
176
|
const filtered = entry.layers.filter(
|
|
168
177
|
(l) => l.className !== "DrawingLayers.fill" && l.className !== "DrawingLayers.cut"
|
|
169
178
|
);
|
|
@@ -187,10 +196,6 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
187
196
|
...filtered
|
|
188
197
|
];
|
|
189
198
|
}
|
|
190
|
-
/** Re-apply the 3D highlight (mesh fill color) for a single IFC class on
|
|
191
|
-
* the active model, scoped to the active storey. Called after the user
|
|
192
|
-
* edits a layer color in the sidebar so the 3D underlay stays in sync
|
|
193
|
-
* with the line color. */
|
|
194
199
|
async _updateClassHighlight(entry, className, color) {
|
|
195
200
|
const fragments = this.components.get(OBC.FragmentsManager);
|
|
196
201
|
const model = fragments.list.get(entry.modelId);
|
|
@@ -228,9 +233,6 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
228
233
|
);
|
|
229
234
|
}
|
|
230
235
|
}
|
|
231
|
-
/** Change the 3D fill color for ALL fill-group items (slabs / roofs) on
|
|
232
|
-
* the active entry. Updates the layer metadata so the sidebar swatch
|
|
233
|
-
* reflects the change immediately. */
|
|
234
236
|
async setFillGroupColor(entryId, color) {
|
|
235
237
|
const entry = this._entries.get(entryId);
|
|
236
238
|
if (!entry) return;
|
|
@@ -239,330 +241,109 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
239
241
|
if (meta) meta.color = color;
|
|
240
242
|
this.onLayersChanged.trigger(entry);
|
|
241
243
|
}
|
|
242
|
-
/** Change the 3D cut color for ALL cut-group items (walls / columns /
|
|
243
|
-
* curtain walls) on the active entry. */
|
|
244
244
|
async setCutGroupColor(entryId, color) {
|
|
245
245
|
const entry = this._entries.get(entryId);
|
|
246
246
|
if (!entry) return;
|
|
247
247
|
await this.renderer.setCutColor(entryId, color);
|
|
248
|
+
this.cutFill.setColor(color);
|
|
249
|
+
requestPlanRender(this.components);
|
|
248
250
|
const meta = entry.layers.find((l) => l.className === "DrawingLayers.cut");
|
|
249
251
|
if (meta) meta.color = color;
|
|
250
252
|
this.onLayersChanged.trigger(entry);
|
|
251
253
|
}
|
|
252
|
-
/** Current true-north rotation (degrees, clockwise from default up). */
|
|
253
|
-
get northAngle() {
|
|
254
|
-
return this._northAngle;
|
|
255
|
-
}
|
|
256
|
-
/** True while the line-pick mode is awaiting a click on the drawing. */
|
|
257
254
|
get isPickingNorth() {
|
|
258
255
|
return this._pickingNorth;
|
|
259
256
|
}
|
|
260
|
-
/**
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (this._northAngle === normalized) return;
|
|
266
|
-
this._northAngle = normalized;
|
|
267
|
-
this.onNorthAngleChanged.trigger(normalized);
|
|
268
|
-
if (this._activeId) this._applyNorthToCamera();
|
|
269
|
-
}
|
|
270
|
-
/** Enter two-point draw mode. The user clicks two points on the active
|
|
271
|
-
* floorplan (each snapped to the nearest projected-geometry vertex); the
|
|
272
|
-
* bearing of the segment between them becomes the new true-north angle.
|
|
273
|
-
* A rubber-band preview + snap marker track the cursor; Esc cancels.
|
|
274
|
-
* No-op if no floorplan is active. */
|
|
275
|
-
startPickNorth() {
|
|
276
|
-
if (this._pickingNorth || !this._activeId) return;
|
|
277
|
-
const entry = this.activeDrawing;
|
|
278
|
-
const world = this.components.get(CurrentWorld).world;
|
|
279
|
-
if (!(entry == null ? void 0 : entry.drawing) || !(world == null ? void 0 : world.renderer)) return;
|
|
280
|
-
const canvas = world.renderer.three.domElement;
|
|
281
|
-
this._drawStart = null;
|
|
282
|
-
this._snapVerts = this._collectSnapVertices(entry);
|
|
283
|
-
this._pickHandler = (e) => this._onPickClick(e);
|
|
284
|
-
this._moveHandler = (e) => this._onPickMove(e);
|
|
285
|
-
this._keyHandler = (e) => {
|
|
286
|
-
if (e.key === "Escape") this.cancelPickNorth();
|
|
287
|
-
};
|
|
288
|
-
canvas.addEventListener("click", this._pickHandler);
|
|
289
|
-
canvas.addEventListener("mousemove", this._moveHandler);
|
|
290
|
-
window.addEventListener("keydown", this._keyHandler);
|
|
291
|
-
this._savedPickCursor = canvas.style.cursor;
|
|
292
|
-
canvas.style.cursor = "crosshair";
|
|
257
|
+
/** Two clicks on the open plan, resolving the segment's ends, or null when cancelled or no plan is open. */
|
|
258
|
+
async pickNorthLine() {
|
|
259
|
+
if (this._pickingNorth || !this.activeDrawing) return null;
|
|
260
|
+
const picked = this.sketch.start("segment");
|
|
261
|
+
if (!this.sketch.isActive) return null;
|
|
293
262
|
this._pickingNorth = true;
|
|
294
263
|
this.onPickingNorthChanged.trigger(true);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const world = this.components.get(CurrentWorld).world;
|
|
302
|
-
const canvas = (_b = (_a = world == null ? void 0 : world.renderer) == null ? void 0 : _a.three.domElement) != null ? _b : null;
|
|
303
|
-
if (canvas) {
|
|
304
|
-
if (this._pickHandler) canvas.removeEventListener("click", this._pickHandler);
|
|
305
|
-
if (this._moveHandler) canvas.removeEventListener("mousemove", this._moveHandler);
|
|
306
|
-
canvas.style.cursor = (_c = this._savedPickCursor) != null ? _c : "grab";
|
|
307
|
-
}
|
|
308
|
-
this._savedPickCursor = null;
|
|
309
|
-
if (this._keyHandler) window.removeEventListener("keydown", this._keyHandler);
|
|
310
|
-
this._pickHandler = null;
|
|
311
|
-
this._moveHandler = null;
|
|
312
|
-
this._keyHandler = null;
|
|
313
|
-
this._drawStart = null;
|
|
314
|
-
this._snapVerts = null;
|
|
315
|
-
this._clearPreview();
|
|
316
|
-
this._pickingNorth = false;
|
|
317
|
-
this.onPickingNorthChanged.trigger(false);
|
|
318
|
-
}
|
|
319
|
-
/** Click handler for draw mode. First click places the start point; the
|
|
320
|
-
* second rotates the view so the drawn segment becomes parallel to the
|
|
321
|
-
* screen X-axis (horizontal). Both points lie on the drawing's horizontal
|
|
322
|
-
* plane (Y=0), so only the in-plane direction matters. */
|
|
323
|
-
_onPickClick(event) {
|
|
324
|
-
const entry = this.activeDrawing;
|
|
325
|
-
if (!(entry == null ? void 0 : entry.drawing)) return;
|
|
326
|
-
const local = this._eventToLocalPoint(event, entry);
|
|
327
|
-
if (!local) return;
|
|
328
|
-
const point = this._snap(local);
|
|
329
|
-
if (!this._drawStart) {
|
|
330
|
-
this._drawStart = point;
|
|
331
|
-
this._updatePreview(entry, point);
|
|
332
|
-
this._requestUpdate();
|
|
333
|
-
return;
|
|
264
|
+
try {
|
|
265
|
+
const points = await picked;
|
|
266
|
+
return (points == null ? void 0 : points.length) === 2 ? [points[0], points[1]] : null;
|
|
267
|
+
} finally {
|
|
268
|
+
this._pickingNorth = false;
|
|
269
|
+
this.onPickingNorthChanged.trigger(false);
|
|
334
270
|
}
|
|
335
|
-
const dx = point.x - this._drawStart.x;
|
|
336
|
-
const dz = point.z - this._drawStart.z;
|
|
337
|
-
if (dx * dx + dz * dz < 1e-6) return;
|
|
338
|
-
const drawing = entry.drawing;
|
|
339
|
-
drawing.three.updateWorldMatrix(true, false);
|
|
340
|
-
const aWorld = drawing.three.localToWorld(this._drawStart.clone());
|
|
341
|
-
const bWorld = drawing.three.localToWorld(point.clone());
|
|
342
|
-
const azimuthDeg = this._azimuthToAlignLineToX(aWorld, bWorld);
|
|
343
|
-
if (azimuthDeg !== null) this.setNorthAngle(azimuthDeg);
|
|
344
|
-
this.cancelPickNorth();
|
|
345
|
-
}
|
|
346
|
-
/** Camera azimuth (degrees) that rotates the top-down view so the world
|
|
347
|
-
* segment a→b lands parallel to the screen X-axis (horizontal).
|
|
348
|
-
*
|
|
349
|
-
* Derivation: with the standard Y-up spherical convention camera-controls
|
|
350
|
-
* uses, the camera's screen-right world direction has angle ρ = −θ + C
|
|
351
|
-
* (θ = azimuth). We measure ρ₀ and θ₀ from the live camera so C cancels —
|
|
352
|
-
* making the result independent of the drawing's orientation and the
|
|
353
|
-
* controls' up-space. We then solve ρ(θ) = λ (the segment's world angle),
|
|
354
|
-
* giving θ = ρ₀ + θ₀ − λ. Returns null if the controls are unavailable. */
|
|
355
|
-
_azimuthToAlignLineToX(aWorld, bWorld) {
|
|
356
|
-
var _a, _b;
|
|
357
|
-
const world = this.components.get(CurrentWorld).world;
|
|
358
|
-
const cam = (_a = world == null ? void 0 : world.camera) == null ? void 0 : _a.three;
|
|
359
|
-
const controls = (_b = world == null ? void 0 : world.camera) == null ? void 0 : _b.controls;
|
|
360
|
-
if (!cam || typeof (controls == null ? void 0 : controls.azimuthAngle) !== "number") return null;
|
|
361
|
-
const lx = bWorld.x - aWorld.x;
|
|
362
|
-
const lz = bWorld.z - aWorld.z;
|
|
363
|
-
if (lx * lx + lz * lz < 1e-12) return null;
|
|
364
|
-
const lambda = Math.atan2(lz, lx);
|
|
365
|
-
cam.updateMatrixWorld();
|
|
366
|
-
const e = cam.matrixWorld.elements;
|
|
367
|
-
const rho0 = Math.atan2(e[2], e[0]);
|
|
368
|
-
const theta0 = controls.azimuthAngle;
|
|
369
|
-
return (rho0 + theta0 - lambda) * 180 / Math.PI;
|
|
370
|
-
}
|
|
371
|
-
/** Mousemove handler for draw mode — keeps the snap marker (and, after the
|
|
372
|
-
* first click, the rubber-band line) glued to the cursor's snapped point. */
|
|
373
|
-
_onPickMove(event) {
|
|
374
|
-
const entry = this.activeDrawing;
|
|
375
|
-
if (!(entry == null ? void 0 : entry.drawing)) return;
|
|
376
|
-
const local = this._eventToLocalPoint(event, entry);
|
|
377
|
-
if (!local) return;
|
|
378
|
-
this._updatePreview(entry, this._snap(local));
|
|
379
|
-
this._requestUpdate();
|
|
380
|
-
}
|
|
381
|
-
/** Convert a canvas mouse event into a point on the drawing plane, in
|
|
382
|
-
* drawing-local space (XZ plane, Y=0). Casts a ray from the active camera,
|
|
383
|
-
* transforms it into the drawing's local frame, and intersects Y=0. */
|
|
384
|
-
_eventToLocalPoint(event, entry) {
|
|
385
|
-
const world = this.components.get(CurrentWorld).world;
|
|
386
|
-
if (!(world == null ? void 0 : world.renderer) || !world.camera || !entry.drawing) return null;
|
|
387
|
-
const canvas = world.renderer.three.domElement;
|
|
388
|
-
const rect = canvas.getBoundingClientRect();
|
|
389
|
-
const x = (event.clientX - rect.left) / rect.width * 2 - 1;
|
|
390
|
-
const y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
|
|
391
|
-
const raycaster = new THREE.Raycaster();
|
|
392
|
-
raycaster.setFromCamera(
|
|
393
|
-
new THREE.Vector2(x, y),
|
|
394
|
-
world.camera.three
|
|
395
|
-
);
|
|
396
|
-
const drawing = entry.drawing;
|
|
397
|
-
drawing.three.updateWorldMatrix(true, false);
|
|
398
|
-
const inv = new THREE.Matrix4().copy(drawing.three.matrixWorld).invert();
|
|
399
|
-
const origin = raycaster.ray.origin.clone().applyMatrix4(inv);
|
|
400
|
-
const dir = raycaster.ray.direction.clone().transformDirection(inv);
|
|
401
|
-
if (Math.abs(dir.y) < 1e-9) return null;
|
|
402
|
-
const t = -origin.y / dir.y;
|
|
403
|
-
if (!Number.isFinite(t)) return null;
|
|
404
|
-
return new THREE.Vector3(
|
|
405
|
-
origin.x + dir.x * t,
|
|
406
|
-
0,
|
|
407
|
-
origin.z + dir.z * t
|
|
408
|
-
);
|
|
409
271
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
_snap(local) {
|
|
413
|
-
const verts = this._snapVerts;
|
|
414
|
-
if (!verts) return local;
|
|
415
|
-
const radius = this._snapRadiusLocal();
|
|
416
|
-
let best = -1;
|
|
417
|
-
let bestD2 = radius * radius;
|
|
418
|
-
for (let i = 0; i < verts.length; i += 2) {
|
|
419
|
-
const dx = verts[i] - local.x;
|
|
420
|
-
const dz = verts[i + 1] - local.z;
|
|
421
|
-
const d2 = dx * dx + dz * dz;
|
|
422
|
-
if (d2 < bestD2) {
|
|
423
|
-
bestD2 = d2;
|
|
424
|
-
best = i;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
if (best < 0) return local;
|
|
428
|
-
return new THREE.Vector3(verts[best], 0, verts[best + 1]);
|
|
272
|
+
cancelPickNorth() {
|
|
273
|
+
if (this._pickingNorth) this.sketch.cancel();
|
|
429
274
|
}
|
|
430
|
-
/**
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
return worldPerPixel * SNAP_PX || FALLBACK;
|
|
444
|
-
}
|
|
445
|
-
/** Flatten every visible projected line vertex into drawing-local [x,z]
|
|
446
|
-
* pairs for endpoint snapping. Each vertex is transformed through its
|
|
447
|
-
* owning object's world matrix into the drawing's local frame, so it
|
|
448
|
-
* works regardless of how layers nest the `LineSegments`. */
|
|
449
|
-
_collectSnapVertices(entry) {
|
|
275
|
+
/** Re-projects a model's plans after its transform changed, reopening its open storey. */
|
|
276
|
+
async refreshModel(modelId) {
|
|
277
|
+
var _a;
|
|
278
|
+
const reopen = ((_a = this.activeDrawing) == null ? void 0 : _a.modelId) === modelId ? this.activeDrawing : null;
|
|
279
|
+
if (reopen) await this.deactivate();
|
|
280
|
+
this.disposeEntriesForModel(modelId);
|
|
281
|
+
await this.generate(modelId);
|
|
282
|
+
if (!reopen) return;
|
|
283
|
+
await this.activate(reopen.id);
|
|
284
|
+
if (reopen.projected) await this.generateLines(reopen.id);
|
|
285
|
+
}
|
|
286
|
+
// Every visible projected line as world `[x0, z0, x1, z1, …]`, for snapping sketch points to walls and corners.
|
|
287
|
+
_collectSnapSegments(entry) {
|
|
450
288
|
const drawing = entry.drawing;
|
|
451
289
|
if (!drawing) return null;
|
|
452
290
|
drawing.three.updateWorldMatrix(true, true);
|
|
453
|
-
const inv = new THREE.Matrix4().copy(drawing.three.matrixWorld).invert();
|
|
454
291
|
const v = new THREE.Vector3();
|
|
455
292
|
const out = [];
|
|
456
293
|
drawing.three.traverse((child) => {
|
|
457
|
-
var _a, _b
|
|
294
|
+
var _a, _b;
|
|
458
295
|
if (!(child instanceof THREE.LineSegments) || !child.visible) return;
|
|
459
296
|
if ((_a = child.userData) == null ? void 0 : _a.isDimension) return;
|
|
460
|
-
const
|
|
297
|
+
const geometry = child.geometry;
|
|
298
|
+
const pos = (_b = geometry == null ? void 0 : geometry.attributes) == null ? void 0 : _b.position;
|
|
461
299
|
if (!pos) return;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
300
|
+
const index = geometry == null ? void 0 : geometry.index;
|
|
301
|
+
const count = index ? index.count : pos.count;
|
|
302
|
+
for (let i = 0; i + 1 < count; i += 2) {
|
|
303
|
+
for (const j of [i, i + 1]) {
|
|
304
|
+
const vertex = index ? index.getX(j) : j;
|
|
305
|
+
v.set(pos.getX(vertex), pos.getY(vertex), pos.getZ(vertex)).applyMatrix4(child.matrixWorld);
|
|
306
|
+
out.push(v.x, v.z);
|
|
307
|
+
}
|
|
465
308
|
}
|
|
466
309
|
});
|
|
467
310
|
return out.length ? new Float32Array(out) : null;
|
|
468
311
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
* live in drawing-local space, Y=0. */
|
|
472
|
-
_updatePreview(entry, current) {
|
|
473
|
-
const drawing = entry.drawing;
|
|
474
|
-
if (!drawing) return;
|
|
475
|
-
const COLOR = 2450411;
|
|
476
|
-
if (!this._snapMarker) {
|
|
477
|
-
const geom = new THREE.BufferGeometry();
|
|
478
|
-
geom.setAttribute(
|
|
479
|
-
"position",
|
|
480
|
-
new THREE.Float32BufferAttribute(
|
|
481
|
-
new Float32Array([-1, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 1]),
|
|
482
|
-
3
|
|
483
|
-
)
|
|
484
|
-
);
|
|
485
|
-
this._snapMarker = new THREE.LineSegments(
|
|
486
|
-
geom,
|
|
487
|
-
new THREE.LineBasicMaterial({ color: COLOR })
|
|
488
|
-
);
|
|
489
|
-
this._snapMarker.renderOrder = 999;
|
|
490
|
-
drawing.three.add(this._snapMarker);
|
|
491
|
-
}
|
|
492
|
-
const arm = this._snapRadiusLocal();
|
|
493
|
-
this._snapMarker.scale.setScalar(arm);
|
|
494
|
-
this._snapMarker.position.set(current.x, 0, current.z);
|
|
495
|
-
this._snapMarker.visible = true;
|
|
496
|
-
if (!this._drawStart) {
|
|
497
|
-
if (this._previewLine) this._previewLine.visible = false;
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
if (!this._previewLine) {
|
|
501
|
-
const geom = new THREE.BufferGeometry();
|
|
502
|
-
geom.setAttribute(
|
|
503
|
-
"position",
|
|
504
|
-
new THREE.Float32BufferAttribute(new Float32Array(6), 3)
|
|
505
|
-
);
|
|
506
|
-
this._previewLine = new THREE.Line(
|
|
507
|
-
geom,
|
|
508
|
-
new THREE.LineBasicMaterial({ color: COLOR })
|
|
509
|
-
);
|
|
510
|
-
this._previewLine.renderOrder = 999;
|
|
511
|
-
drawing.three.add(this._previewLine);
|
|
512
|
-
}
|
|
513
|
-
const pos = this._previewLine.geometry.attributes.position;
|
|
514
|
-
pos.setXYZ(0, this._drawStart.x, 0, this._drawStart.z);
|
|
515
|
-
pos.setXYZ(1, current.x, 0, current.z);
|
|
516
|
-
pos.needsUpdate = true;
|
|
517
|
-
this._previewLine.visible = true;
|
|
518
|
-
}
|
|
519
|
-
/** Remove + dispose the preview line and snap marker. Uses each object's
|
|
520
|
-
* own parent so it stays correct even when called from deactivate(),
|
|
521
|
-
* where `_activeId` is already null. */
|
|
522
|
-
_clearPreview() {
|
|
523
|
-
var _a, _b;
|
|
524
|
-
if (this._previewLine) {
|
|
525
|
-
(_a = this._previewLine.parent) == null ? void 0 : _a.remove(this._previewLine);
|
|
526
|
-
this._previewLine.geometry.dispose();
|
|
527
|
-
const m = this._previewLine.material;
|
|
528
|
-
if (!Array.isArray(m)) m.dispose();
|
|
529
|
-
this._previewLine = null;
|
|
530
|
-
}
|
|
531
|
-
if (this._snapMarker) {
|
|
532
|
-
(_b = this._snapMarker.parent) == null ? void 0 : _b.remove(this._snapMarker);
|
|
533
|
-
this._snapMarker.geometry.dispose();
|
|
534
|
-
const m = this._snapMarker.material;
|
|
535
|
-
if (!Array.isArray(m)) m.dispose();
|
|
536
|
-
this._snapMarker = null;
|
|
537
|
-
}
|
|
538
|
-
this._requestUpdate();
|
|
539
|
-
}
|
|
540
|
-
/** Push `_northAngle` into the camera-controls azimuth so the view
|
|
541
|
-
* rotates around the active floor's centre. Called on every activate
|
|
542
|
-
* and whenever the angle changes while a floorplan is active. */
|
|
543
|
-
_applyNorthToCamera() {
|
|
312
|
+
// Zero azimuth puts world X across the screen, so a model turned to project north reads square.
|
|
313
|
+
_squareCameraToAxes() {
|
|
544
314
|
var _a;
|
|
545
315
|
const world = this.components.get(CurrentWorld).world;
|
|
546
316
|
if (!((_a = world == null ? void 0 : world.camera) == null ? void 0 : _a.controls)) return;
|
|
547
317
|
const controls = world.camera.controls;
|
|
548
|
-
const radians = this._northAngle * Math.PI / 180;
|
|
549
318
|
if (typeof controls.rotateAzimuthTo === "function") {
|
|
550
|
-
void pumpCameraTransition(this.components, controls.rotateAzimuthTo(
|
|
319
|
+
void pumpCameraTransition(this.components, controls.rotateAzimuthTo(0, true));
|
|
551
320
|
} else {
|
|
552
|
-
controls.azimuthAngle =
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
/** Force a render update so layer visibility/color changes paint
|
|
556
|
-
* immediately even when the camera is at rest. */
|
|
557
|
-
_requestUpdate() {
|
|
558
|
-
try {
|
|
559
|
-
const fragments = this.components.get(OBC.FragmentsManager);
|
|
560
|
-
void fragments.core.update(true);
|
|
561
|
-
} catch (e) {
|
|
321
|
+
controls.azimuthAngle = 0;
|
|
562
322
|
}
|
|
563
323
|
}
|
|
564
|
-
|
|
565
|
-
|
|
324
|
+
// The Elevation attribute is in the IFC's own frame, so it is shifted onto where each storey's walls actually stand.
|
|
325
|
+
async _storeyElevations(modelId, model, storeys) {
|
|
326
|
+
const anchorIds = Object.values(await model.getItemsOfCategories([/^IFCWALL/, /^IFCCOLUMN/])).flat();
|
|
327
|
+
const boxes = anchorIds.length > 0 ? await model.getBoxes(anchorIds) : [];
|
|
328
|
+
const bottomById = /* @__PURE__ */ new Map();
|
|
329
|
+
anchorIds.forEach((id, i) => {
|
|
330
|
+
const box = boxes[i];
|
|
331
|
+
if (box && !box.isEmpty()) bottomById.set(id, box.min.y);
|
|
332
|
+
});
|
|
333
|
+
const withFloors = await Promise.all(storeys.map(async (storey) => {
|
|
334
|
+
const contained = await this.projector.getCachedStoreyIds(modelId, storey.storeyLocalId, model);
|
|
335
|
+
const bottoms = contained.flatMap((id) => {
|
|
336
|
+
var _a;
|
|
337
|
+
return (_a = bottomById.get(id)) != null ? _a : [];
|
|
338
|
+
});
|
|
339
|
+
return { rawElevation: storey.rawElevation, floorY: storeyFloorY(bottoms) };
|
|
340
|
+
}));
|
|
341
|
+
const anchored = anchorStoreyElevations(withFloors);
|
|
342
|
+
if (anchored) return anchored;
|
|
343
|
+
const [, coordHeight] = await model.getCoordinates();
|
|
344
|
+
return storeys.map((s) => normalizeElevation(s.rawElevation, coordHeight, model.box.min.y, model.box.max.y));
|
|
345
|
+
}
|
|
346
|
+
/** One entry per IFC storey; drawings are projected lazily on first activation. */
|
|
566
347
|
async generate(modelId) {
|
|
567
348
|
const fragments = this.components.get(OBC.FragmentsManager);
|
|
568
349
|
const model = fragments.list.get(modelId);
|
|
@@ -578,31 +359,21 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
578
359
|
).flat();
|
|
579
360
|
if (storeyIds.length === 0) return [];
|
|
580
361
|
const storeysData = await model.getItemsData(storeyIds);
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
const
|
|
585
|
-
const created =
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
elevation,
|
|
597
|
-
storeyLocalId,
|
|
598
|
-
modelId,
|
|
599
|
-
drawing: null,
|
|
600
|
-
projected: false,
|
|
601
|
-
layers: []
|
|
602
|
-
};
|
|
603
|
-
this._entries.set(entry.id, entry);
|
|
604
|
-
created.push(entry);
|
|
605
|
-
}
|
|
362
|
+
const storeys = storeysData.flatMap(
|
|
363
|
+
(storey, i) => "value" in storey.Name && "value" in storey.Elevation ? [{ name: String(storey.Name.value), rawElevation: Number(storey.Elevation.value), storeyLocalId: storeyIds[i] }] : []
|
|
364
|
+
);
|
|
365
|
+
const elevations = await this._storeyElevations(modelId, model, storeys);
|
|
366
|
+
const created = storeys.map((storey, i) => ({
|
|
367
|
+
id: `${modelId}::${storey.name}`,
|
|
368
|
+
name: storey.name,
|
|
369
|
+
elevation: elevations[i],
|
|
370
|
+
storeyLocalId: storey.storeyLocalId,
|
|
371
|
+
modelId,
|
|
372
|
+
drawing: null,
|
|
373
|
+
projected: false,
|
|
374
|
+
layers: []
|
|
375
|
+
}));
|
|
376
|
+
for (const entry of created) this._entries.set(entry.id, entry);
|
|
606
377
|
this.onDrawingsChanged.trigger(this.drawings);
|
|
607
378
|
return created;
|
|
608
379
|
} finally {
|
|
@@ -627,6 +398,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
627
398
|
try {
|
|
628
399
|
if (!wasActive) {
|
|
629
400
|
this.chrome.applyLighting();
|
|
401
|
+
this.chrome.applyBasicRender();
|
|
630
402
|
this.chrome.applyDrawingBackground();
|
|
631
403
|
this.camera.lock(0);
|
|
632
404
|
this.chrome.setCursor();
|
|
@@ -648,12 +420,17 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
648
420
|
}
|
|
649
421
|
this._frameCamera(entry);
|
|
650
422
|
this._activeId = id;
|
|
423
|
+
this.sketch.cancel();
|
|
424
|
+
this.editor.cancel();
|
|
425
|
+
this.overlay.show(storeyCutPlaneY(entry.elevation) - PLAN_OVERLAY_OFFSET);
|
|
651
426
|
this.onActiveDrawingChanged.trigger(entry);
|
|
652
427
|
await this.renderer.apply(entry, (stage) => {
|
|
653
428
|
if (seq !== this._activateSeq) return;
|
|
654
429
|
this._emit({ isLoading: true, stage });
|
|
655
430
|
});
|
|
656
431
|
if (seq !== this._activateSeq) return;
|
|
432
|
+
await safeRunAsync(() => this.cutFill.show(sourceWorld, storeyCutPlaneY(entry.elevation), this._cutColor()), "showCutFill");
|
|
433
|
+
if (seq !== this._activateSeq) return;
|
|
657
434
|
await this._showDrawing(entry, seq);
|
|
658
435
|
if (seq !== this._activateSeq) return;
|
|
659
436
|
this._emit({ isLoading: false, stage: "done" });
|
|
@@ -667,6 +444,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
667
444
|
* the projection dominates its cost and a plan reads without it.
|
|
668
445
|
*/
|
|
669
446
|
async generateLines(id) {
|
|
447
|
+
var _a;
|
|
670
448
|
const entry = this._entries.get(id);
|
|
671
449
|
if (!entry || entry.projected) return;
|
|
672
450
|
if (this._activeId !== id) return;
|
|
@@ -674,9 +452,12 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
674
452
|
this._emit({ isLoading: true, stage: "project" });
|
|
675
453
|
try {
|
|
676
454
|
await this.projector.project(entry);
|
|
455
|
+
(_a = entry.spaces) == null ? void 0 : _a.setHidden(this.overlay.replacedSpaces(entry.modelId));
|
|
677
456
|
if (seq !== this._activateSeq) return;
|
|
678
|
-
await this._showDrawing(entry, seq);
|
|
457
|
+
await this._showDrawing(entry, seq, false);
|
|
679
458
|
if (seq !== this._activateSeq) return;
|
|
459
|
+
this.sketch.refreshSnapTargets();
|
|
460
|
+
this.editor.refreshSnapTargets();
|
|
680
461
|
this.onLayersChanged.trigger(entry);
|
|
681
462
|
this._emit({ isLoading: false, stage: "done" });
|
|
682
463
|
} catch (error) {
|
|
@@ -684,24 +465,23 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
684
465
|
this._emit({ isLoading: false });
|
|
685
466
|
}
|
|
686
467
|
}
|
|
687
|
-
|
|
468
|
+
// Lines generated on an open plan leave the camera alone: the user may already have panned or zoomed.
|
|
469
|
+
async _showDrawing(entry, seq, fit = true) {
|
|
688
470
|
const editor = this.components.get(OBF.DrawingEditor);
|
|
689
471
|
editor.activeDrawing = entry.drawing;
|
|
690
472
|
if (entry.drawing) entry.drawing.three.visible = true;
|
|
691
|
-
await safeRunAsync(() => this._fitToDrawing(entry), "fitToDrawing");
|
|
473
|
+
if (fit) await safeRunAsync(() => this._fitToDrawing(entry), "fitToDrawing");
|
|
692
474
|
if (seq !== this._activateSeq) return;
|
|
693
475
|
this._injectGroupColorLayers(entry);
|
|
694
476
|
}
|
|
695
|
-
/**
|
|
696
|
-
* Exit floorplan mode. Each cleanup step is independently guarded so a
|
|
697
|
-
* failure in one (e.g. resetHighlight on a huge model) cannot strand
|
|
698
|
-
* camera, clip, or gizmo state.
|
|
699
|
-
*/
|
|
477
|
+
/** Each cleanup step is guarded on its own, so one failure cannot strand camera, clip or gizmo state. */
|
|
700
478
|
async deactivate() {
|
|
701
479
|
if (!this._activeId) return;
|
|
702
480
|
this._activeId = null;
|
|
481
|
+
safeRun(() => this.sketch.cancel(), "cancelSketch");
|
|
482
|
+
safeRun(() => this.editor.cancel(), "cancelShapeEdit");
|
|
483
|
+
safeRun(() => this.overlay.hide(), "hideOverlay");
|
|
703
484
|
this.onActiveDrawingChanged.trigger(null);
|
|
704
|
-
safeRun(() => this.cancelPickNorth(), "cancelPickNorth");
|
|
705
485
|
safeRun(() => {
|
|
706
486
|
const editor = this.components.get(OBF.DrawingEditor);
|
|
707
487
|
editor.activeDrawing = null;
|
|
@@ -713,6 +493,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
713
493
|
}, "hide drawing");
|
|
714
494
|
}
|
|
715
495
|
}
|
|
496
|
+
safeRun(() => this.cutFill.hide(), "hideCutFill");
|
|
716
497
|
safeRun(() => this.clip.removeAll(), "removeClips");
|
|
717
498
|
safeRun(() => this.grid.restore(), "showGrid");
|
|
718
499
|
safeRun(() => this.camera.unlock(), "unlockCamera");
|
|
@@ -720,6 +501,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
720
501
|
safeRun(() => this.chrome.restoreHighlighter(), "restoreHighlighter");
|
|
721
502
|
safeRun(() => this.chrome.showGizmo(), "showGizmo");
|
|
722
503
|
safeRun(() => this.chrome.removeLighting(), "removeLighting");
|
|
504
|
+
safeRun(() => this.chrome.restoreRenderMode(), "restoreRenderMode");
|
|
723
505
|
safeRun(() => this.chrome.restoreBackground(), "restoreBackground");
|
|
724
506
|
safeRun(() => this.chrome.restoreSceneContent(), "restoreSceneContent");
|
|
725
507
|
await safeRunAsync(() => this.renderer.restore(), "restoreModelRendering");
|
|
@@ -743,10 +525,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
743
525
|
this.projector.invalidateForModel(modelId);
|
|
744
526
|
if (touched) this.onDrawingsChanged.trigger(this.drawings);
|
|
745
527
|
}
|
|
746
|
-
/**
|
|
747
|
-
* Building-scoped teardown: frees every drawing and the north angle while
|
|
748
|
-
* keeping the model subscriptions, so the tool serves the next building.
|
|
749
|
-
*/
|
|
528
|
+
/** Frees every drawing but keeps the model subscriptions, so the tool serves the next building. */
|
|
750
529
|
resetAll() {
|
|
751
530
|
this._activateSeq++;
|
|
752
531
|
void this.deactivate();
|
|
@@ -764,12 +543,13 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
764
543
|
this.renderer.invalidateForModel(entry.modelId);
|
|
765
544
|
}
|
|
766
545
|
this._entries.clear();
|
|
767
|
-
this.
|
|
768
|
-
this.onNorthAngleChanged.trigger(0);
|
|
546
|
+
safeRun(() => this.overlay.clearAll(), "clearOverlay");
|
|
769
547
|
this.onDrawingsChanged.trigger([]);
|
|
770
548
|
}
|
|
771
549
|
dispose() {
|
|
772
550
|
void this.deactivate();
|
|
551
|
+
safeRun(() => this.overlay.clearAll(), "clearOverlay");
|
|
552
|
+
safeRun(() => this.cutFill.dispose(), "disposeCutFill");
|
|
773
553
|
safeRun(
|
|
774
554
|
() => this.components.get(OBC.FragmentsManager).list.onItemDeleted.remove(this.onModelRemoved),
|
|
775
555
|
"unsubscribeModelRemoved"
|
|
@@ -787,8 +567,6 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
787
567
|
_emit(state) {
|
|
788
568
|
this.onGenerationStateChanged.trigger(state);
|
|
789
569
|
}
|
|
790
|
-
/** Mutual-exclusion claim. If ElevationsTool (or any other view tool)
|
|
791
|
-
* was active, the coordinator awaits its deactivate() first. */
|
|
792
570
|
async _tryClaimCoordinator() {
|
|
793
571
|
try {
|
|
794
572
|
const coordinator = this.components.get(ViewModeCoordinator);
|
|
@@ -802,9 +580,7 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
802
580
|
} catch (e) {
|
|
803
581
|
}
|
|
804
582
|
}
|
|
805
|
-
|
|
806
|
-
* so ceiling fixtures / lights / equipment of the storey below never
|
|
807
|
-
* bleed into the projection or the 3D underlay. */
|
|
583
|
+
// Just under the active floor's slab, so the storey below's ceiling fixtures never reach the plan.
|
|
808
584
|
_applyLowerClip(entry) {
|
|
809
585
|
const cutY = storeyLowerClipY(entry.elevation);
|
|
810
586
|
this.clip.set(
|
|
@@ -813,20 +589,37 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
813
589
|
new THREE.Vector3(0, cutY, 0)
|
|
814
590
|
);
|
|
815
591
|
}
|
|
816
|
-
//
|
|
592
|
+
// The camera squares up first: the fit uses an axis-aligned box, so rotating after it could push content out of frame.
|
|
817
593
|
async _fitToDrawing(entry) {
|
|
818
|
-
var _a;
|
|
819
594
|
if (!entry.drawing) return;
|
|
820
595
|
const box = new THREE.Box3().setFromObject(entry.drawing.three);
|
|
821
596
|
if (box.isEmpty()) {
|
|
822
597
|
this._frameCamera(entry);
|
|
823
598
|
return;
|
|
824
599
|
}
|
|
825
|
-
this.
|
|
826
|
-
|
|
827
|
-
|
|
600
|
+
this._squareCameraToAxes();
|
|
601
|
+
await this._fitPlanBox(box);
|
|
602
|
+
}
|
|
603
|
+
/** Fits the open plan's view to an outline in world plan coordinates; no-op with no plan open. */
|
|
604
|
+
async framePoints(points, padding = 0.25) {
|
|
605
|
+
const planY = this.activePlanY;
|
|
606
|
+
if (planY === null || points.length === 0) return;
|
|
607
|
+
const box = new THREE.Box3().setFromPoints(points.map((point) => new THREE.Vector3(point.x, planY, point.z)));
|
|
608
|
+
box.expandByScalar(Math.max(box.max.x - box.min.x, box.max.z - box.min.z, 1) * padding);
|
|
609
|
+
await safeRunAsync(() => this._fitPlanBox(box), "framePoints");
|
|
610
|
+
}
|
|
611
|
+
// An orthographic plan's scale is its zoom, not its distance, so framing has to go through fitToBox.
|
|
612
|
+
async _fitPlanBox(box) {
|
|
613
|
+
var _a, _b;
|
|
614
|
+
const controls = (_b = (_a = this.components.get(CurrentWorld).world) == null ? void 0 : _a.camera) == null ? void 0 : _b.controls;
|
|
828
615
|
if (!controls) return;
|
|
829
|
-
|
|
616
|
+
const pad = Math.max(box.max.x - box.min.x, box.max.z - box.min.z) * FIT_PADDING;
|
|
617
|
+
await pumpCameraTransition(this.components, controls.fitToBox(box, true, {
|
|
618
|
+
paddingTop: pad,
|
|
619
|
+
paddingBottom: pad,
|
|
620
|
+
paddingLeft: pad,
|
|
621
|
+
paddingRight: pad
|
|
622
|
+
}));
|
|
830
623
|
}
|
|
831
624
|
_frameCamera(entry) {
|
|
832
625
|
const fragments = this.components.get(OBC.FragmentsManager);
|
|
@@ -843,7 +636,12 @@ const _FloorplanTool = class _FloorplanTool extends OBC.Component {
|
|
|
843
636
|
center.z
|
|
844
637
|
);
|
|
845
638
|
this.camera.frame(target, new THREE.Vector3(0, -1, 0), span);
|
|
846
|
-
this.
|
|
639
|
+
this._squareCameraToAxes();
|
|
640
|
+
const storey = new THREE.Box3(
|
|
641
|
+
new THREE.Vector3(model.box.min.x, entry.elevation, model.box.min.z),
|
|
642
|
+
new THREE.Vector3(model.box.max.x, entry.elevation + 1.2, model.box.max.z)
|
|
643
|
+
);
|
|
644
|
+
void safeRunAsync(() => this._fitPlanBox(storey), "fitToModel");
|
|
847
645
|
}
|
|
848
646
|
};
|
|
849
647
|
_FloorplanTool.uuid = FLOORPLAN_TOOL_UUID;
|