@xeokit/xeokit-sdk 2.6.113 → 2.6.114

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.113",
3
+ "version": "2.6.114",
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",
@@ -5,7 +5,7 @@ export * from "./AngleMeasurementsTouchControl.js";
5
5
 
6
6
  import {Component} from "../../viewer/scene/Component.js";
7
7
  import {math} from "../../viewer/scene/math/math.js";
8
- import {activateDraggableDots} from "../../../src/plugins/lib/ui/index.js";
8
+ import {activateDraggableDots} from "../lib/ui/index.js";
9
9
 
10
10
  class AngleMeasurementEditControl extends Component {
11
11
 
@@ -5,7 +5,7 @@ export * from "./DistanceMeasurementsTouchControl.js";
5
5
 
6
6
  import {Component} from "../../viewer/scene/Component.js";
7
7
  import {math} from "../../viewer/scene/math/math.js";
8
- import {activateDraggableDots} from "../../../src/plugins/lib/ui/index.js";
8
+ import {activateDraggableDots} from "../lib/ui/index.js";
9
9
 
10
10
  export class DistanceMeasurementEditControl extends Component {
11
11
 
@@ -896,7 +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
+ * @param {Boolean|Function} [params.loadIntoMetaScene=true] Whether to load metadata into ````MetaScene````, otherwise expose as ````SceneModel::metadata````. If provided as a function, it will be called with either ````metaModelSrc````'s contents, ````metaModelData```` value, or xkt's embedded metadata, and the function's return value will be used as ````metaModel.loadData````'s input.
900
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
901
901
  * multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info.
902
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
@@ -995,10 +995,19 @@ class XKTLoaderPlugin extends Plugin {
995
995
 
996
996
  const loadIntoMetaScene = (! ("loadIntoMetaScene" in params)) || params.loadIntoMetaScene;
997
997
  const metaModel = (loadIntoMetaScene
998
- ? new MetaModel({
999
- id: modelId,
1000
- metaScene: this.viewer.metaScene
1001
- })
998
+ ? (() => {
999
+ const metaModel = new MetaModel({
1000
+ id: modelId,
1001
+ metaScene: this.viewer.metaScene
1002
+ });
1003
+ if (typeof loadIntoMetaScene === "function") {
1004
+ const origLoadData = metaModel.loadData;
1005
+ metaModel.loadData = function(metaModelData, options = {}) {
1006
+ return origLoadData.call(this, loadIntoMetaScene(metaModelData), options);
1007
+ };
1008
+ }
1009
+ return metaModel;
1010
+ })()
1002
1011
  : (function() {
1003
1012
  let firstMetadata = null;
1004
1013
  let modelMetadata = null;
@@ -5,7 +5,7 @@ import {ReadableGeometry} from "../../viewer/scene/geometry/ReadableGeometry.js"
5
5
  import {PhongMaterial} from "../../viewer/scene/materials/PhongMaterial.js";
6
6
  import {math} from "../../viewer/scene/math/math.js";
7
7
  import {Mesh} from "../../viewer/scene/mesh/Mesh.js";
8
- import {activateDraggableDots, Dot3D, marker3D, wire3D, touchPointSelector, transformToNode, triangulateEarClipping} from "../../../src/plugins/lib/ui/index.js";
8
+ import {activateDraggableDots, Dot3D, marker3D, wire3D, touchPointSelector, transformToNode, triangulateEarClipping} from "../lib/ui/index.js";
9
9
 
10
10
  const hex2rgb = function(color) {
11
11
  const rgb = idx => parseInt(color.substr(idx + 1, 2), 16) / 255;
@@ -36,8 +36,8 @@ export declare type LoadXKTModel = {
36
36
  metaModelSrc?: string;
37
37
  /** JSON model metadata, as an alternative to the ````metaModelSrc```` parameter. */
38
38
  metaModelData?: any;
39
- /** Whether to load metadata into MetaScene, otherwise expose as SceneModel::metadata. Defaults to `true`. */
40
- loadIntoMetaScene?: boolean;
39
+ /** Whether to load metadata into ````MetaScene````, otherwise expose as ````SceneModel::metadata````. If provided a function, the function will be called with either ````metaModelSrc````'s contents, ````metaModelData```` value, or xkt's embedded metadata, and the function's return value will be used as ````metaModel.loadData````'s input. Defaults to `true`. */
40
+ loadIntoMetaScene?: boolean | ((metadata: any) => any);
41
41
  /** 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.*/
42
42
  manifestSrc?: any;
43
43
  /** 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. */