@abi-software/scaffoldvuer 0.1.55 → 0.1.57

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.
@@ -37,8 +37,8 @@
37
37
  v-if="displayWarning"
38
38
  v-popover:warningPopover
39
39
  class="el-icon-warning warning-icon"
40
- @mouseover="showToolitip(6)"
41
- @mouseout="hideToolitip(6)"
40
+ @mouseover="showHelpText(6)"
41
+ @mouseout="hideHelpText(6)"
42
42
  >
43
43
  <span class="warning-text">Beta</span>
44
44
  </i>
@@ -52,10 +52,9 @@
52
52
  popper-class="scaffold-popper right-popper non-selectable"
53
53
  />
54
54
  <tree-controls
55
- ref="treeControl"
55
+ ref="treeControls"
56
56
  v-popover:checkBoxPopover
57
57
  :help-mode="helpMode"
58
- :module="$module"
59
58
  :show-colour-picker="showColourPicker"
60
59
  @object-selected="objectSelected"
61
60
  @object-hovered="objectHovered"
@@ -158,8 +157,8 @@
158
157
  icon="zoomIn"
159
158
  class="icon-button zoomIn"
160
159
  @click.native="zoomIn()"
161
- @mouseover.native="showToolitip(0)"
162
- @mouseout.native="hideToolitip(0)"
160
+ @mouseover.native="showHelpText(0)"
161
+ @mouseout.native="hideHelpText(0)"
163
162
  />
164
163
  </el-popover>
165
164
  <el-popover
@@ -175,8 +174,8 @@
175
174
  icon="zoomOut"
176
175
  class="icon-button zoomOut"
177
176
  @click.native="zoomOut()"
178
- @mouseover.native="showToolitip(1)"
179
- @mouseout.native="hideToolitip(1)"
177
+ @mouseover.native="showHelpText(1)"
178
+ @mouseout.native="hideHelpText(1)"
180
179
  />
181
180
  </el-popover>
182
181
  <el-popover
@@ -196,8 +195,8 @@
196
195
  icon="fitWindow"
197
196
  class="icon-button fitWindow"
198
197
  @click.native="fitWindow()"
199
- @mouseover.native="showToolitip(2)"
200
- @mouseout.native="hideToolitip(2)"
198
+ @mouseover.native="showHelpText(2)"
199
+ @mouseout.native="hideHelpText(2)"
201
200
  />
202
201
  </el-popover>
203
202
  </div>
@@ -235,8 +234,8 @@
235
234
  icon="changeBckgd"
236
235
  class="icon-button background-colour"
237
236
  :class="{ open: drawerOpen, close: !drawerOpen }"
238
- @mouseover.native="showToolitip(3)"
239
- @mouseout.native="hideToolitip(3)"
237
+ @mouseover.native="showHelpText(3)"
238
+ @mouseout.native="hideHelpText(3)"
240
239
  />
241
240
  </el-popover>
242
241
  </div>
@@ -481,7 +480,8 @@ export default {
481
480
  region: "",
482
481
  visible: false,
483
482
  x: 200,
484
- y: 200
483
+ y: 200,
484
+ external: false,
485
485
  },
486
486
  fileFormat: "metadata",
487
487
  };
@@ -560,6 +560,7 @@ export default {
560
560
  this.availableBackground = ["white", "black", "lightskyblue"];
561
561
  },
562
562
  mounted: function() {
563
+ this.$refs.treeControls.setModule(this.$module);
563
564
  let eventNotifier = new EventNotifier();
564
565
  eventNotifier.subscribe(this, this.eventNotifierCallback);
565
566
  this.$module.addNotifier(eventNotifier);
@@ -703,7 +704,7 @@ export default {
703
704
  viewRegion: function(names) {
704
705
  const rootRegion = this.$module.scene.getRootRegion();
705
706
  const groups = Array.isArray(names) ? names : [names];
706
- const objects = findObjectsWithNames(rootRegion, groups, "");
707
+ const objects = findObjectsWithNames(rootRegion, groups, "", true);
707
708
  let box = this.$module.scene.getBoundingBoxOfZincObjects(objects);
708
709
  if (box) {
709
710
  if (this.$module.isSyncControl()) {
@@ -765,6 +766,7 @@ export default {
765
766
  /**
766
767
  * Callback when a region is selected/highlighted.
767
768
  * It will also update other controls.
769
+ *
768
770
  */
769
771
  eventNotifierCallback: function(event) {
770
772
  const names = [];
@@ -781,13 +783,18 @@ export default {
781
783
  });
782
784
  zincObjects = event.zincObjects;
783
785
  }
786
+ /*
787
+ * Event Type 1: Selected
788
+ * Event Type 2: Highlighted
789
+ * Event Type 1: Move
790
+ */
784
791
  if (event.eventType == 1) {
785
- if (this.$refs.treeControl) {
792
+ if (this.$refs.treeControls) {
786
793
  if (names.length > 0) {
787
- //this.$refs.treeControl.changeActiveByNames(names, region, false);
788
- this.$refs.treeControl.updateActiveUI(zincObjects);
794
+ //this.$refs.treeControls.changeActiveByNames(names, region, false);
795
+ this.$refs.treeControls.updateActiveUI(zincObjects);
789
796
  } else {
790
- this.$refs.treeControl.removeActive(true)
797
+ this.$refs.treeControls.removeActive(true)
791
798
  }
792
799
  }
793
800
  // Triggers when an object has been selected
@@ -795,12 +802,12 @@ export default {
795
802
  } else if (event.eventType == 2) {
796
803
  this.tData.visible = false;
797
804
  // const offsets = this.$refs.scaffoldContainer.getBoundingClientRect();
798
- if (this.$refs.treeControl) {
805
+ if (this.$refs.treeControls) {
799
806
  if (names.length > 0) {
800
- //this.$refs.treeControl.changeHoverByNames(names, region, false);
801
- this.$refs.treeControl.updateHoverUI(zincObjects);
807
+ //this.$refs.treeControls.changeHoverByNames(names, region, false);
808
+ this.$refs.treeControls.updateHoverUI(zincObjects);
802
809
  } else {
803
- this.$refs.treeControl.removeHover(true);
810
+ this.$refs.treeControls.removeHover(true);
804
811
  }
805
812
  }
806
813
  if ((event.identifiers.length > 0) && event.identifiers[0]) {
@@ -808,6 +815,7 @@ export default {
808
815
  ? event.identifiers[0].data.id
809
816
  : event.identifiers[0].data.group;
810
817
  if (event.identifiers[0].coords) {
818
+ this.tData.external = false;
811
819
  this.tData.visible = true;
812
820
  this.tData.label = id;
813
821
  if (event.identifiers[0].data.region)
@@ -889,12 +897,12 @@ export default {
889
897
  changeActiveByName: function(names, region, propagate) {
890
898
  const isArray = Array.isArray(names);
891
899
  if (names === undefined || (isArray && names.length === 0)) {
892
- this.$refs.treeControl.removeActive(propagate);
900
+ this.$refs.treeControls.removeActive(propagate);
893
901
  } else {
894
902
  let array = names;
895
903
  if (!isArray)
896
904
  array = [array];
897
- this.$refs.treeControl.changeActiveByNames(array, region, propagate);
905
+ this.$refs.treeControls.changeActiveByNames(array, region, propagate);
898
906
  }
899
907
  },
900
908
  /**
@@ -905,12 +913,12 @@ export default {
905
913
  changeHighlightedByName: function(names, region, propagate) {
906
914
  const isArray = Array.isArray(names);
907
915
  if (names === undefined || (isArray && names.length === 0)) {
908
- this.$refs.treeControl.removeHover(propagate);
916
+ this.$refs.treeControls.removeHover(propagate);
909
917
  } else {
910
918
  let array = names;
911
919
  if (!isArray)
912
920
  array = [array];
913
- this.$refs.treeControl.changeHoverByNames(array, region, propagate);
921
+ this.$refs.treeControls.changeHoverByNames(array, region, propagate);
914
922
  }
915
923
  },
916
924
  /**
@@ -938,24 +946,82 @@ export default {
938
946
  });
939
947
  }
940
948
  },
949
+ /**
950
+ * Callback function used by showRegionTooltip in the case when the tooltip
951
+ * is out of view.
952
+ */
953
+ showRegionTooltipCallback: function(name) {
954
+ const instance = this;
955
+ return function() {
956
+ instance.$module.zincRenderer.removePostRenderCallbackFunction(instance.$_regionTooltipCallback);
957
+ instance.showRegionTooltip(name, false);
958
+ }
959
+ },
960
+ /**
961
+ * Display the tooltip. Reset view if the tooltip is not
962
+ * in view.
963
+ */
964
+ showRegionTooltip: function(name, resetView) {
965
+ if (name && this.$module.scene) {
966
+ const rootRegion = this.$module.scene.getRootRegion();
967
+ const groups = [name];
968
+ const objects = findObjectsWithNames(rootRegion, groups, "", true);
969
+ if (objects.length > 0) {
970
+ let coords = objects[0].getClosestVertexDOMElementCoords(this.$module.scene);
971
+ if (coords) {
972
+ //The coords is not in view, view all if resetView flag is true
973
+ if (!coords.inView) {
974
+ this.hideRegionTooltip();
975
+ if (resetView) {
976
+ this.$module.scene.viewAll();
977
+ //Use the post render callback to make sure the scene has been updated
978
+ //before getting the position of the tooltip.
979
+ this.$_regionTooltipCallback =
980
+ this.$module.zincRenderer.addPostRenderCallbackFunction(
981
+ this.showRegionTooltipCallback(name)
982
+ );
983
+ }
984
+ return;
985
+ } else {
986
+ this.tData.external = true;
987
+ this.tData.visible = true;
988
+ this.tData.label = name;
989
+ this.tData.x = coords.position.x;
990
+ this.tData.y = coords.position.y;
991
+ const regionPath = objects[0].getRegion().getFullPath();
992
+ if (regionPath)
993
+ this.tData.region = regionPath;
994
+ else
995
+ this.tData.region = "Root";
996
+ }
997
+ }
998
+ } else {
999
+ this.hideRegionTooltip();
1000
+ }
1001
+ }
1002
+ },
1003
+ hideRegionTooltip: function() {
1004
+ this.tData.visible = false;
1005
+ this.tData.region = "Root";
1006
+ },
941
1007
  /**
942
1008
  * This is called when mouse cursor enters supported elements
943
1009
  * with help tootltips.
944
1010
  */
945
- showToolitip: function(tooltipNumber) {
1011
+ showHelpText: function(helpTextNumber) {
946
1012
  if (!this.inHelp) {
947
- this.tooltipWait = setTimeout(() => {
948
- this.hoverVisabilities[tooltipNumber].value = true;
1013
+ this.helpTextWait = setTimeout(() => {
1014
+ this.hoverVisabilities[helpTextNumber].value = true;
949
1015
  }, 500);
950
1016
  }
951
1017
  },
952
1018
  /**
953
1019
  * This is called when mouse cursor exits supported element..
954
1020
  */
955
- hideToolitip: function(tooltipNumber) {
1021
+ hideHelpText: function(helpTextNumber) {
956
1022
  if (!this.inHelp) {
957
- this.hoverVisabilities[tooltipNumber].value = false;
958
- clearTimeout(this.tooltipWait);
1023
+ this.hoverVisabilities[helpTextNumber].value = false;
1024
+ clearTimeout(this.helpTextWait);
959
1025
  }
960
1026
  },
961
1027
  /**
@@ -998,7 +1064,7 @@ export default {
998
1064
  if (options.visibility) {
999
1065
  // Some UIs may not be ready at this time.
1000
1066
  this.$nextTick(() => {
1001
- this.$refs.treeControl.setState(options.visibility);
1067
+ this.$refs.treeControls.setState(options.visibility);
1002
1068
  });
1003
1069
  }
1004
1070
  }
@@ -1023,8 +1089,8 @@ export default {
1023
1089
  viewport: undefined,
1024
1090
  visibility: undefined,
1025
1091
  };
1026
- if (this.$refs.treeControl)
1027
- state.visibility = this.$refs.treeControl.getState();
1092
+ if (this.$refs.treeControls)
1093
+ state.visibility = this.$refs.treeControls.getState();
1028
1094
  if (this.$module.scene) {
1029
1095
  let zincCameraControls = this.$module.scene.getZincCameraControls();
1030
1096
  state.viewport = zincCameraControls.getCurrentViewport();
@@ -1053,7 +1119,7 @@ export default {
1053
1119
  .getZincCameraControls()
1054
1120
  .setCurrentCameraSettings(state.viewport);
1055
1121
  if (state.visibility)
1056
- this.$refs.treeControl.setState(state.visibility);
1122
+ this.$refs.treeControls.setState(state.visibility);
1057
1123
  } else {
1058
1124
  this.$module.setFinishDownloadCallback(
1059
1125
  this.setURLFinishCallback({
@@ -1083,8 +1149,8 @@ export default {
1083
1149
  let visibility =
1084
1150
  state && state.visibility ? state.visibility : undefined;
1085
1151
  this._currentURL = newValue;
1086
- if (this.$refs.treeControl)
1087
- this.$refs.treeControl.clear();
1152
+ if (this.$refs.treeControls)
1153
+ this.$refs.treeControls.clear();
1088
1154
  this.loading = true;
1089
1155
  this.isReady = false;
1090
1156
  this.$module.setFinishDownloadCallback(
@@ -1157,6 +1223,9 @@ export default {
1157
1223
  },
1158
1224
  syncControlCallback: function() {
1159
1225
  const payload = this.$module.NDCCameraControl.getPanZoom();
1226
+ if (this.tData.visible) {
1227
+ this.showRegionTooltip(this.tData.label);
1228
+ }
1160
1229
  this.$emit("scaffold-navigated", payload);
1161
1230
  },
1162
1231
  /**
@@ -123,11 +123,11 @@ export default {
123
123
  }
124
124
  },
125
125
  created: function() {
126
- let tmpArray = this.module.sceneData.geometries.concat(
127
- this.module.sceneData.lines
126
+ let tmpArray = this.module.primitiveData.geometries.concat(
127
+ this.module.primitiveData.lines
128
128
  );
129
- tmpArray = tmpArray.concat(this.module.sceneData.glyphsets);
130
- tmpArray = uniq(tmpArray.concat(this.module.sceneData.pointset));
129
+ tmpArray = tmpArray.concat(this.module.primitiveData.glyphsets);
130
+ tmpArray = uniq(tmpArray.concat(this.module.primitiveData.pointset));
131
131
  this.sortedPrimitiveGroups = orderBy(tmpArray);
132
132
  this.module.addOrganPartAddedCallback(this.organsAdded);
133
133
  },
@@ -21,7 +21,7 @@
21
21
  :data="treeData"
22
22
  :default-checked-keys="['__r/']"
23
23
  :expand-on-click-node="false"
24
- :renderAfterExpand="false"
24
+ :render-after-expand="false"
25
25
  @check="checkChanged"
26
26
  >
27
27
  <span
@@ -35,7 +35,7 @@
35
35
  @mouseover="changeHoverByNode(data, true)"
36
36
  >
37
37
  <el-color-picker
38
- v-if="data.primitives"
38
+ v-if="data.isPrimitives"
39
39
  :class="{ 'show-picker': showColourPicker }"
40
40
  :value="getColour(data)"
41
41
  size="small"
@@ -92,13 +92,6 @@ const nameSorting = (a, b) => {
92
92
  export default {
93
93
  name: "TreeControls",
94
94
  props: {
95
- /**
96
- * @ignore
97
- */
98
- module: {
99
- type: Object,
100
- default: undefined,
101
- },
102
95
  /**
103
96
  * Enable/disable colour picker
104
97
  */
@@ -122,22 +115,6 @@ export default {
122
115
  },
123
116
  },
124
117
  },
125
- created: function () {
126
- this.module.sceneData.geometries.forEach(zincObject => {
127
- this.zincObjectAdded(zincObject);
128
- });
129
- this.module.sceneData.lines.forEach(zincObject => {
130
- this.zincObjectAdded(zincObject);
131
- });
132
- this.module.sceneData.glyphsets.forEach(zincObject => {
133
- this.zincObjectAdded(zincObject);
134
- });
135
- this.module.sceneData.pointsets.forEach(zincObject => {
136
- this.zincObjectAdded(zincObject);
137
- });
138
- this.module.addOrganPartAddedCallback(this.zincObjectAdded);
139
- this.__nodeNumbers = 1;
140
- },
141
118
  destroyed: function () {
142
119
  this.sortedPrimitiveGroups = undefined;
143
120
  },
@@ -146,8 +123,7 @@ export default {
146
123
  //The following block prevent duplicate graphics with the same name
147
124
  for (let i = 0; i < parentContainer.length; i++) {
148
125
  if (parentContainer[i].id === item.id) {
149
- if (item.primitives && parentContainer[i].primitives) {
150
- parentContainer[i].primitives.push(...item.primitives);
126
+ if (item.isPrimitives && parentContainer[i].isPrimitives) {
151
127
  return;
152
128
  }
153
129
  }
@@ -165,10 +141,10 @@ export default {
165
141
  // '__r/'
166
142
  findOrCreateRegion: function (data, paths, prefix) {
167
143
  //check if root region has been set
168
- if (!this.treeData[0].region && this.module && this.module.scene) {
169
- this.treeData[0].region = this.module.scene.getRootRegion();
144
+ if ((this.treeData[0].regionPath === undefined) && this.$module && this.$module.scene) {
145
+ this.treeData[0].regionPath = "";
146
+ this.treeData[0].isRegion = true;
170
147
  }
171
-
172
148
  if (paths.length > 0) {
173
149
  const _paths = [...paths];
174
150
  let childRegion = data.children.find(
@@ -177,12 +153,12 @@ export default {
177
153
  const path = prefix + "/" + paths[0];
178
154
  const id = "__r" + path;
179
155
  if (!childRegion) {
180
- const region = this.treeData[0].region.findChildFromPath(path);
181
156
  childRegion = {
182
157
  label: _paths[0],
183
158
  id: id,
184
159
  children: [],
185
- region: region,
160
+ regionPath: path,
161
+ isRegion: true,
186
162
  };
187
163
  this.addTreeItem(data.children, childRegion);
188
164
  }
@@ -232,7 +208,7 @@ export default {
232
208
  const child = {
233
209
  label: zincObject.groupName,
234
210
  id: id,
235
- primitives: [zincObject],
211
+ isPrimitives: true,
236
212
  regionPath: zincObject.region.getFullPath(),
237
213
  };
238
214
  this.addTreeItem(regionData.children, child);
@@ -241,15 +217,19 @@ export default {
241
217
  }
242
218
  },
243
219
  checkChanged: function (node, data) {
244
- const isRegion = node.region;
245
- const isPrimitives = node.primitives;
220
+ const isRegion = node.isRegion;
221
+ const isPrimitives = node.isPrimitives;
246
222
  const isChecked = data.checkedKeys.includes(node.id);
247
- if (isRegion)
248
- isChecked ? node.region.showAllPrimitives() : node.region.hideAllPrimitives();
249
- if (isPrimitives)
250
- node.primitives.forEach(primitive => {
223
+ const region = this.$module.scene.getRootRegion().findChildFromPath(node.regionPath);
224
+ if (isRegion) {
225
+ isChecked ? region.showAllPrimitives() : region.hideAllPrimitives();
226
+ }
227
+ if (isPrimitives) {
228
+ const primitives = region.findObjectsWithGroupName(node.label);
229
+ primitives.forEach(primitive => {
251
230
  primitive.setVisibility(isChecked);
252
231
  });
232
+ }
253
233
  },
254
234
  updateActiveUI: function (primitives) {
255
235
  this.active.length = 0;
@@ -280,27 +260,31 @@ export default {
280
260
  * Select a region by its name.
281
261
  */
282
262
  changeActiveByNames: function (names, regionPath, propagate) {
283
- const rootRegion = this.module.scene.getRootRegion();
263
+ const rootRegion = this.$module.scene.getRootRegion();
284
264
  const targetObjects = findObjectsWithNames(rootRegion, names,
285
- regionPath);
265
+ regionPath, true);
286
266
  this.changeActiveByPrimitives(targetObjects, propagate);
287
267
  },
288
268
  /**
289
269
  * Hover a region by its name.
290
270
  */
291
271
  changeHoverByNames: function (names, regionPath, propagate) {
292
- const rootRegion = this.module.scene.getRootRegion();
272
+ const rootRegion = this.$module.scene.getRootRegion();
293
273
  const targetObjects = findObjectsWithNames(rootRegion, names,
294
- regionPath);
274
+ regionPath, true);
295
275
  this.changeHoverByPrimitives(targetObjects, propagate);
296
276
  },
297
277
  changeActiveByNode: function (node, propagate) {
298
- if (node.primitives)
299
- this.changeActiveByPrimitives(node.primitives, propagate);
278
+ if (node.isPrimitives) {
279
+ const targetObjects = this.getZincObjectsFromNode(node, false);
280
+ this.changeActiveByPrimitives(targetObjects, propagate);
281
+ }
300
282
  },
301
283
  changeHoverByNode: function (node, propagate) {
302
- if (node.primitives)
303
- this.changeHoverByPrimitives(node.primitives, propagate);
284
+ if (node.isPrimitives) {
285
+ const targetObjects = this.getZincObjectsFromNode(node, false);
286
+ this.changeHoverByPrimitives(targetObjects, propagate);
287
+ }
304
288
  },
305
289
  /**
306
290
  * Unselect the current selected region.
@@ -328,8 +312,10 @@ export default {
328
312
  this.$emit("object-selected", undefined);
329
313
  },
330
314
  getColour: function (nodeData) {
315
+ //Do not need to check for primitives as this is checked on the template
331
316
  if (nodeData) {
332
- let graphic = nodeData.primitives[0];
317
+ const targetObjects = this.getZincObjectsFromNode(nodeData, false);
318
+ let graphic = targetObjects[0];
333
319
  if (graphic) {
334
320
  let hex = graphic.getColourHex();
335
321
  if (hex) return "#" + hex;
@@ -337,19 +323,43 @@ export default {
337
323
  }
338
324
  return "#FFFFFF";
339
325
  },
326
+ getZincObjectsFromNode: function(node, transverse) {
327
+ const rootRegion = this.$module.scene.getRootRegion();
328
+ return findObjectsWithNames(rootRegion, node.label,
329
+ node.regionPath, transverse);
330
+ },
331
+ //Set this right at the beginning.
332
+ setModule: function (moduleIn) {
333
+ this.$module = moduleIn;
334
+ this.$module.primitiveData.geometries.forEach(zincObject => {
335
+ this.zincObjectAdded(zincObject);
336
+ });
337
+ this.$module.primitiveData.lines.forEach(zincObject => {
338
+ this.zincObjectAdded(zincObject);
339
+ });
340
+ this.$module.primitiveData.glyphsets.forEach(zincObject => {
341
+ this.zincObjectAdded(zincObject);
342
+ });
343
+ this.$module.primitiveData.pointsets.forEach(zincObject => {
344
+ this.zincObjectAdded(zincObject);
345
+ });
346
+ this.$module.addOrganPartAddedCallback(this.zincObjectAdded);
347
+ this.__nodeNumbers = 1;
348
+ },
340
349
  setColour: function (nodeData, value) {
341
- if (nodeData && nodeData.primitives) {
342
- nodeData.primitives.forEach(primitive => {
350
+ if (nodeData && nodeData.isPrimitives) {
351
+ const targetObjects = this.getZincObjectsFromNode(nodeData, false);
352
+ targetObjects.forEach(primitive => {
343
353
  let hexString = value.replace("#", "0x");
344
354
  primitive.setColourHex(hexString);
345
355
  });
346
356
  }
347
357
  },
348
358
  viewAll: function () {
349
- this.module.viewAll();
359
+ this.$module.viewAll();
350
360
  },
351
361
  visibilityToggle: function (item, event) {
352
- this.module.changeOrganPartsVisibility(item, event);
362
+ this.$module.changeOrganPartsVisibility(item, event);
353
363
  if (event == false) {
354
364
  if (this.activeRegion === item) {
355
365
  this.removeActive(true);
@@ -366,9 +376,15 @@ export default {
366
376
  setTreeVisibility: function(node, list) {
367
377
  let flag = false;
368
378
  if (list.includes(node.id)) flag = true;
369
- if (node.region) node.region.setVisibility(flag);
370
- if (node.primitives) node.primitives.forEach(primitive => primitive.setVisibility(flag))
371
- if (node.children) node.children.forEach(child => this.setTreeVisibility(child, list));
379
+ const region = this.$module.scene.getRootRegion().findChildFromPath(node.regionPath);
380
+ if (node.isRegion)
381
+ region.setVisibility(flag);
382
+ if (node.isPrimitives) {
383
+ const primitives = region.findObjectsWithGroupName(node.label);
384
+ primitives.forEach(primitive => primitive.setVisibility(flag))
385
+ }
386
+ if (node.children)
387
+ node.children.forEach(child => this.setTreeVisibility(child, list));
372
388
  },
373
389
  checkAllKeys: function () {
374
390
  const keysList = [];
@@ -60,7 +60,7 @@ exports.GraphicsHighlight = function() {
60
60
  }
61
61
 
62
62
  this.setHighlighted = function(objects) {
63
- const previousHighlightedObjects = currentHighlightedObjects;
63
+ const previousHighlightedObjects = [...currentHighlightedObjects];
64
64
  _this.resetHighlighted();
65
65
  // Selected object cannot be highlighted
66
66
  const array = getUnmatchingObjects(objects, currentSelectedObjects);
@@ -75,9 +75,9 @@ exports.GraphicsHighlight = function() {
75
75
 
76
76
  this.setSelected = function(objects) {
77
77
  // first find highlighted object that are not selected
78
- const previousHSelectedObjects = currentSelectedObjects;
78
+ const previousHSelectedObjects = [...currentSelectedObjects];
79
79
  const array = getUnmatchingObjects(currentHighlightedObjects, objects);
80
- currentHighlightedObjects = array;
80
+ _this.resetHighlighted();
81
81
  _this.resetSelected();
82
82
  const fullList = getFullListOfObjects(objects);
83
83
  for (let i = 0; i < fullList.length; i++) {
@@ -9,12 +9,15 @@ const OrgansSceneData = function() {
9
9
  this.currentSpecies = "";
10
10
  this.metaURL = "";
11
11
  this.viewURL = "";
12
+ this.currentTime = 0.0;
13
+ this.timeVarying = false;
14
+ }
15
+
16
+ const PrimitiveData = function () {
12
17
  this.geometries = [];
13
18
  this.lines = [];
14
19
  this.glyphsets = [];
15
20
  this.pointsets = [];
16
- this.currentTime = 0.0;
17
- this.timeVarying = false;
18
21
  }
19
22
 
20
23
  /**
@@ -36,6 +39,7 @@ const OrgansSceneData = function() {
36
39
  const _this = this;
37
40
  let pickerScene = undefined;
38
41
  this.sceneData = new OrgansSceneData();
42
+ this.primitiveData = new PrimitiveData();
39
43
  const timeChangedCallbacks = new Array();
40
44
  const sceneChangedCallbacks = new Array();
41
45
  const organPartAddedCallbacks = new Array();
@@ -350,15 +354,15 @@ const OrgansSceneData = function() {
350
354
  }
351
355
  }
352
356
 
353
- const addOrganPartToSceneData = function(zincObject) {
357
+ const addOrganPartToPrimitiveData = function(zincObject) {
354
358
  if (zincObject.isGeometry) {
355
- _this.sceneData.geometries.push(zincObject);
359
+ _this.primitiveData.geometries.push(zincObject);
356
360
  } else if (zincObject.isGlyphset) {
357
- _this.sceneData.glyphsets.push(zincObject);
361
+ _this.primitiveData.glyphsets.push(zincObject);
358
362
  } else if (zincObject.isLines) {
359
- _this.sceneData.lines.push(zincObject);
363
+ _this.primitiveData.lines.push(zincObject);
360
364
  } else if (zincObject.isPointset) {
361
- _this.sceneData.pointsets.push(zincObject);
365
+ _this.primitiveData.pointsets.push(zincObject);
362
366
  }
363
367
  }
364
368
 
@@ -368,7 +372,7 @@ const OrgansSceneData = function() {
368
372
  }
369
373
  if (useDefautColour)
370
374
  modelsLoader.setGeometryColour(zincObject, systemName, partName);
371
- addOrganPartToSceneData(zincObject);
375
+ addOrganPartToPrimitiveData(zincObject);
372
376
  const annotation = new (require('./annotation').annotation)();
373
377
  const region = zincObject.region.getFullPath();
374
378
  annotation.data = {species:_this.sceneData.currentSpecies, system:systemName,
@@ -458,10 +462,10 @@ const OrgansSceneData = function() {
458
462
  _this.sceneData.currentSystem = systemName;
459
463
  _this.sceneData.currentPart = partName;
460
464
  _this.sceneData.currentTime = 0.0;
461
- _this.sceneData.geometries.splice(0);
462
- _this.sceneData.lines.splice(0);
463
- _this.sceneData.glyphsets.splice(0);
464
- _this.sceneData.pointsets.splice(0);
465
+ _this.primitiveData.geometries.splice(0);
466
+ _this.primitiveData.lines.splice(0);
467
+ _this.primitiveData.glyphsets.splice(0);
468
+ _this.primitiveData.pointsets.splice(0);
465
469
  _this.sceneData.timeVarying = false;
466
470
  // This is used as title
467
471
  let name = "";