@pilotdev/pilot-web-3d 24.20.0 → 24.22.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.
Files changed (2) hide show
  1. package/index.d.ts +60 -35
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -45,7 +45,13 @@ export class Color {
45
45
  toArray(array: Array<number>, offset?: number): Array<number>;
46
46
  clone(): Color;
47
47
  }
48
- export abstract class ViewObject extends THREE.Object3D {
48
+ export interface ViewObjectEventMap extends THREE.Object3DEventMap {
49
+ dispose: object;
50
+ update: {
51
+ updateType: UpdateType;
52
+ };
53
+ }
54
+ export abstract class ViewObject extends THREE.Object3D<ViewObjectEventMap> {
49
55
  protected _isDisposed: boolean;
50
56
  protected _isSelected: boolean;
51
57
  protected _isHovered: boolean;
@@ -77,7 +83,7 @@ export abstract class ViewObject extends THREE.Object3D {
77
83
  /**Edge representation of the object */
78
84
  abstract get edges(): THREE.LineSegments | null;
79
85
  add(...object: THREE.Object3D[]): this;
80
- remove(...object: THREE.Object3D<THREE.Event>[]): this;
86
+ remove(...object: THREE.Object3D[]): this;
81
87
  updateMatrixWorld(force?: boolean): void;
82
88
  updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
83
89
  updateMatrix(): void;
@@ -656,16 +662,16 @@ export class ClickedEvent extends Event {
656
662
  modelId: string;
657
663
  modelElementId: string;
658
664
  ctrlKey: boolean;
659
- intersection?: THREE.Intersection<THREE.Object3D>;
665
+ intersection?: THREE.Intersection;
660
666
 
661
- constructor(type: string, modelId: string, modelElementId: string, ctrlKey: boolean, intersection?: THREE.Intersection<THREE.Object3D>);
667
+ constructor(type: string, modelId: string, modelElementId: string, ctrlKey: boolean, intersection?: THREE.Intersection);
662
668
  }
663
669
  export class HoverEvent extends Event {
664
670
  modelId: string;
665
671
  modelElementId: string;
666
- intersection?: THREE.Intersection<THREE.Object3D>;
672
+ intersection?: THREE.Intersection;
667
673
 
668
- constructor(type: string, modelId: string, modelElementId: string, intersection?: THREE.Intersection<THREE.Object3D>);
674
+ constructor(type: string, modelId: string, modelElementId: string, intersection?: THREE.Intersection);
669
675
  }
670
676
  export class GlobalEvents {
671
677
  static events: EventsDispatcherCore;
@@ -677,6 +683,8 @@ export class RenderViewSettings {
677
683
  displayMode?: DisplayMode;
678
684
  cameraMode?: CameraMode;
679
685
  orthoNavigationCube?: boolean;
686
+ hideSmallElements?: boolean;
687
+ smallObjectSize?: number;
680
688
  /** Desired render framerate */
681
689
  desiredFramerate?: number;
682
690
  /** Allocated time for rendering operations, excluding scene rendering */
@@ -927,12 +935,12 @@ export interface ModelCheckOptions extends SceneCheckOptions {
927
935
  }
928
936
  export interface IIntersectionChecker<TOptions> {
929
937
  /**
930
- * Gets {@link THREE.Intersection<THREE.Object3D>} between a casted {@link ray} and model object.
938
+ * Gets {@link THREE.Intersection} between a casted {@link ray} and model object.
931
939
  * @param ray
932
940
  * @param camera
933
941
  * @param options - (optional) intersection check options.
934
942
  */
935
- getIntersectionByRay(ray: THREE.Ray, camera: THREE.Camera, options?: TOptions): THREE.Intersection<THREE.Object3D> | undefined;
943
+ getIntersectionByRay(ray: THREE.Ray, camera: THREE.Camera, options?: TOptions): THREE.Intersection | undefined;
936
944
  /**
937
945
  * Gets ID of the model object intersected by {@link ray}
938
946
  * @param ray
@@ -949,7 +957,7 @@ export interface IIntersectionChecker<TOptions> {
949
957
  * @param camera
950
958
  * @param options - (optional) intersection check options.
951
959
  */
952
- getIntersectionByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera, options?: TOptions): THREE.Intersection<THREE.Object3D> | undefined;
960
+ getIntersectionByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera, options?: TOptions): THREE.Intersection | undefined;
953
961
  /**
954
962
  * Gets ID of the model object intersected by ray, casted from {@link camera} to {@link ndcPoint}.
955
963
  * @param ndcPoint
@@ -977,14 +985,20 @@ export interface IIntersectionChecker<TOptions> {
977
985
  * @param camera
978
986
  * @param options - (optional) intersection check options.
979
987
  */
980
- getAllIntersectionsByRay(ray: THREE.Ray, camera: THREE.Camera, options?: TOptions): THREE.Intersection<THREE.Object3D>[];
988
+ getAllIntersectionsByRay(ray: THREE.Ray, camera: THREE.Camera, options?: TOptions): THREE.Intersection[];
981
989
  /**
982
990
  * Gets IDs of the model objects intersected by ray, casted from {@link camera} to {@link ndcPoint}.
983
991
  * @param ndcPos
984
992
  * @param camera
985
993
  * @param options - (optional) intersection check options.
986
994
  */
987
- getAllIntersectionsByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera, options?: TOptions): THREE.Intersection<THREE.Object3D>[];
995
+ getAllIntersectionsByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera, options?: TOptions): THREE.Intersection[];
996
+ /**
997
+ * Gets bounding box of the model elements.
998
+ * @param elements
999
+ * @param options
1000
+ */
1001
+ getObjectsBoundingBox(elements: ModelElementIds[], options?: TOptions): THREE.Box3;
988
1002
  }
989
1003
  export interface ISceneIntersectionChecker extends IIntersectionChecker<SceneCheckOptions> {
990
1004
  /** Gets the bounding box of the scene*/
@@ -997,7 +1011,7 @@ export interface IModelIntersectionChecker extends IIntersectionChecker<ModelChe
997
1011
  get modelCenter(): THREE.Vector3;
998
1012
  }
999
1013
  export interface I3DRenderer {
1000
- clippingPlanes: THREE.Plane[];
1014
+ clippingPlanes: readonly THREE.Plane[];
1001
1015
  domElement: HTMLCanvasElement;
1002
1016
  clear(color?: boolean, depth?: boolean, stencil?: boolean): void;
1003
1017
  getClearColor(target: THREE.Color): THREE.Color;
@@ -1267,7 +1281,7 @@ export interface IGizmoObject extends THREE.Object3D {
1267
1281
  setActive(value: boolean): void;
1268
1282
  dispose(): void;
1269
1283
  }
1270
- export class GizmoObject extends THREE.Object3D implements IGizmoObject {
1284
+ export class GizmoObject extends THREE.Object3D<ViewObjectEventMap> implements IGizmoObject {
1271
1285
  protected _meshes: THREE.Mesh[];
1272
1286
  readonly baseMaterial: THREE.Material;
1273
1287
  readonly hoverMaterial: THREE.Material;
@@ -1279,9 +1293,9 @@ export class GizmoObject extends THREE.Object3D implements IGizmoObject {
1279
1293
  getActive(): boolean;
1280
1294
  setActive(value: boolean): void;
1281
1295
  dispose(): void;
1282
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1296
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
1283
1297
  }
1284
- export abstract class GizmoAxis extends THREE.Object3D implements IGizmoObject {
1298
+ export abstract class GizmoAxis extends THREE.Object3D<ViewObjectEventMap> implements IGizmoObject {
1285
1299
  readonly handle: IGizmoObject;
1286
1300
  readonly picker?: IGizmoObject;
1287
1301
  readonly helper?: IGizmoObject;
@@ -1300,7 +1314,7 @@ export abstract class GizmoAxis extends THREE.Object3D implements IGizmoObject {
1300
1314
  getHovered(): boolean;
1301
1315
  setHovered(value: boolean): void;
1302
1316
  dispose(): void;
1303
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1317
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
1304
1318
  abstract moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1305
1319
  protected abstract updateGizmoPlane(camera: THREE.Camera): void;
1306
1320
  protected setStartPt(ndcPos: THREE.Vector2, camera: THREE.Camera): void;
@@ -1328,7 +1342,12 @@ export class GizmoScaleAxis extends GizmoAxis {
1328
1342
  moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1329
1343
  protected updateGizmoPlane(camera: THREE.Camera): void;
1330
1344
  }
1331
- export class GizmoControl extends THREE.Object3D {
1345
+ export interface GizmoEventMap extends ViewObjectEventMap {
1346
+ activeAxisChanged: {
1347
+ isAxisActive: boolean;
1348
+ };
1349
+ }
1350
+ export class GizmoControl extends THREE.Object3D<GizmoEventMap> {
1332
1351
 
1333
1352
  constructor(camera: THREE.Camera, navAgent: INavigationAgent);
1334
1353
  attachTo(object: THREE.Object3D, asChild?: boolean): void;
@@ -1368,7 +1387,7 @@ export abstract class CustomMaterial extends THREE.ShaderMaterial {
1368
1387
  protected refreshUniforms(uniforms: {
1369
1388
  [uniform: string]: THREE.IUniform;
1370
1389
  }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
1371
- protected onBeforeCompileCallback(shader: THREE.Shader): void;
1390
+ protected onBeforeCompileCallback(parameters: THREE.WebGLProgramParametersWithUniforms, renderer: THREE.WebGLRenderer): void;
1372
1391
  protected refreshTransformUniform(map: THREE.Texture, uniform: THREE.IUniform): void;
1373
1392
  protected onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group): void;
1374
1393
  protected materialHash(opacity?: number, color?: THREE.Color): number;
@@ -1629,7 +1648,7 @@ export class MeshLineGeometry extends THREE.InstancedBufferGeometry {
1629
1648
  computeBoundingBox(): void;
1630
1649
  computeBoundingSphere(): void;
1631
1650
  }
1632
- export class MeshLine extends THREE.Mesh {
1651
+ export class MeshLine extends THREE.Mesh<MeshLineGeometry, MeshLineMaterial, ViewObjectEventMap> {
1633
1652
  type: string;
1634
1653
  material: MeshLineMaterial;
1635
1654
  geometry: MeshLineGeometry;
@@ -1641,7 +1660,7 @@ export class CustomSprite extends THREE.Sprite {
1641
1660
  material: CustomSpriteMaterial;
1642
1661
 
1643
1662
  constructor(material: CustomSpriteMaterial);
1644
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1663
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
1645
1664
  dispose(): void;
1646
1665
  }
1647
1666
  export interface LabelSpriteParameters {
@@ -1737,7 +1756,7 @@ export interface MeshPointParamter {
1737
1756
  color?: Color;
1738
1757
  size?: number;
1739
1758
  }
1740
- export class MeshPoints extends THREE.Mesh {
1759
+ export class MeshPoints extends THREE.Mesh<THREE.InstancedBufferGeometry, MeshPointMaterial, ViewObjectEventMap> {
1741
1760
  geometry: THREE.InstancedBufferGeometry;
1742
1761
  material: MeshPointMaterial;
1743
1762
 
@@ -1759,7 +1778,7 @@ export class MeshPoints extends THREE.Mesh {
1759
1778
  removePoint(index: number): this;
1760
1779
  updateAttributes(): void;
1761
1780
  dispose(): void;
1762
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1781
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
1763
1782
  }
1764
1783
  export interface ModelPart {
1765
1784
  get id(): string;
@@ -3006,7 +3025,7 @@ export class SettingsNames {
3006
3025
  static GLOBAL_LIGHT: string;
3007
3026
  static LIGHT_SOURCE: string;
3008
3027
  static ANTI_ALIASING: string;
3009
- static HIDE_SMALL_ELEMENTS_MOVING: string;
3028
+ static HIDE_SMALL_ELEMENTS: string;
3010
3029
  static SMALL_ELEMENT_SIZE: string;
3011
3030
  static LABEL_LINE_LENGTH: string;
3012
3031
  static HIDE_EDGES_WHEN_NAVIGATING: string;
@@ -3035,8 +3054,8 @@ export class Viewer3DConfiguration extends ViewerConfiguration {
3035
3054
  export const defaultViewer3DSettings: ViewerSettings;
3036
3055
  export interface IBatchedMaterial extends CustomMaterial {
3037
3056
  textureSize: number;
3038
- blockPosTexture: DataTexture;
3039
- colorTexture: DataTexture;
3057
+ blockPosTexture: THREE.DataTexture;
3058
+ colorTexture: THREE.DataTexture;
3040
3059
  useBlockPosTexture: boolean;
3041
3060
  useBlockColorTexture: boolean;
3042
3061
  }
@@ -3055,11 +3074,11 @@ class BatchedMaterialBase extends CustomMaterial implements IBatchedMaterial {
3055
3074
  /**
3056
3075
  * @default null
3057
3076
  */
3058
- blockPosTexture: DataTexture;
3077
+ blockPosTexture: THREE.DataTexture;
3059
3078
  /**
3060
3079
  * @default null
3061
3080
  */
3062
- colorTexture: DataTexture;
3081
+ colorTexture: THREE.DataTexture;
3063
3082
  /**
3064
3083
  * @default true
3065
3084
  */
@@ -3151,10 +3170,11 @@ export class Model {
3151
3170
  showModelPart(modelPart: string | ModelPart): void;
3152
3171
  /**
3153
3172
  * Hide model elements
3154
- * @param {string[]|string} elementIds - An array of model elements id or just a single model element id.
3173
+ * @param {string[] | string} elementIds - An array of model elements id or just a single model element id.
3155
3174
  * @param {string | ModelPart} modelPart - id of the model part that contains the element ids. By default uses the initial model part loaded into the scene.
3175
+ * @param {boolean} recursive - set to hide child elements. True by default.
3156
3176
  */
3157
- hide(elementIds: string[] | string, modelPart?: string | ModelPart): void;
3177
+ hide(elementIds: string[] | string, modelPart?: string | ModelPart, recursive?: boolean): void;
3158
3178
  /**
3159
3179
  * Hides all elements and model parts from the viewer
3160
3180
  */
@@ -3164,9 +3184,10 @@ export class Model {
3164
3184
  *
3165
3185
  * @param {string[] | string} elementIds - An array of model elements or just a single model element.
3166
3186
  * @param {string | ModelPart} modelPart - id of the model part that contains the model element id. By default uses the initial model part loaded into the scene.
3187
+ * @param {boolean} recursive - set to show child elements. True by default.
3167
3188
  *
3168
3189
  */
3169
- show(elementIds: string[] | string, modelPart?: string | ModelPart): void;
3190
+ show(elementIds: string[] | string, modelPart?: string | ModelPart, recursive?: boolean): void;
3170
3191
  /**
3171
3192
  * Shows all elements and model parts
3172
3193
  */
@@ -3175,26 +3196,30 @@ export class Model {
3175
3196
  * Isolate elements of one model part.
3176
3197
  * @param elementIds - An array of model elements or just a single model element.
3177
3198
  * @param modelPart - id of the model part that contains the model element id. By default uses the initial model part loaded into the scene.
3199
+ * @param {boolean} recursive - add child elements to isolated. True by default.
3178
3200
  */
3179
- isolate(elementIds: string[], modelPart: string | ModelPart): void;
3201
+ isolate(elementIds: string[], modelPart: string | ModelPart, recursive?: boolean): void;
3180
3202
  /**
3181
3203
  * Isolate group of elements.
3182
3204
  * @param elements - Array of grouped model elements to isolate.
3205
+ * @param {boolean} recursive - add child elements to isolated. True by default.
3183
3206
  */
3184
- isolateMultiple(elements: ModelElementIds[]): void;
3207
+ isolateMultiple(elements: ModelElementIds[], recursive?: boolean): void;
3185
3208
  /**
3186
3209
  * Selects the array of model elements. You can also pass in a single model element id instead of an array.
3187
3210
  *
3188
3211
  * @param {string[] | string} elementIds - element or array of elements to select.
3189
3212
  * @param {string | ModelPart} modelPart - model part id or the model part instance containing the elements.
3213
+ * @param {boolean} recursive - add child elements to selection. False by default.
3190
3214
  */
3191
- select(elementIds: string[] | string, modelPart: string | ModelPart, selectionMode: SelectionMode): void;
3215
+ select(elementIds: string[] | string, modelPart: string | ModelPart, selectionMode: SelectionMode, recursive?: boolean): void;
3192
3216
  /**
3193
3217
  * Deselects the array of model elements. You can also pass in a single model element id instead of an array.
3194
3218
  * @param {string[] | string} elementIds - element or array of elements to select.
3195
3219
  * @param {string | ModelPart} modelPart - model part id or the model part instance containing the elements.
3220
+ * @param {boolean} recursive - deselect child elements. False by default.
3196
3221
  */
3197
- deselect(elementIds: string[] | string, modelPart?: string | ModelPart): void;
3222
+ deselect(elementIds: string[] | string, modelPart?: string | ModelPart, recursive?: boolean): void;
3198
3223
  /**
3199
3224
  * Unselect all model elements in all model parts
3200
3225
  */
@@ -3324,7 +3349,7 @@ export interface INavigation {
3324
3349
  * @param {CameraOrientation} cameraOrientation - final orientation of the camera after fitting.
3325
3350
  * @returns
3326
3351
  */
3327
- fitToView(elementIds?: string[] | string, modelPart?: string | ModelPart, immediate?: boolean, cameraOrientation?: CameraOrientation): void;
3352
+ fitToView(elementIds?: string[] | string | ModelElementIds[], modelPart?: string | ModelPart, immediate?: boolean, cameraOrientation?: CameraOrientation): void;
3328
3353
  /**
3329
3354
  * Sets the camera pivot point.
3330
3355
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilotdev/pilot-web-3d",
3
- "version": "24.20.0",
3
+ "version": "24.22.0",
4
4
  "description": "TypeScript definitions for ASCON PilotWeb3D component",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "license": "MIT",
10
10
  "typeScriptVersion": "4.9.4",
11
11
  "dependencies": {
12
- "@types/three": "0.148.0"
12
+ "@types/three": "0.161.0"
13
13
  },
14
14
  "keywords": [
15
15
  "pilotdev",