@abi-software/mapintegratedvuer 1.17.3 → 1.17.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/mapintegratedvuer",
3
- "version": "1.17.3",
3
+ "version": "1.17.4",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -53,10 +53,10 @@
53
53
  ],
54
54
  "dependencies": {
55
55
  "@abi-software/flatmapvuer": "1.13.1",
56
- "@abi-software/map-side-bar": "2.14.1",
56
+ "@abi-software/map-side-bar": "2.14.2",
57
57
  "@abi-software/map-utilities": "1.8.1",
58
58
  "@abi-software/plotvuer": "1.0.7",
59
- "@abi-software/scaffoldvuer": "1.15.1",
59
+ "@abi-software/scaffoldvuer": "1.15.4",
60
60
  "@abi-software/simulationvuer": "3.0.16",
61
61
  "@abi-software/sparc-annotation": "0.3.2",
62
62
  "@abi-software/svg-sprite": "1.0.4",
@@ -353,7 +353,6 @@ export default {
353
353
  const uniqueFilters = this.connectivitiesStore.getUniqueFilterOptionsByKeys;
354
354
  const uniqueFilterSources = this.connectivitiesStore.getUniqueFilterSourcesByKeys;
355
355
  let results = this.connectivitiesStore.getUniqueConnectivitiesByKeys;
356
-
357
356
  for (const activeContent of activeContents) {
358
357
  const viewer = activeContent.$refs.viewer;
359
358
  if (viewer) {
@@ -596,6 +596,7 @@ export default {
596
596
  onShowConnectivityGraph: function (data) {
597
597
  const previousPrimaryId = this.splitFlowStore.customLayout?.['pane-1']?.id;
598
598
  const connectivityGraphId = this.createNewEntry({
599
+ connectivityInfo: data.connectivityInfo,
599
600
  resource: data.entry,
600
601
  type: 'ConnectivityGraph',
601
602
  label: data.title || data.label || data.entry ||'Connectivity Graph',
@@ -86,18 +86,10 @@ export default {
86
86
  onTapNode: function (data) {
87
87
  const name = data.map(t => t.label).join(', ');
88
88
  this.onConnectivityHovered(name);
89
-
90
- // Hover outside of node area
91
- if (!name) {
92
- EventBus.emit('show-connectivity', {
93
- featureIds: [this.entry.resource]
94
- });
95
- }
96
-
97
89
  },
98
90
  onConnectivityHovered: function (label) {
99
91
  const payload = {
100
- connectivityInfo: this.graphEntry,
92
+ connectivityInfo: this.entry.connectivityInfo,
101
93
  label: label,
102
94
  data: label ? this.getConnectivityDatasets(label) : [],
103
95
  };
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div class="viewer-container">
3
3
  <ScaffoldVuer
4
+ v-if="activated"
4
5
  :state="entry.state"
5
6
  :url="entry.resource"
6
7
  :region="entry.region"
@@ -53,6 +54,7 @@
53
54
 
54
55
  <script>
55
56
  /* eslint-disable no-alert, no-console */
57
+ import { markRaw } from "vue";
56
58
  import EventBus from "../EventBus";
57
59
  import ContentMixin from "../../mixins/ContentMixin";
58
60
 
@@ -71,61 +73,67 @@ export default {
71
73
  },
72
74
  methods: {
73
75
  showConnectivitiesByReference: async function (resource) {
74
- const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
75
- let featureIds = [];
76
- if (flatmapKnowledge) {
77
- featureIds = await getReferenceConnectivitiesFromStorage(resource);
78
- } else {
79
- featureIds = await getReferenceConnectivitiesByAPI(this.flatmapService.mapImp, resource, this.flatmapService.flatmapQueries);
80
- }
81
- const nerveLabels = [];
82
- for (const id of featureIds) {
83
- const knowledge = this.nervesKnowledge.find(k => k.id === id);
84
- if (!knowledge) continue;
76
+ if (this.$refs.scaffold) {
77
+ const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
78
+ let featureIds = [];
79
+ if (flatmapKnowledge) {
80
+ featureIds = await getReferenceConnectivitiesFromStorage(resource);
81
+ } else {
82
+ featureIds = await getReferenceConnectivitiesByAPI(this.flatmapService.mapImp, resource, this.flatmapService.flatmapQueries);
83
+ }
84
+ const nerveLabels = [];
85
+ for (const id of featureIds) {
86
+ const knowledge = this.nervesKnowledge.find(k => k.id === id);
87
+ if (!knowledge) continue;
85
88
 
86
- const nerves = knowledge['nerve-label'];
87
- if (nerves) {
88
- const subNerves = nerves.flatMap(n => n.subNerves);
89
- nerveLabels.push(...subNerves);
89
+ const nerves = knowledge['nerve-label'];
90
+ if (nerves) {
91
+ const subNerves = nerves.flatMap(n => n.subNerves);
92
+ nerveLabels.push(...subNerves);
93
+ }
90
94
  }
95
+ this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
91
96
  }
92
- this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
93
97
  },
94
98
  setNerveGreyScale: function () {
95
- if (this.nervesKnowledge.length) {
96
- const nerves = this.nervesKnowledge.reduce((acc, val) => {
97
- return acc.concat(val['nerve-label'] || []);
98
- }, []);
99
- const excludedLabels = nerves.reduce((acc, nerve) => {
100
- return acc.concat(nerve.subNerves || []);
101
- }, []);
102
- this.$refs.scaffold.setGreyScale(true, excludedLabels);
99
+ if (this.$refs.scaffold) {
100
+ if (this.nervesKnowledge.length) {
101
+ const nerves = this.nervesKnowledge.reduce((acc, val) => {
102
+ return acc.concat(val['nerve-label'] || []);
103
+ }, []);
104
+ const excludedLabels = nerves.reduce((acc, nerve) => {
105
+ return acc.concat(nerve.subNerves || []);
106
+ }, []);
107
+ this.$refs.scaffold.setGreyScale(true, excludedLabels);
108
+ }
103
109
  }
104
110
  },
105
111
  setVisibilityFilter: function (payload) {
106
- let names = [];
107
- const processed = payload ? true : false;
108
- if (payload) {
109
- const ids = [];
110
- payload['OR'].forEach(orData => {
111
- if ('AND' in orData) {
112
- if (orData['AND'].length >= 2 && 'models' in orData['AND'][1]) {
113
- ids.push(...orData['AND'][1]['models']);
112
+ if (this.$refs.scaffold) {
113
+ let names = [];
114
+ const processed = payload ? true : false;
115
+ if (payload) {
116
+ const ids = [];
117
+ payload['OR'].forEach(orData => {
118
+ if ('AND' in orData) {
119
+ if (orData['AND'].length >= 2 && 'models' in orData['AND'][1]) {
120
+ ids.push(...orData['AND'][1]['models']);
121
+ }
122
+ }
123
+ });
124
+ for (const id of ids) {
125
+ const nerveKnowledge = this.nervesKnowledge.find((knowledge) => knowledge.id === id);
126
+ if (nerveKnowledge) {
127
+ const nerves = nerveKnowledge['nerve-label'].map(n => n.subNerves).flat(Infinity);
128
+ names.push(...nerves);
114
129
  }
115
- }
116
- });
117
- for (const id of ids) {
118
- const nerveKnowledge = this.nervesKnowledge.find((knowledge) => knowledge.id === id);
119
- if (nerveKnowledge) {
120
- const nerves = nerveKnowledge['nerve-label'].map(n => n.subNerves).flat(Infinity);
121
- names.push(...nerves);
122
130
  }
123
131
  }
132
+ this.$refs.scaffold.zoomToNerves(names, processed);
124
133
  }
125
- this.$refs.scaffold.zoomToNerves(names, processed);
126
134
  },
127
135
  syncFilter: function (data) {
128
- if (this.$refs.scaffold.viewingMode === "Neuron Connection") {
136
+ if (this.$refs.scaffold?.viewingMode === "Neuron Connection") {
129
137
  this.filter = data.filter(f => f.facet?.toLowerCase() !== 'show all');
130
138
  }
131
139
  },
@@ -217,16 +225,27 @@ export default {
217
225
  }
218
226
  },
219
227
  onResize: function () {
220
- this.scaffoldCamera.onResize();
228
+ if (!this.scaffoldCamera) {
229
+ this.scaffoldCamera = markRaw(this.$refs.scaffold?.$module?.scene?.getZincCameraControls());
230
+ }
231
+ if (this.scaffoldCamera) {
232
+ this.scaffoldCamera.onResize();
233
+ }
221
234
  },
222
235
  getState: function () {
223
- return this.$refs.scaffold.getState();
236
+ if (this.$refs.scaffold) {
237
+ return this.$refs.scaffold.getState();
238
+ } else {
239
+ return this.entry.state;
240
+ }
224
241
  },
225
242
  /**
226
243
  * Perform a local search on this contentvuer
227
244
  */
228
245
  search: function (term) {
229
- return this.$refs.scaffold.search(term, true);
246
+ if (this.$refs.scaffold) {
247
+ return this.$refs.scaffold.search(term, true);
248
+ }
230
249
  },
231
250
  searchSuggestions: function(term, suggestions){
232
251
  if (term === "" || !this.$refs.scaffold) {
@@ -238,33 +257,42 @@ export default {
238
257
  });
239
258
  },
240
259
  showConnectivityTooltips: function (payload) {
241
- if (payload.label) {
242
- this.$refs.scaffold.changeHighlightedByName([payload.label], "", false);
243
- this.$refs.scaffold.showRegionTooltip(payload.label, false, false);
244
- } else {
245
- const nerves = payload.connectivityInfo['nerve-label'];
246
- if (nerves) {
247
- const nerveLabels = nerves.flatMap(n => n.subNerves);
248
- this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
260
+ if (this.$refs.scaffold) {
261
+ if (payload.label) {
262
+ this.$refs.scaffold.changeHighlightedByName([payload.label], "", false);
263
+ this.$refs.scaffold.showRegionTooltip(payload.label, false, false);
264
+ } else {
265
+ const nerves = payload.connectivityInfo['nerve-label'];
266
+ if (nerves) {
267
+ const nerveLabels = nerves.flatMap(n => n.subNerves);
268
+ this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
269
+ }
270
+ this.$refs.scaffold.hideRegionTooltip();
249
271
  }
250
- this.$refs.scaffold.hideRegionTooltip();
251
272
  }
252
273
  },
253
274
  zoomToFeatures: function(info, forceSelect) {
254
- let names = undefined;
255
- if (Array.isArray(info)) names = info;
256
- else names = [ info.name ];
257
- if (forceSelect) {
258
- this.$refs.scaffold.changeActiveByName(names, "", false);
275
+ if (this.$refs.scaffold) {
276
+ let names = undefined;
277
+ if (Array.isArray(info)) names = info;
278
+ else names = [ info.name ];
279
+ if (forceSelect) {
280
+ this.$refs.scaffold.changeActiveByName(names, "", false);
281
+ }
282
+ this.$refs.scaffold.viewRegion(names);
259
283
  }
260
- this.$refs.scaffold.viewRegion(names);
261
284
  },
262
285
  scaffoldIsReady: function () {
263
286
  this.scaffoldLoaded = true;
264
287
  this.$refs.scaffold.$module.graphicsHighlight.highlightColour = [1, 0, 1];
265
- if (this.visible) {
266
- let rotation = "free";
267
- if (this.entry.rotation) rotation = this.entry.rotation;
288
+ if (!this.scaffoldRef) {
289
+ this.scaffoldRef = markRaw(this.$refs.scaffold);
290
+ if (this.scaffoldRef) {
291
+ this.loadExplorerConfig();
292
+ this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities;
293
+ this.connectivityFilterOptions = this.connectivitiesStore.filterOptions;
294
+ this.connectivityFilterSources = this.connectivitiesStore.filterSources;
295
+ }
268
296
  }
269
297
  this.updateViewerSettings();
270
298
  EventBus.emit("mapLoaded", this.$refs.scaffold);
@@ -306,25 +334,31 @@ export default {
306
334
  }
307
335
  },
308
336
  updateWithViewUrl: function(viewUrl) {
309
- this.$refs.scaffold.updateViewURL(viewUrl);
337
+ if (this.$refs.scaffold) {
338
+ this.$refs.scaffold.updateViewURL(viewUrl);
339
+ }
310
340
  },
311
341
  /**
312
342
  * Change the view mode of the current scaffold
313
343
  */
314
344
  changeViewingMode: function (modeName) {
315
- this.$refs.scaffold.changeViewingMode(modeName);
345
+ if (this.$refs.scaffold) {
346
+ this.$refs.scaffold.changeViewingMode(modeName);
347
+ }
316
348
  },
317
349
  updateViewerSettings: function () {
318
- const {
319
- backgroundDisplay,
320
- organsDisplay,
321
- outlinesDisplay,
322
- viewingMode,
323
- } = this.settingsStore.globalSettings;
324
- this.$refs.scaffold.backgroundChangeCallback(backgroundDisplay);
325
- this.$refs.scaffold.changeViewingMode(viewingMode);
326
- this.$refs.scaffold.setColour(organsDisplay);
327
- this.$refs.scaffold.setOutlines(outlinesDisplay);
350
+ if (this.$refs.scaffold) {
351
+ const {
352
+ backgroundDisplay,
353
+ organsDisplay,
354
+ outlinesDisplay,
355
+ viewingMode,
356
+ } = this.settingsStore.globalSettings;
357
+ this.$refs.scaffold.backgroundChangeCallback(backgroundDisplay);
358
+ this.$refs.scaffold.changeViewingMode(viewingMode);
359
+ this.$refs.scaffold.setColour(organsDisplay);
360
+ this.$refs.scaffold.setOutlines(outlinesDisplay);
361
+ }
328
362
  },
329
363
  },
330
364
  computed: {
@@ -340,6 +374,27 @@ export default {
340
374
  },
341
375
  },
342
376
  watch: {
377
+ visible: {
378
+ handler(visible) {
379
+ // Only activate scaffoldvuer when the pane becomes active
380
+ if (visible && (!this.activated)) {
381
+ this.activated = true;
382
+ this.$nextTick(() => {
383
+ if (this.$refs.scaffold) {
384
+ this.scaffoldRef = markRaw(this.$refs.scaffold);
385
+ if (this.scaffoldRef) {
386
+ this.loadExplorerConfig();
387
+ this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities;
388
+ this.connectivityFilterOptions = this.connectivitiesStore.filterOptions;
389
+ this.connectivityFilterSources = this.connectivitiesStore.filterSources;
390
+ }
391
+ }
392
+ });
393
+ }
394
+ },
395
+ deep: true,
396
+ immediate: true,
397
+ },
343
398
  connectivityKnowledge: {
344
399
  handler(newVal, oldVal) {
345
400
  // Store scaffold knowledge locally
@@ -359,6 +414,7 @@ export default {
359
414
  },
360
415
  data: function () {
361
416
  return {
417
+ activated: false,
362
418
  apiLocation: process.env.VUE_APP_API_LOCATION,
363
419
  scaffoldCamera: undefined,
364
420
  scaffoldLoaded: false,
@@ -368,10 +424,6 @@ export default {
368
424
  query: '',
369
425
  };
370
426
  },
371
- mounted: function () {
372
- this.scaffoldCamera =
373
- this.$refs.scaffold.$module.scene.getZincCameraControls();
374
- },
375
427
  };
376
428
  </script>
377
429
 
@@ -65,14 +65,13 @@ export default {
65
65
  this.alive = false;
66
66
  },
67
67
  mounted: function () {
68
- this.multiflatmapRef = this.$refs.multiflatmap;
69
- this.flatmapRef = this.$refs.flatmap;
70
- this.scaffoldRef = this.$refs.scaffold;
71
- this.iframeRef = this.$refs.iframe;
72
- this.plotRef = this.$refs.plot;
73
- this.simulationRef = this.$refs.simulation;
68
+ this.multiflatmapRef = markRaw(this.$refs.multiflatmap);
69
+ this.flatmapRef = markRaw(this.$refs.flatmap);
70
+ this.iframeRef = markRaw(this.$refs.iframe);
71
+ this.plotRef = markRaw(this.$refs.plot);
72
+ this.simulationRef = markRaw(this.$refs.simulation);
74
73
  // load connectivity with mock human male flatmap
75
- if (this.scaffoldRef || this.iframeRef || this.plotRef || this.simulationRef) {
74
+ if (this.iframeRef || this.plotRef || this.simulationRef) {
76
75
  this.loadExplorerConfig();
77
76
  }
78
77
  this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities;
@@ -274,59 +273,6 @@ export default {
274
273
  )
275
274
  );
276
275
  },
277
- /**
278
- * Get the term to zoom/highlight in a synchronisation event,
279
- * if it cannot be found in the map, it will perform several
280
- * calls to try to ge a valid name/id.
281
- */
282
- getNameAndIdFromSyncData: async function (data) {
283
- let name = data.internalName;
284
- if (name === undefined && data.resource) {
285
- name = data.resource.label;
286
- }
287
- let id = undefined;
288
- if (data.resource && data.resource.resource) {
289
- id = data.resource.resource[0];
290
- }
291
- if (this.entry.type === "Scaffold") {
292
- const objects = this.$refs.scaffold.findObjectsWithGroupName(name);
293
- // If a region is not found use a hardcoded list to determine
294
- // its parents region first
295
- if (objects.length === 0) {
296
- //Use nerve mapping
297
- if (data.resource && data.resource.feature) {
298
- const matched = getNerveNames(data.resource.feature.models);
299
- if (matched.length > 0) return matched;
300
- }
301
- let matched = getParentsRegion(name);
302
- if (matched) {
303
- return matched;
304
- }
305
- // Hardcoded list failed - use an endpoint to find its parents
306
- if (id && data.eventType === "selected") {
307
- return fetch(`${this.apiLocation}get-related-terms/${id}`)
308
- .then(response => response.json())
309
- .then(data => {
310
- if (data.uberon?.array.length > 0) {
311
- name =
312
- data.uberon.array[0].name.charAt(0).toUpperCase() +
313
- data.uberon.array[0].name.slice(1);
314
- id = data.uberon.array[0].id.toUpperCase();
315
- return { id, name };
316
- }
317
- });
318
- }
319
- }
320
- } else if (this.entry.type === "MultiFlatmap") {
321
- if (name === "Bladder") {
322
- name = "Urinary Bladder";
323
- } else {
324
- const matched = getNerveNames(name);
325
- if (matched.length > 0) name = matched[0];
326
- }
327
- }
328
- return { id, name };
329
- },
330
276
  // Get the species and andaotmy info for the featured datasets
331
277
  getDatasetAnatomyInfo: function (identifier) {
332
278
  fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${identifier}`)
@@ -837,6 +783,9 @@ export default {
837
783
  multiflatmapRef: null,
838
784
  flatmapRef: null,
839
785
  scaffoldRef: null,
786
+ iframeRef: null,
787
+ plotRef: null,
788
+ simulationRef: null,
840
789
  scaffoldLoaded: false,
841
790
  isInHelp: false,
842
791
  mapManager: undefined,
@@ -8,6 +8,7 @@ export const useConnectivitiesStore = defineStore('connectivities', {
8
8
  globalConnectivities: {},
9
9
  filterOptions: {},
10
10
  filterSources: {},
11
+ connectivitiesUpdated: true,
11
12
  };
12
13
  },
13
14
  getters: {
@@ -74,11 +75,19 @@ export const useConnectivitiesStore = defineStore('connectivities', {
74
75
  if (!listsAreEqual(this.activeConnectivityKeys, activeConnectivityKeys)) {
75
76
  this.activeConnectivityKeys = activeConnectivityKeys;
76
77
  return true;
78
+ } else if (this.connectivitiesUpdated) {
79
+ this.connectivitiesUpdated = !activeConnectivityKeys.every(ele => ele in this.globalConnectivities);
80
+ return true;
77
81
  }
78
82
  return false;
79
83
  },
80
84
  updateGlobalConnectivities(globalConnectivities) {
81
- this.globalConnectivities = globalConnectivities;
85
+ if (globalConnectivities) {
86
+ if (JSON.stringify(globalConnectivities) !== JSON.stringify(this.globalConnectivities)) {
87
+ this.globalConnectivities = globalConnectivities;
88
+ this.connectivitiesUpdated = true;
89
+ }
90
+ }
82
91
  },
83
92
  updateFilterOptions(filterOptions) {
84
93
  this.filterOptions = filterOptions;