@abi-software/scaffoldvuer 0.1.53 → 0.1.54-beta.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.
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.1.53",
3
+ "version": "0.1.54-beta.3",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -12784,9 +12784,9 @@
12784
12784
  }
12785
12785
  },
12786
12786
  "terser": {
12787
- "version": "5.14.1",
12788
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.14.1.tgz",
12789
- "integrity": "sha512-+ahUAE+iheqBTDxXhTisdA8hgvbEG1hHOQ9xmNjeUJSoi6DU/gMrKNcfZjHkyY6Alnuyc+ikYJaxxfHkT3+WuQ==",
12787
+ "version": "5.15.0",
12788
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.15.0.tgz",
12789
+ "integrity": "sha512-L1BJiXVmheAQQy+as0oF3Pwtlo4s3Wi1X2zNZ2NxOB4wx9bdS9Vk67XQENLFdLYGCK/Z2di53mTj/hBafR+dTA==",
12790
12790
  "dev": true,
12791
12791
  "requires": {
12792
12792
  "@jridgewell/source-map": "^0.3.2",
@@ -12796,9 +12796,9 @@
12796
12796
  },
12797
12797
  "dependencies": {
12798
12798
  "acorn": {
12799
- "version": "8.7.1",
12800
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz",
12801
- "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==",
12799
+ "version": "8.8.0",
12800
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz",
12801
+ "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==",
12802
12802
  "dev": true
12803
12803
  }
12804
12804
  }
@@ -14728,9 +14728,9 @@
14728
14728
  }
14729
14729
  },
14730
14730
  "terser": {
14731
- "version": "4.8.0",
14732
- "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
14733
- "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==",
14731
+ "version": "4.8.1",
14732
+ "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.1.tgz",
14733
+ "integrity": "sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw==",
14734
14734
  "dev": true,
14735
14735
  "requires": {
14736
14736
  "commander": "^2.20.0",
@@ -17192,9 +17192,9 @@
17192
17192
  }
17193
17193
  },
17194
17194
  "zincjs": {
17195
- "version": "1.0.3",
17196
- "resolved": "https://registry.npmjs.org/zincjs/-/zincjs-1.0.3.tgz",
17197
- "integrity": "sha512-S4ajnPitOO8VD6i9MpLXW4s9p1SBj1hQSxTnIbT6GwHUSDhGXCjkNPSqXhX4Ki/q6/48mbz2hLdDBBJY7qkkxA==",
17195
+ "version": "1.0.7",
17196
+ "resolved": "https://registry.npmjs.org/zincjs/-/zincjs-1.0.7.tgz",
17197
+ "integrity": "sha512-hgAUWM38xDcF3c1vwFxcYBB3stv5Yb/LoUqNt+Mchgi2cZPISyT3tr1TkivTeXoo3rPuAFJQXnUd3RIEsbBt7Q==",
17198
17198
  "requires": {
17199
17199
  "css-element-queries": "^1.2.2",
17200
17200
  "lodash": "^4.17.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.1.53",
3
+ "version": "0.1.54-beta.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "vue": "^2.6.10",
34
34
  "vue-drag-resize": "^1.3.2",
35
35
  "vue-router": "^3.5.1",
36
- "zincjs": "^1.0.3"
36
+ "zincjs": "^1.0.7"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@vue/cli-plugin-babel": "^4.0.0",
package/src/App.vue CHANGED
@@ -21,6 +21,7 @@
21
21
  :render="render"
22
22
  :region="region"
23
23
  :view-u-r-l="viewURL"
24
+ :format="format"
24
25
  @on-ready="onReady"
25
26
  @scaffold-selected="onSelected"
26
27
  @scaffold-navigated="onNavigated"
@@ -288,6 +289,8 @@ export default {
288
289
  rendererInfo: undefined,
289
290
  zoom: 1,
290
291
  pos: [0, 0],
292
+ format: "metadata",
293
+ sceneSettings: [],
291
294
  };
292
295
  },
293
296
  watch: {
@@ -307,7 +310,6 @@ export default {
307
310
  }
308
311
  },
309
312
  mounted: function() {
310
- this._sceneSettings = [];
311
313
  this.selectedCoordinates = this.$refs.scaffold.getDynamicSelectedCoordinates();
312
314
  this.rendererInfo = this.$refs.scaffold.getRendererInfo();
313
315
  },
@@ -339,11 +341,11 @@ export default {
339
341
  },
340
342
  saveSettings: function() {
341
343
  const state = this.$refs.scaffold.getState();
342
- this._sceneSettings.push(this.$refs.scaffold.getState());
344
+ this.sceneSettings.push(this.$refs.scaffold.getState());
343
345
  },
344
346
  restoreSettings: function() {
345
- if (this._sceneSettings.length > 0)
346
- this.$refs.scaffold.setState(this._sceneSettings.pop());
347
+ if (this.sceneSettings.length > 0)
348
+ this.$refs.scaffold.setState(this.sceneSettings.pop());
347
349
  },
348
350
  viewModelClicked: function(location) {
349
351
  this.input = location;
@@ -366,10 +368,9 @@ export default {
366
368
  console.log("ready")
367
369
  this.$refs.dropzone.revokeURLs();
368
370
  //const names = ["left ventricle.mesh2d", "right ventricle.mesh2d"];
369
- //this.$refs.scaffold.changeActiveByName(names, "", true);
371
+ //this.$refs.scaffold.changeActiveByName(names, "", false);
370
372
  },
371
373
  onSelected: function(data) {
372
- console.log(data)
373
374
  if (data && (data.length > 0) && data[0].data.group) {
374
375
  delete this.$route.query["viewURL"];
375
376
  this.$router.replace({
@@ -382,8 +383,10 @@ export default {
382
383
  this.pos[0] = data.target[0];
383
384
  this.pos[1] = data.target[1];
384
385
  },
385
- onFilesDrop: function(metaURL) {
386
- this.input = metaURL;
386
+ onFilesDrop: function(payload) {
387
+ if (payload.format == "gltf") this.format = "gltf";
388
+ else this.format = "metadata";
389
+ this.input = payload.url;
387
390
  },
388
391
  parseInput: function() {
389
392
  if (this.$route.query.url !== this.input) {
@@ -405,6 +408,11 @@ export default {
405
408
  this.url =
406
409
  "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json";
407
410
  }
411
+ if (this.url.includes(".gltf") || this.url.includes(".glb")) {
412
+ this.format = "gltf";
413
+ } else if (this.url.includes(".json")) {
414
+ this.format = "metadata";
415
+ }
408
416
  this.input = this.url;
409
417
  if (query.region) {
410
418
  this.region = query.region;
@@ -33,7 +33,7 @@ export default {
33
33
  });
34
34
  },
35
35
  methods: {
36
- createObjectURLs: function (text, list) {
36
+ createMetadataObjectURLs: function (text, list) {
37
37
  let content = text;
38
38
  for (const [key, file] of Object.entries(list)) {
39
39
  if (content.includes(key)) {
@@ -45,7 +45,14 @@ export default {
45
45
  let blob = new Blob([content], { type: "application/json" });
46
46
  const metaURL = URL.createObjectURL(blob);
47
47
  this.objectURLs.push(metaURL);
48
- this.$emit("files-drop", metaURL);
48
+ this.$emit("files-drop", { url: metaURL, format : "metadata" } );
49
+ },
50
+ createGLTFURL: function (content, binary) {
51
+ let type = binary ? 'model/gltf+binary' : 'model/gltf+json';
52
+ let blob = new Blob([content], { type });
53
+ const gltfURL = URL.createObjectURL(blob);
54
+ this.objectURLs.push(gltfURL);
55
+ this.$emit("files-drop", { url: gltfURL, format : "gltf" });
49
56
  },
50
57
  revokeURLs: function () {
51
58
  this.objectURLs.forEach(objectURL => URL.revokeObjectURL(objectURL));
@@ -55,6 +62,8 @@ export default {
55
62
  const dataMaps = {};
56
63
  let list = {};
57
64
  let metadata = undefined;
65
+ let gltf = undefined;
66
+ let binary = false;
58
67
  const flatarray = Array.from(fileMap);
59
68
  let rootPath = "";
60
69
  for (let i = 0; i < flatarray.length; i++) {
@@ -63,6 +72,16 @@ export default {
63
72
  metadata = { rootPath, file: flatarray[i][1] };
64
73
  break;
65
74
  }
75
+ if (flatarray[i][1].name.includes(".glb")) {
76
+ gltf = { rootPath, file: flatarray[i][1] };
77
+ binary = true;
78
+ break;
79
+ }
80
+ if (flatarray[i][1].name.includes(".gltf")) {
81
+ gltf = { rootPath, file: flatarray[i][1] };
82
+ binary = false;
83
+ break;
84
+ }
66
85
  }
67
86
  if (metadata) {
68
87
  flatarray.forEach(([filePath, file]) => {
@@ -74,9 +93,12 @@ export default {
74
93
  const metaFileURL = URL.createObjectURL(metadata.file);
75
94
  fetch(metaFileURL)
76
95
  .then((response) => response.text())
77
- .then((text) => this.createObjectURLs(text, list));
96
+ .then((text) => this.createMetadataObjectURLs(text, list));
78
97
  URL.revokeObjectURL(metaFileURL);
79
98
  }
99
+ if (gltf) {
100
+ this.createGLTFURL(gltf.file, binary);
101
+ }
80
102
  },
81
103
  },
82
104
  };
@@ -363,6 +363,13 @@ export default {
363
363
  type: Boolean,
364
364
  default: false
365
365
  },
366
+ /**
367
+ * Format of the input URL
368
+ */
369
+ format: {
370
+ type: String,
371
+ default: "metadata"
372
+ },
366
373
  /**
367
374
  * Settings for minimap position, size and alignment.
368
375
  */
@@ -473,10 +480,17 @@ export default {
473
480
  visible: false,
474
481
  x: 200,
475
482
  y: 200
476
- }
483
+ },
484
+ fileFormat: "metadata",
477
485
  };
478
486
  },
479
487
  watch: {
488
+ format: {
489
+ handler: function(value) {
490
+ this.fileFormat = value;
491
+ },
492
+ immediate: true
493
+ },
480
494
  url: {
481
495
  handler: function(newValue) {
482
496
  if (this.state === undefined || this.state.url === undefined)
@@ -508,6 +522,8 @@ export default {
508
522
  },
509
523
  displayMarkers: function(val) {
510
524
  this.$module.scene.displayMarkers = val;
525
+ //Update pickable objects
526
+ this.$module.scene.forcePickableObjectsUpdate = true;
511
527
  },
512
528
  displayMinimap: function(val) {
513
529
  this.$module.scene.displayMinimap = val;
@@ -685,6 +701,7 @@ export default {
685
701
  viewRegion: function(names) {
686
702
  const rootRegion = this.$module.scene.getRootRegion();
687
703
  const groups = Array.isArray(names) ? names : [names];
704
+ const dist = this.$module.scene.camera.far - this.$module.scene.camera.near;
688
705
  const objects = findObjectsWithNames(rootRegion, groups, "");
689
706
  let box = this.$module.scene.getBoundingBoxOfZincObjects(objects);
690
707
  if (box) {
@@ -692,6 +709,7 @@ export default {
692
709
  this.$module.setSyncControlZoomToBox(box);
693
710
  } else {
694
711
  this.$module.scene.viewAllWithBoundingBox(box);
712
+ this.$module.scene.camera.far = this.$module.scene.camera.near + dist;
695
713
  }
696
714
  return true;
697
715
  }
@@ -747,6 +765,7 @@ export default {
747
765
  */
748
766
  eventNotifierCallback: function(event) {
749
767
  const names = [];
768
+ let zincObjects = [];
750
769
  const region = undefined;
751
770
  if (event.eventType == 1 || event.eventType == 2) {
752
771
  event.identifiers.forEach(identifier => {
@@ -757,13 +776,15 @@ export default {
757
776
  names.push(id);
758
777
  }
759
778
  });
779
+ zincObjects = event.zincObjects;
760
780
  }
761
781
  if (event.eventType == 1) {
762
782
  if (this.$refs.treeControl) {
763
783
  if (names.length > 0) {
764
- this.$refs.treeControl.changeActiveByNames(names, region, false);
784
+ //this.$refs.treeControl.changeActiveByNames(names, region, false);
785
+ this.$refs.treeControl.updateActiveUI(zincObjects);
765
786
  } else {
766
- this.$refs.treeControl.removeActive(true);
787
+ this.$refs.treeControl.removeActive(true)
767
788
  }
768
789
  }
769
790
  // Triggers when an object has been selected
@@ -773,7 +794,8 @@ export default {
773
794
  // const offsets = this.$refs.scaffoldContainer.getBoundingClientRect();
774
795
  if (this.$refs.treeControl) {
775
796
  if (names.length > 0) {
776
- this.$refs.treeControl.changeHoverByNames(names, region, false);
797
+ //this.$refs.treeControl.changeHoverByNames(names, region, false);
798
+ this.$refs.treeControl.updateHoverUI(zincObjects);
777
799
  } else {
778
800
  this.$refs.treeControl.removeHover(true);
779
801
  }
@@ -989,9 +1011,10 @@ export default {
989
1011
  */
990
1012
  getState: function() {
991
1013
  let state = {
1014
+ format: this.fileFormat,
992
1015
  url: this._currentURL,
993
1016
  viewport: undefined,
994
- visibility: undefined
1017
+ visibility: undefined,
995
1018
  };
996
1019
  if (this.$refs.treeControl)
997
1020
  state.visibility = this.$refs.treeControl.getState();
@@ -1011,6 +1034,7 @@ export default {
1011
1034
  if (state) {
1012
1035
  if (state.url && state.url !== this._currentURL) {
1013
1036
  this.setURLAndState(state.url, {
1037
+ fileFormat: state.fileFormat,
1014
1038
  viewport: state.viewport,
1015
1039
  visibility: state.visibility
1016
1040
  });
@@ -1047,6 +1071,7 @@ export default {
1047
1071
  */
1048
1072
  setURLAndState: function(newValue, state) {
1049
1073
  if (newValue != this._currentURL) {
1074
+ if (state && state.format) this.fileFormat = state.format;
1050
1075
  let viewport = state && state.viewport ? state.viewport : undefined;
1051
1076
  let visibility =
1052
1077
  state && state.visibility ? state.visibility : undefined;
@@ -1063,14 +1088,20 @@ export default {
1063
1088
  visibility: visibility
1064
1089
  })
1065
1090
  );
1066
- this.$module.loadOrgansFromURL(
1067
- newValue,
1068
- undefined,
1069
- undefined,
1070
- "scene",
1071
- undefined
1072
- );
1091
+ if (this.fileFormat === "gltf") {
1092
+ this.$module.loadGLTFFromURL(newValue, "scene", true);
1093
+ } else {
1094
+ this.$module.loadOrgansFromURL(
1095
+ newValue,
1096
+ undefined,
1097
+ undefined,
1098
+ "scene",
1099
+ undefined,
1100
+ true
1101
+ );
1102
+ }
1073
1103
  this.$module.scene.displayMarkers = this.displayMarkers;
1104
+ this.$module.scene.forcePickableObjectsUpdate = true;
1074
1105
  this.$module.scene.displayMinimap = this.displayMinimap;
1075
1106
  this.updateMinimapScissor();
1076
1107
  }
@@ -1086,7 +1117,6 @@ export default {
1086
1117
  },
1087
1118
  /**
1088
1119
  * Callback when drawer is toggled.
1089
- *
1090
1120
  */
1091
1121
  drawerToggled: function(flag) {
1092
1122
  this.drawerOpen = flag;