@abi-software/scaffoldvuer 0.1.53 → 0.1.54-beta-4

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.
@@ -14,7 +14,7 @@
14
14
  <div class="tree-container">
15
15
  <el-tree
16
16
  ref="regionTree"
17
- default-expand-all
17
+ :default-expanded-keys="['__r/']"
18
18
  node-key="id"
19
19
  show-checkbox
20
20
  :check-strictly="false"
@@ -123,18 +123,18 @@ export default {
123
123
  },
124
124
  created: function () {
125
125
  this.module.sceneData.geometries.forEach(zincObject => {
126
- this.organsAdded(zincObject);
126
+ this.zincObjectAdded(zincObject);
127
127
  });
128
128
  this.module.sceneData.lines.forEach(zincObject => {
129
- this.organsAdded(zincObject);
129
+ this.zincObjectAdded(zincObject);
130
130
  });
131
131
  this.module.sceneData.glyphsets.forEach(zincObject => {
132
- this.organsAdded(zincObject);
132
+ this.zincObjectAdded(zincObject);
133
133
  });
134
134
  this.module.sceneData.pointsets.forEach(zincObject => {
135
- this.organsAdded(zincObject);
135
+ this.zincObjectAdded(zincObject);
136
136
  });
137
- this.module.addOrganPartAddedCallback(this.organsAdded);
137
+ this.module.addOrganPartAddedCallback(this.zincObjectAdded);
138
138
  this.__nodeNumbers = 1;
139
139
  },
140
140
  destroyed: function () {
@@ -194,7 +194,7 @@ export default {
194
194
  for (let i = 0; i < this.active.length; i++) {
195
195
  let item = this.active[i];
196
196
  if (item.group === data.label &&
197
- ((item.regionPath === item.regionPath) ||
197
+ ((item.regionPath === data.regionPath) ||
198
198
  item.regionPath === undefined)) {
199
199
  return true;
200
200
  }
@@ -205,7 +205,7 @@ export default {
205
205
  for (let i = 0; i < this.hover.length; i++) {
206
206
  let item = this.hover[i];
207
207
  if (item.group === data.label &&
208
- ((item.regionPath === item.regionPath) ||
208
+ ((item.regionPath === data.regionPath) ||
209
209
  item.regionPath === undefined)) {
210
210
  return true;
211
211
  }
@@ -213,9 +213,9 @@ export default {
213
213
  return false;
214
214
  },
215
215
  /**
216
- * This is called when a new organ is read into the scene.
216
+ * This is called when a new zinc object is read into the scene.
217
217
  */
218
- organsAdded: function (zincObject) {
218
+ zincObjectAdded: function (zincObject) {
219
219
  const region = zincObject.region;
220
220
  if (region) {
221
221
  const paths = region.getFullSeparatedPath();
@@ -239,36 +239,38 @@ export default {
239
239
  }
240
240
  },
241
241
  checkChanged: function (node, data) {
242
- const rootRegion = this.module.scene.getRootRegion();
243
- rootRegion.hideAllChildren();
244
- data.checkedNodes.forEach(localNode => {
245
- if (localNode.region) localNode.region.setVisibility(true);
246
- if (localNode.primitives) {
247
- localNode.primitives.forEach(primitive => {
248
- primitive.setVisibility(true);
249
- });
250
- }
251
- });
252
- data.halfCheckedNodes.forEach(localNode => {
253
- if (localNode.region) localNode.region.setVisibility(true);
254
- });
242
+ const isRegion = node.region;
243
+ const isPrimitives = node.primitives;
244
+ const isChecked = data.checkedKeys.includes(node.id);
245
+ if (isRegion)
246
+ isChecked ? node.region.showAllPrimitives() : node.region.hideAllPrimitives();
247
+ if (isPrimitives)
248
+ node.primitives.forEach(primitive => {
249
+ primitive.setVisibility(isChecked);
250
+ });
251
+ },
252
+ updateActiveUI: function (primitives) {
253
+ this.active = [];
254
+ const list = createListFromPrimitives(primitives);
255
+ this.active.push(...list);
255
256
  },
256
257
  changeActiveByPrimitives: function (primitives, propagate) {
257
258
  if (primitives && primitives.length > 0) {
258
- this.active = [];
259
- const list = createListFromPrimitives(primitives);
260
- this.active.push(...list);
259
+ this.updateActiveUI(primitives);
261
260
  this.$emit("object-selected", primitives, propagate);
262
261
  } else {
263
262
  this.removeActive(propagate);
264
263
  }
265
264
  this.removeHover(propagate);
266
265
  },
266
+ updateHoverUI: function (primitives) {
267
+ this.hover = [];
268
+ const list = createListFromPrimitives(primitives);
269
+ this.hover.push(...list);
270
+ },
267
271
  changeHoverByPrimitives: function (primitives, propagate) {
268
272
  if (primitives && primitives.length > 0) {
269
- this.hover = [];
270
- const list = createListFromPrimitives(primitives);
271
- this.hover.push(...list);
273
+ this.updateHoverUI(primitives);
272
274
  this.$emit("object-hovered", primitives, propagate);
273
275
  } else {
274
276
  this.removeHover(propagate);
@@ -40,9 +40,9 @@ BaseModule.prototype.importSettings = function(settings) {
40
40
  return false;
41
41
  }
42
42
 
43
- BaseModule.prototype.publishChanges = function(annotations, eventType) {
43
+ BaseModule.prototype.publishChanges = function(annotations, eventType, zincObjects) {
44
44
  for (let i = 0; i < this.eventNotifiers.length; i++) {
45
- this.eventNotifiers[i].publish(this, eventType, annotations);
45
+ this.eventNotifiers[i].publish(this, eventType, annotations, zincObjects);
46
46
  }
47
47
  }
48
48
 
@@ -90,6 +90,7 @@ RendererModule.prototype.getAnnotationsFromObjects = function(objects) {
90
90
  RendererModule.prototype.setHighlightedByObjects = function(
91
91
  objects, coords, propagateChanges) {
92
92
  const changed = this.graphicsHighlight.setHighlighted(objects);
93
+ const zincObjects = this.objectsToZincObjects(objects);
93
94
  if (propagateChanges) {
94
95
  eventType = require("./eventNotifier").EVENT_TYPE.MOVE;
95
96
  if (changed)
@@ -97,7 +98,7 @@ RendererModule.prototype.setHighlightedByObjects = function(
97
98
  const annotations = this.getAnnotationsFromObjects(objects);
98
99
  if (annotations.length > 0)
99
100
  annotations[0].coords = coords;
100
- this.publishChanges(annotations, eventType);
101
+ this.publishChanges(annotations, eventType, zincObjects);
101
102
  }
102
103
  return changed;
103
104
  }
@@ -162,7 +163,7 @@ RendererModule.prototype.setSelectedByObjects = function(
162
163
  const annotations = this.getAnnotationsFromObjects(objects);
163
164
  if (annotations.length > 0)
164
165
  annotations[0].coords = coords;
165
- this.publishChanges(annotations, eventType);
166
+ this.publishChanges(annotations, eventType, zincObjects);
166
167
  }
167
168
  }
168
169
  return changed;
@@ -1,8 +1,9 @@
1
1
  const EVENT_TYPE = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 };
2
2
 
3
- const SelectionEvent = function(eventTypeIn, identifiersIn) {
3
+ const SelectionEvent = function(eventTypeIn, identifiersIn, zincObjects) {
4
4
  this.eventType = eventTypeIn;
5
5
  this.identifiers = identifiersIn;
6
+ this.zincObjects = zincObjects;
6
7
  }
7
8
 
8
9
  const returnFullID = function(sourceId) {
@@ -23,12 +24,12 @@ const Subscription = function(subscriberIn, callbackIn, eventType) {
23
24
  return eventType;
24
25
  }
25
26
 
26
- this.notify = function(source, eventType, ids) {
27
+ this.notify = function(source, eventType, ids, zincObjects) {
27
28
  if (source !== subscriber && (_this.targetEventType === EVENT_TYPE.ALL ||
28
29
  _this.targetEventType === eventType)) {
29
30
  //should support different type of id e.g lyph, name, fmas...
30
31
  //need a function that finds all relavant ids
31
- const event = new SelectionEvent(eventType, ids);
32
+ const event = new SelectionEvent(eventType, ids, zincObjects);
32
33
  callback(event);
33
34
  }
34
35
  }
@@ -37,9 +38,9 @@ const Subscription = function(subscriberIn, callbackIn, eventType) {
37
38
  exports.EventNotifier = function() {
38
39
  const subscriptions = [];
39
40
 
40
- this.publish = function(source, eventType, id) {
41
+ this.publish = function(source, eventType, id, zincObjects) {
41
42
  for (let i = 0; i < subscriptions.length;i++) {
42
- subscriptions[i].notify(source, eventType, id);
43
+ subscriptions[i].notify(source, eventType, id, zincObjects);
43
44
  }
44
45
  }
45
46
 
@@ -474,14 +474,15 @@ const OrgansSceneData = function() {
474
474
  _this.sceneData.currentName = name;
475
475
  }
476
476
 
477
- this.loadOrgansFromURL = function(url, speciesName, systemName, partName, viewURL) {
477
+ this.loadOrgansFromURL = function(url, speciesName, systemName, partName, viewURL, clearFirst) {
478
478
  if (_this.zincRenderer) {
479
479
  if (partName && (_this.sceneData.metaURL !== url)) {
480
480
  setSceneData(speciesName, systemName, partName, undefined);
481
481
  const name = _this.sceneData.currentName;
482
482
  let organScene = _this.zincRenderer.getSceneByName(name);
483
483
  if (organScene) {
484
- organScene.clearAll();
484
+ if (clearFirst)
485
+ organScene.clearAll();
485
486
  } else {
486
487
  organScene = _this.zincRenderer.createScene(name);
487
488
  }
@@ -507,6 +508,36 @@ const OrgansSceneData = function() {
507
508
  }
508
509
  }
509
510
  }
511
+
512
+ this.loadGLTFFromURL = function(url, partName, clearFirst) {
513
+ if (_this.zincRenderer) {
514
+ if (partName && (_this.sceneData.metaURL !== url)) {
515
+ setSceneData(undefined, undefined, partName, undefined);
516
+ const name = _this.sceneData.currentName;
517
+ let organScene = _this.zincRenderer.getSceneByName(name);
518
+ if (organScene) {
519
+ if (clearFirst)
520
+ organScene.clearAll();
521
+ } else {
522
+ organScene = _this.zincRenderer.createScene(name);
523
+ }
524
+ for (let i = 0; i < sceneChangedCallbacks.length;i++) {
525
+ sceneChangedCallbacks[i](_this.sceneData);
526
+ }
527
+ _this.sceneData.viewURL = undefined;
528
+ _this.sceneData.metaURL = url;
529
+ organScene.loadGLTF(url, _addOrganPartCallback(undefined, partName, false),
530
+ downloadCompletedCallback());
531
+ _this.scene = organScene;
532
+ _this.zincRenderer.setCurrentScene(organScene);
533
+ _this.graphicsHighlight.reset();
534
+ const zincCameraControl = organScene.getZincCameraControls();
535
+ zincCameraControl.enableRaycaster(organScene, _pickingCallback(), _hoverCallback());
536
+ zincCameraControl.setMouseButtonAction("AUXILIARY", "ZOOM");
537
+ zincCameraControl.setMouseButtonAction("SECONDARY", "PAN");
538
+ }
539
+ }
540
+ }
510
541
 
511
542
  this.alignCameraWithSelectedObject = function(transitionTime) {
512
543
  const objects = _this.graphicsHighlight.getSelected();
@@ -536,7 +567,7 @@ const OrgansSceneData = function() {
536
567
  _this.setName(settings.name);
537
568
  if (settings.metaURL !== undefined && settings.metaURL != "") {
538
569
  _this.loadOrgansFromURL(settings.metaURL, settings.species,
539
- settings.system, settings.part, settings.viewURL);
570
+ settings.system, settings.part, settings.viewURL, true);
540
571
  } else {
541
572
  _this.loadOrgans(settings.species, settings.system, settings.part);
542
573
  }
package/vue.config.js CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  const nodeExternals = require('webpack-node-externals');
2
3
 
3
4
  module.exports = {
@@ -28,6 +29,8 @@ module.exports = {
28
29
  .end()
29
30
  },
30
31
  css: {
32
+ sourceMap: process.env.NODE_ENV === 'wc',
33
+ extract: process.env.NODE_ENV !== 'wc',
31
34
  //Import variables into all stylesheets.
32
35
  loaderOptions: {
33
36
  sass: {