@xeokit/xeokit-sdk 2.6.38 → 2.6.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.38",
3
+ "version": "2.6.40",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -642,7 +642,7 @@ class ContextMenu {
642
642
  '</li>');
643
643
  if (!((groupIdx === groupLen - 1) || (j < lenj - 1))) {
644
644
  html.push(
645
- '<li id="' + item.id + '" class="xeokit-context-menu-item-seperator"></li>'
645
+ '<li id="' + item.id + '" class="xeokit-context-menu-item-separator"></li>'
646
646
  );
647
647
  }
648
648
 
@@ -654,7 +654,7 @@ class ContextMenu {
654
654
  '</li>');
655
655
  if (!((groupIdx === groupLen - 1) || (j < lenj - 1))) {
656
656
  html.push(
657
- '<li id="' + item.id + '" class="xeokit-context-menu-item-seperator"></li>'
657
+ '<li id="' + item.id + '" class="xeokit-context-menu-item-separator"></li>'
658
658
  );
659
659
  }
660
660
  }
@@ -854,12 +854,10 @@ class ContextMenu {
854
854
  const shown = getShown(this._context);
855
855
  item.shown = shown;
856
856
  if (!shown) {
857
- itemElement.classList.remove("xeokit-context-menu-item-visible");
858
- itemElement.classList.add("xeokit-context-menu-item-hidden");
857
+ itemElement.style.display = "none";
859
858
  continue;
860
859
  } else {
861
- itemElement.classList.remove("ceokit-context-menu-item-hidden");
862
- itemElement.classList.add("xeokit-context-menu-item-visible");
860
+ itemElement.style.display = "";
863
861
 
864
862
  }
865
863
  const enabled = getEnabled(this._context);
@@ -366,6 +366,16 @@ class DistanceMeasurement extends Component {
366
366
  const scene = this.plugin.viewer.scene;
367
367
 
368
368
  if (this._wpDirty) {
369
+ const delta = math.subVec3(
370
+ this._targetWorld,
371
+ this._originWorld,
372
+ tmpVec3
373
+ );
374
+
375
+ /**
376
+ * The length detected for each measurement axis.
377
+ */
378
+ this._factors = math.transformVec3(this._axesBasis, delta);
369
379
 
370
380
  this._measurementOrientation = determineMeasurementOrientation(this._originWorld, this._targetWorld, 0);
371
381
  if(this._measurementOrientation === 'Vertical' && this.useRotationAdjustment){
@@ -390,16 +400,6 @@ class DistanceMeasurement extends Component {
390
400
  this._wp[15] = 1.0;
391
401
  }
392
402
  else {
393
- const delta = math.subVec3(
394
- this._targetWorld,
395
- this._originWorld,
396
- tmpVec3
397
- );
398
-
399
- /**
400
- * The length detected for each measurement axis.
401
- */
402
- this._factors = math.transformVec3(this._axesBasis, delta);
403
403
 
404
404
  this._wp[0] = this._originWorld[0];
405
405
  this._wp[1] = this._originWorld[1];
@@ -16,8 +16,8 @@ import {IFCObjectDefaults} from "../../viewer/metadata/IFCObjectDefaults.js";
16
16
  * set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.
17
17
  * * When loading, can set the World-space position, scale and rotation of each model within World space,
18
18
  * along with initial properties for all the model's {@link Entity}s.
19
- * * Allows to mask which IFC types we want to load.
20
- * * Allows to configure initial viewer state for specified IFC types (color, visibility, selection, highlighted, X-rayed, pickable, etc).
19
+ * * Allows to mask which types we want to load.
20
+ * * Allows to configure initial viewer state for specified types (color, visibility, selection, highlighted, X-rayed, pickable, etc).
21
21
  *
22
22
  * ## Usage
23
23
  *
@@ -87,9 +87,9 @@ import {IFCObjectDefaults} from "../../viewer/metadata/IFCObjectDefaults.js";
87
87
  * });
88
88
  * ````
89
89
  *
90
- * ## Including and excluding IFC types
90
+ * ## Including and excluding types
91
91
  *
92
- * We can also load only those objects that have the specified IFC types. In the example below, we'll load only the
92
+ * We can also load only those objects that have the specified types. In the example below, we'll load only the
93
93
  * objects that represent walls.
94
94
  *
95
95
  * ````javascript
@@ -100,7 +100,7 @@ import {IFCObjectDefaults} from "../../viewer/metadata/IFCObjectDefaults.js";
100
100
  * });
101
101
  * ````
102
102
  *
103
- * We can also load only those objects that **don't** have the specified IFC types. In the example below, we'll load only the
103
+ * We can also load only those objects that **don't** have the specified types. In the example below, we'll load only the
104
104
  * objects that do not represent empty space.
105
105
  *
106
106
  * ````javascript
@@ -111,13 +111,13 @@ import {IFCObjectDefaults} from "../../viewer/metadata/IFCObjectDefaults.js";
111
111
  * });
112
112
  * ````
113
113
  *
114
- * # Configuring initial IFC object appearances
114
+ * # Configuring initial object appearances
115
115
  *
116
- * We can specify the custom initial appearance of loaded objects according to their IFC types.
116
+ * We can specify the custom initial appearance of loaded objects according to their types.
117
117
  *
118
118
  * This is useful for things like:
119
119
  *
120
- * * setting the colors to our objects according to their IFC types,
120
+ * * setting the colors to our objects according to their types,
121
121
  * * automatically hiding ````IfcSpace```` objects, and
122
122
  * * ensuring that ````IfcWindow```` objects are always transparent.
123
123
  * <br>
@@ -149,7 +149,7 @@ import {IFCObjectDefaults} from "../../viewer/metadata/IFCObjectDefaults.js";
149
149
  * });
150
150
  * ````
151
151
  *
152
- * When we don't customize the appearance of IFC types, as just above, then IfcSpace elements tend to obscure other
152
+ * When we don't customize the appearance of types, as just above, then IfcSpace elements tend to obscure other
153
153
  * elements, which can be confusing.
154
154
  *
155
155
  * It's often helpful to make IfcSpaces transparent and unpickable, like this:
@@ -349,36 +349,36 @@ export class DotBIMLoaderPlugin extends Plugin {
349
349
 
350
350
  const dbMeshLoaded = {};
351
351
 
352
- const ifcProjectId = math.createUUID();
353
- const ifcSiteId = math.createUUID();
354
- const ifcBuildingId = math.createUUID();
355
- const ifcBuildingStoryId = math.createUUID();
352
+ const projectId = math.createUUID();
353
+ const siteId = math.createUUID();
354
+ const buildingId = math.createUUID();
355
+ const buildingStoryId = math.createUUID();
356
356
 
357
357
  const metaModelData = {
358
358
  metaObjects: [
359
359
  {
360
- id: ifcProjectId,
361
- name: "IfcProject",
362
- type: "IfcProject",
360
+ id: projectId,
361
+ name: "Project",
362
+ type: "Project",
363
363
  parent: null
364
364
  },
365
365
  {
366
- id: ifcSiteId,
367
- name: "IfcSite",
368
- type: "IfcSite",
369
- parent: ifcProjectId
366
+ id: siteId,
367
+ name: "Site",
368
+ type: "Site",
369
+ parent: projectId
370
370
  },
371
371
  {
372
- id: ifcBuildingId,
373
- name: "IfcBuilding",
374
- type: "IfcBuilding",
375
- parent: ifcSiteId
372
+ id: buildingId,
373
+ name: "Building",
374
+ type: "Building",
375
+ parent: siteId
376
376
  },
377
377
  {
378
- id: ifcBuildingStoryId,
379
- name: "IfcBuildingStorey",
380
- type: "IfcBuildingStorey",
381
- parent: ifcBuildingId
378
+ id: buildingStoryId,
379
+ name: "BuildingStorey",
380
+ type: "BuildingStorey",
381
+ parent: buildingId
382
382
  }
383
383
  ],
384
384
  propertySets: []
@@ -545,30 +545,23 @@ export class DotBIMLoaderPlugin extends Plugin {
545
545
  });
546
546
  }
547
547
 
548
+ let properties = [];
548
549
  for (let infoKey in info) {
549
- let properties;
550
- if (infoKey.startsWith("IFC_Pset_")) {
551
- if (!properties) {
552
- properties = [];
553
- }
554
- properties.push({
555
- name: infoKey,
556
- value: info[infoKey]
557
- });
558
- }
559
- if (properties) {
560
- metaModelData.propertySets.push({
561
- id: objectId,
562
- properties
563
- });
564
- }
550
+ properties.push({
551
+ name: infoKey,
552
+ value: info[infoKey]
553
+ });
565
554
  }
555
+ metaModelData.propertySets.push({
556
+ id: objectId,
557
+ properties
558
+ });
566
559
 
567
560
  metaModelData.metaObjects.push({
568
561
  id: objectId,
569
562
  name: info && info.Name && info.Name !== "None" ? info.Name : `${element.type} ${objectId}`,
570
563
  type: element.type,
571
- parent: ifcBuildingStoryId,
564
+ parent: buildingStoryId,
572
565
  propertySetIds: [objectId]
573
566
  });
574
567
  }
@@ -9,6 +9,12 @@ import {core} from "../../viewer/scene/core.js";
9
9
  class GLTFDefaultDataSource {
10
10
 
11
11
  constructor(cfg = {}) {
12
+
13
+ /**
14
+ * Set `true` to enable cache busting for HTTP GETs.
15
+ * This is `true` by default.
16
+ * @type {boolean}
17
+ */
12
18
  this.cacheBuster = (cfg.cacheBuster !== false);
13
19
  }
14
20
 
@@ -135,12 +135,15 @@ export class RenderService {
135
135
  return element.checked;
136
136
  }
137
137
 
138
- setCheckbox(nodeId, checked) {
138
+ setCheckbox(nodeId, checked, indeterminate = false) {
139
139
  const checkbox = document.getElementById(`checkbox-${nodeId}`);
140
140
  if (checkbox) {
141
141
  if (checked !== checkbox.checked) {
142
142
  checkbox.checked = checked;
143
143
  }
144
+ if (indeterminate !== checkbox.indeterminate) {
145
+ checkbox.indeterminate = indeterminate;
146
+ }
144
147
  }
145
148
  }
146
149
 
@@ -361,6 +361,7 @@ export class TreeViewPlugin extends Plugin {
361
361
  * vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
362
362
  * @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
363
363
  * @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
364
+ * @param {Boolean} [cfg.showIndeterminate=false] When true, will show indeterminate state for checkboxes when some but not all child nodes are checked
364
365
  */
365
366
  constructor(viewer, cfg = {}) {
366
367
 
@@ -412,6 +413,7 @@ export class TreeViewPlugin extends Plugin {
412
413
  this._pruneEmptyNodes = cfg.pruneEmptyNodes;
413
414
  this._showListItemElementId = null;
414
415
  this._renderService = cfg.renderService || new RenderService();
416
+ this._showIndeterminate = cfg.showIndeterminate ?? false;
415
417
 
416
418
  if (!this._renderService) {
417
419
  throw new Error('TreeViewPlugin: no render service set');
@@ -453,8 +455,10 @@ export class TreeViewPlugin extends Plugin {
453
455
  } else {
454
456
  parent.numVisibleEntities--;
455
457
  }
456
-
457
- this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
458
+ const indeterminate = this._showIndeterminate
459
+ && parent.numVisibleEntities > 0
460
+ && parent.numVisibleEntities < parent.numEntities;
461
+ this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0), indeterminate);
458
462
 
459
463
  parent = parent.parent;
460
464
  }
@@ -536,8 +540,10 @@ export class TreeViewPlugin extends Plugin {
536
540
  } else {
537
541
  parent.numVisibleEntities -= numUpdated;
538
542
  }
539
-
540
- this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
543
+ const indeterminate = this._showIndeterminate
544
+ && parent.numVisibleEntities > 0
545
+ && parent.numVisibleEntities < parent.numEntities;
546
+ this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0), indeterminate);
541
547
 
542
548
  parent = parent.parent;
543
549
  }
@@ -777,8 +783,8 @@ export class TreeViewPlugin extends Plugin {
777
783
  collapse() {
778
784
  for (let i = 0, len = this._rootNodes.length; i < len; i++) {
779
785
  const rootNode = this._rootNodes[i];
780
- const objectId = rootNode.objectId;
781
- this._collapseNode(objectId);
786
+ const nodeId = rootNode.nodeId;
787
+ this._collapseNode(nodeId);
782
788
  }
783
789
  }
784
790
 
@@ -7,9 +7,9 @@ const configs = new Configs();
7
7
  */
8
8
  export class VBOBatchingTrianglesBuffer {
9
9
 
10
- constructor() {
11
- this.maxVerts = configs.maxGeometryBatchSize;
12
- this.maxIndices = configs.maxGeometryBatchSize * 3; // Rough rule-of-thumb
10
+ constructor(maxBatchSize = configs.maxGeometryBatchSize) {
11
+ this.maxVerts = maxBatchSize;
12
+ this.maxIndices = maxBatchSize * 3; // Rough rule-of-thumb
13
13
  this.positions = [];
14
14
  this.colors = [];
15
15
  this.uv = [];
@@ -4,6 +4,8 @@ import { Viewer } from "../../viewer/Viewer";
4
4
  export declare type FastNavPluginConfiguration = {
5
5
  /** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
6
6
  id?: string;
7
+ /** Whether to temporarily hide color textures whenever we interact with the Viewer. */
8
+ hideColorTexture?: boolean;
7
9
  /** Whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer. */
8
10
  hidePBR?: boolean;
9
11
  /** Whether to temporarily hide scalable ambient occlusion (SAO) whenever we interact with the Viewer. */
@@ -19,6 +19,8 @@ export declare type TreeViewPluginConfiguration = {
19
19
  pruneEmptyNodes?: boolean;
20
20
  /** Optional {@link ITreeViewRenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}. */
21
21
  renderService?: ITreeViewRenderService;
22
+ /** When true, will show indeterminate state for checkboxes when some but not all child nodes are checked */
23
+ showIndeterminate?: boolean;
22
24
  };
23
25
 
24
26
  /**