bimatter-viewer-react 0.8.1 → 0.8.3

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.
@@ -10,11 +10,13 @@ import type { BmtConversionResult, BmtConverterOptions, BmtConverterSource } fro
10
10
  import { FilteredElementsCollector } from "../Selector/FilteredElementsCollector";
11
11
  import type { ViewerLoadedModels, ViewerLoadModelOptions, ViewerModelSource } from "./loader";
12
12
  import type { WorkerProgressEvent } from "../workers";
13
+ import { type ViewerPlansApi, type ViewerPlansContainerFactory, type ViewerPlansSceneApi } from "./ViewerPlansApi";
13
14
  export type { ViewerClippingApi, ViewerClippingVector3Input, } from "../utils/ClippingUtils";
14
15
  export type { ViewerColorConfigByModel, ViewerModelColorConfig, } from "../utils/ColorsUtils/useElementColors";
15
16
  export type { ViewerDimensionsApi } from "../utils/DimentionsUtils";
16
17
  export type { ViewerCameraGetIntersection } from "../Camera/useCameraUtils";
17
18
  export type { ViewerCameraProjection } from "../types";
19
+ export type { ViewerPlanHandle, ViewerPlansApi, ViewerPlanVector3Input, } from "./ViewerPlansApi";
18
20
  export type ViewerSelection = Record<number, number[]>;
19
21
  export type ViewerGeometryUtilsApi = {
20
22
  getAllIds: () => number[];
@@ -34,14 +36,17 @@ export type ViewerGeometryUtilsApi = {
34
36
  export type ViewerSelectorApi = {
35
37
  addSelected: (modelID: number, ids: number[], setTarget?: boolean, fitTarget?: boolean) => void;
36
38
  collector: () => FilteredElementsCollector;
39
+ getPreselectionEnabled: () => boolean;
37
40
  getPreselectionColor: () => ColorRepresentation;
38
41
  getSelectionColor: () => ColorRepresentation;
39
42
  getSelected: () => ViewerSelection;
40
43
  removeSelected: (modelID: number, ids: number[]) => void;
41
44
  resetSelection: (modelID?: number) => void;
42
45
  setPreselectionColor: (color: ColorRepresentation) => void;
46
+ setPreselectionEnabled: (enabled: boolean) => void;
43
47
  setSelectionColor: (color: ColorRepresentation) => void;
44
48
  setSelected: (modelID: number, ids: number[], reset?: boolean, setTarget?: boolean, fitTarget?: boolean) => void;
49
+ togglePreselection: () => void;
45
50
  };
46
51
  export type ViewerSceneSelectorApi = {
47
52
  setTargetToSelection: (selection: ViewerSelection, fitTarget?: boolean) => void;
@@ -57,6 +62,7 @@ export type ViewerColorsApi = {
57
62
  export type ViewerUtilsApi = {
58
63
  getDefaultHotkeysEnabled: () => boolean;
59
64
  getGridAxesVisibility: () => ViewerGridAxesVisibility;
65
+ getPreselectionEnabled: () => boolean;
60
66
  getShowNavCube: () => boolean;
61
67
  getShowGridAxes: () => boolean;
62
68
  getShowStats: () => boolean;
@@ -67,7 +73,9 @@ export type ViewerUtilsApi = {
67
73
  setGridAxisVisibility: (side: ViewerGridAxisSide, visible: boolean) => void;
68
74
  setPerformaneMovingFactor: (factor: number) => void;
69
75
  setPerformanceMovingFactor: (factor: number) => void;
76
+ setPreselectionEnabled: (enabled: boolean) => void;
70
77
  toggleDefaultHotkeys: () => void;
78
+ togglePreselection: () => void;
71
79
  setShowNavCube: (showNavCube: boolean) => void;
72
80
  setShowGridAxes: (showGridAxes: boolean) => void;
73
81
  setShowStats: (showStats: boolean) => void;
@@ -124,6 +132,7 @@ export type ViewerApi = {
124
132
  dimensions: ViewerDimensionsApi;
125
133
  geometryUtils: ViewerGeometryUtilsApi;
126
134
  models: ViewerModelsApi;
135
+ plans: ViewerPlansApi;
127
136
  postproduction: ViewerPostproductionApi;
128
137
  properties: ViewerPropertiesApi;
129
138
  selector: ViewerSelectorApi;
@@ -136,8 +145,9 @@ export type ViewerSceneApi = {
136
145
  converter: ViewerConverterApi;
137
146
  dimensions: ViewerDimensionsApi;
138
147
  geometryUtils: ViewerGeometryUtilsApi;
148
+ plans: ViewerPlansSceneApi;
139
149
  selector: ViewerSceneSelectorApi;
140
150
  };
141
151
  export declare function serializeSelected(selected: SelectedStore): ViewerSelection;
142
152
  export declare function createSelectedStore(selection: ViewerSelection): SelectedStore;
143
- export declare function createPublicViewerApi(viewerStore: ViewerStoreApi, getSceneApi: () => ViewerSceneApi | null, getModelsApi: () => ViewerModelsApi | null): ViewerApi;
153
+ export declare function createPublicViewerApi(viewerStore: ViewerStoreApi, getSceneApi: () => ViewerSceneApi | null, getModelsApi: () => ViewerModelsApi | null, getPlansContainerFactory?: () => ViewerPlansContainerFactory | null): ViewerApi;
@@ -0,0 +1,24 @@
1
+ import { Plane, Vector3 } from "three";
2
+ import type { ViewerApi, ViewerSceneApi } from "./ViewerApi";
3
+ export type ViewerPlanVector3Input = Vector3 | [number, number, number] | {
4
+ x: number;
5
+ y: number;
6
+ z: number;
7
+ };
8
+ export type ViewerPlanHandle = {
9
+ container?: HTMLElement;
10
+ dispose: () => void;
11
+ plane: Plane;
12
+ viewer?: ViewerApi | null;
13
+ };
14
+ export type ViewerPlansSceneApi = {
15
+ createPlan: (plane: Plane) => ViewerPlanHandle | null;
16
+ };
17
+ export type ViewerPlansContainerFactory = (plane: Plane, container: HTMLElement) => ViewerPlanHandle | null;
18
+ export type ViewerPlansApi = {
19
+ createPlan: ((plane: Plane, container?: HTMLElement) => ViewerPlanHandle | null) & ((point: ViewerPlanVector3Input, normal: ViewerPlanVector3Input, container?: HTMLElement) => ViewerPlanHandle | null) & ((zCord: number, normal: ViewerPlanVector3Input, container?: HTMLElement) => ViewerPlanHandle | null);
20
+ };
21
+ export declare function createViewerPlanPlane(plane: Plane): Plane;
22
+ export declare function createViewerPlanPlane(point: ViewerPlanVector3Input, normal: ViewerPlanVector3Input): Plane;
23
+ export declare function createViewerPlanPlane(zCord: number, normal: ViewerPlanVector3Input): Plane;
24
+ export declare function createViewerPlansApi(getSceneApi: () => ViewerSceneApi | null, getContainerFactory?: () => ViewerPlansContainerFactory | null): ViewerPlansApi;
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as Viewer } from "./Viewer";
2
2
  export type { ViewerModelsData, ViewerProps } from "./Viewer";
3
3
  export type { ViewerCameraProjection, ViewerMaterialMode, ViewerPostproductionPassType, ViewerUploadMode, } from "./types";
4
- export type { ViewerApi, ViewerCameraApi, ViewerCameraGetIntersection, ViewerClippingApi, ViewerClippingVector3Input, ViewerColorsApi, ViewerBmtConverterOptions, ViewerConverterApi, ViewerDimensionsApi, ViewerGeometryUtilsApi, ViewerLoadModelsOptions, ViewerModelsApi, ViewerPostproductionApi, ViewerSelection, ViewerSelectorApi, ViewerUtilsApi, } from "./api/ViewerApi";
4
+ export type { ViewerApi, ViewerCameraApi, ViewerCameraGetIntersection, ViewerClippingApi, ViewerClippingVector3Input, ViewerColorsApi, ViewerBmtConverterOptions, ViewerConverterApi, ViewerDimensionsApi, ViewerGeometryUtilsApi, ViewerLoadModelsOptions, ViewerModelsApi, ViewerPlanHandle, ViewerPlansApi, ViewerPlanVector3Input, ViewerPostproductionApi, ViewerSelection, ViewerSelectorApi, ViewerUtilsApi, } from "./api/ViewerApi";
5
5
  export type { ViewerModelLevel, ViewerModelLevelsByModel, ViewerPropertiesApi, ViewerPropertiesExcelOptions, } from "./api/ViewerPropertiesApi";
6
6
  export { BMTLoader } from "./Loaders/BmtLoader";
7
7
  export type { BmtGeometryChunkData, BmtParseCallbacks, BmtParseProgressData, BmtModelGeometryData, BmtGeomData, BmtIndexArray, BmtMaterialData, BmtElementProps, BmtModelData, BmtModelProps, BmtModelStructure, BmtModelStructureNode, BmtPropertyRecord, BmtPropertySet, BmtPropertyValue, } from "./Loaders/BmtLoader";