@xeokit/xeokit-sdk 2.6.109 → 2.6.111

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,14 +1,14 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.109",
3
+ "version": "2.6.111",
4
4
  "description": "3D BIM IFC Viewer SDK for AEC engineering applications. Open Source JavaScript Toolkit based on pure WebGL for top performance, real-world coordinates and full double precision",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
7
7
  "types": "./types/index.d.ts",
8
8
  "scripts": {
9
- "build": "rollup --config rollup.config.js; rollup --config rollup.minified.config.js",
10
- "dev-build": "rollup --config rollup.dev.config.js",
11
- "test": "npx percy exec -- npx playwright test"
9
+ "build": "node -e \"console.error('WARNING: \\'npm run {build,dev-build,test}\\' scripts and \\'devDependencies\\' are soon going to be deprecated. Install a build tool and execute it directly.\\n');\"; rollup --config rollup.config.js; rollup --config rollup.minified.config.js",
10
+ "dev-build": "node -e \"console.error('WARNING: \\'npm run {build,dev-build,test}\\' scripts and \\'devDependencies\\' are soon going to be deprecated. Install a build tool and execute it directly.\\n');\"; rollup --config rollup.dev.config.js",
11
+ "test": "node -e \"console.error('WARNING: \\'npm run {build,dev-build,test}\\' scripts and \\'devDependencies\\' are soon going to be deprecated. Install a test tool and execute it directly.\\n');\"; npx percy exec -- npx playwright test"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
@@ -896,6 +896,7 @@ class XKTLoaderPlugin extends Plugin {
896
896
  * @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
897
897
  * @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
898
898
  * @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
899
+ * @param {Boolean} [params.loadIntoMetaScene=true] Whether to load metadata into MetaScene, otherwise expose as SceneModel::metadata.
899
900
  * @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
900
901
  * multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info.
901
902
  * @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
@@ -991,10 +992,30 @@ class XKTLoaderPlugin extends Plugin {
991
992
 
992
993
  const modelId = sceneModel.id; // In case ID was auto-generated
993
994
 
994
- const metaModel = new MetaModel({
995
- metaScene: this.viewer.metaScene,
996
- id: modelId
997
- });
995
+ const loadIntoMetaScene = (! ("loadIntoMetaScene" in params)) || params.loadIntoMetaScene;
996
+ const metaModel = (loadIntoMetaScene
997
+ ? new MetaModel({
998
+ id: modelId,
999
+ metaScene: this.viewer.metaScene
1000
+ })
1001
+ : (function() {
1002
+ let firstMetadata = null;
1003
+ let modelMetadata = null;
1004
+ return {
1005
+ loadData: metadata => {
1006
+ if (! firstMetadata) {
1007
+ firstMetadata = metadata;
1008
+ } else {
1009
+ if (! modelMetadata) {
1010
+ modelMetadata = { };
1011
+ Object.entries(firstMetadata).forEach(([ k, v ]) => modelMetadata[k] = Array.isArray(v) ? v.slice(0) : v);
1012
+ }
1013
+ Object.entries(metadata).forEach(([ k, v ]) => { if (Array.isArray(v)) { v.forEach(e => modelMetadata[k].push(e)); } });
1014
+ }
1015
+ },
1016
+ finalize: () => sceneModel.metadata = modelMetadata || firstMetadata
1017
+ };
1018
+ })());
998
1019
 
999
1020
  this.viewer.scene.canvas.spinner.processes++;
1000
1021
 
@@ -1007,7 +1028,7 @@ class XKTLoaderPlugin extends Plugin {
1007
1028
  metaModel.finalize();
1008
1029
  this.viewer.scene.canvas.spinner.processes--;
1009
1030
  sceneModel.once("destroyed", () => {
1010
- this.viewer.metaScene.destroyMetaModel(metaModel.id);
1031
+ loadIntoMetaScene && this.viewer.metaScene.destroyMetaModel(metaModel.id);
1011
1032
  });
1012
1033
  this.scheduleTask(() => {
1013
1034
  if (sceneModel.destroyed) {
@@ -117,26 +117,18 @@ class CameraUpdater {
117
117
 
118
118
  if (updates.rotateDeltaY !== 0 || updates.rotateDeltaX !== 0) {
119
119
 
120
- if ((!configs.firstPerson) && configs.followPointer && pivotController.getPivoting()) {
121
- pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);
122
- pivotController.showPivot();
123
-
124
- } else {
125
-
120
+ if (configs.firstPerson) {
126
121
  if (updates.rotateDeltaX !== 0) {
127
- if (configs.firstPerson) {
128
- camera.pitch(-updates.rotateDeltaX);
129
- } else {
130
- camera.orbitPitch(updates.rotateDeltaX);
131
- }
122
+ camera.pitch(-updates.rotateDeltaX);
132
123
  }
133
-
134
124
  if (updates.rotateDeltaY !== 0) {
135
- if (configs.firstPerson) {
136
- camera.yaw(updates.rotateDeltaY);
137
- } else {
138
- camera.orbitYaw(updates.rotateDeltaY);
139
- }
125
+ camera.yaw(updates.rotateDeltaY);
126
+ }
127
+ }
128
+ else {
129
+ if (configs.followPointer && pivotController.getPivoting()){
130
+ pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);
131
+ pivotController.showPivot();
140
132
  }
141
133
  }
142
134
 
@@ -32,6 +32,8 @@ export declare type LoadXKTModel = {
32
32
  metaModelSrc?: string;
33
33
  /** JSON model metadata, as an alternative to the ````metaModelSrc```` parameter. */
34
34
  metaModelData?: any;
35
+ /** Whether to load metadata into MetaScene, otherwise expose as SceneModel::metadata. Defaults to `true`. */
36
+ loadIntoMetaScene?: boolean;
35
37
  /** Path or URL to a JSON manifest file that provides paths or URLs to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info.*/
36
38
  manifestSrc?: any;
37
39
  /** A JSON manifest object (as an alternative to a path or URL) that provides paths or URLs to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info. */