@abi-software/mapintegratedvuer 1.1.1 → 1.2.0-beta.2

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.1.1",
3
+ "version": "1.2.0-beta.2",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -48,8 +48,8 @@
48
48
  "*.js"
49
49
  ],
50
50
  "dependencies": {
51
- "@abi-software/flatmapvuer": "1.1.1",
52
- "@abi-software/map-side-bar": "^2.2.0",
51
+ "@abi-software/flatmapvuer": "^1.1.2-alpha-3",
52
+ "@abi-software/map-side-bar": "^2.2.1-alpha-3",
53
53
  "@abi-software/plotvuer": "1.0.0",
54
54
  "@abi-software/scaffoldvuer": "^1.1.0",
55
55
  "@abi-software/simulationvuer": "1.0.0",
@@ -28,6 +28,8 @@
28
28
  @actionClick="actionClick"
29
29
  @tabClicked="tabClicked"
30
30
  @search-changed="searchChanged($event)"
31
+ @anatomy-in-datasets="updateMarkers($event)"
32
+ @number-of-datasets-for-anatomies="updateScaffoldMarkers($event)"
31
33
  @hover-changed="hoverChanged($event)"
32
34
  @contextUpdate="contextUpdate($event)"
33
35
  @datalink-clicked="datalinkClicked($event)"
@@ -93,6 +95,7 @@ export default {
93
95
  startUp: true,
94
96
  search: '',
95
97
  activeDockedId : 1,
98
+ hoveredMarkerDelay: undefined,
96
99
  filterTriggered: false,
97
100
  availableFacets: [],
98
101
  }
@@ -257,7 +260,14 @@ export default {
257
260
  hoverChanged: function (data) {
258
261
  const hoverEntries = data && data.anatomy ? data.anatomy : []
259
262
  this.settingsStore.updateHoveredMarkers(hoverEntries);
260
- EventBus.emit("markerUpdate");
263
+ if (!hoverEntries.length) {
264
+ this.hoveredMarkerDelay = setTimeout(() => {
265
+ EventBus.emit("markerUpdate");
266
+ }, 500)
267
+ } else {
268
+ clearTimeout(this.hoveredMarkerDelay)
269
+ EventBus.emit("markerUpdate");
270
+ }
261
271
  },
262
272
  searchChanged: function (data) {
263
273
  if (data && data.type == "query-update") {
@@ -296,13 +306,13 @@ export default {
296
306
  }
297
307
  this.filterTriggered = false; // reset for next action
298
308
  }
299
- if (data && data.type == "available-facets") {
300
- this.settingsStore.updateFacetLabels(data.value.labels);
301
- this.settingsStore.updateMarkers(data.value.uberons);
302
- EventBus.emit("markerUpdate");
303
-
304
- this.availableFacets = data.value.labels
305
- }
309
+ },
310
+ updateMarkers: function (data) {
311
+ this.settingsStore.updateMarkers(data);
312
+ EventBus.emit("markerUpdate");
313
+ },
314
+ updateScaffoldMarkers: function (data) {
315
+ this.settingsStore.updateNumberOfDatasetsForFacets(data);
306
316
  },
307
317
  getNewEntryId: function() {
308
318
  if (this.entries.length) {
@@ -162,7 +162,7 @@ export default {
162
162
  mounted: function() {
163
163
  this.getAvailableTerms();
164
164
  EventBus.on("markerUpdate", () => {
165
- this.flatmapMarkerZoomUpdate(true, undefined);
165
+ this.flatmapMarkerUpdate(undefined);
166
166
  });
167
167
  },
168
168
  };
@@ -155,7 +155,6 @@ export default {
155
155
  payload: payload,
156
156
  type: this.entry.type,
157
157
  };
158
- this.flatmapMarkerZoomUpdate(false, undefined);
159
158
  this.$emit("resource-selected", result);
160
159
  }
161
160
  },
@@ -245,7 +244,6 @@ export default {
245
244
  this.$refs.multiflatmap
246
245
  .getCurrentFlatmap()
247
246
  .mapImp.panZoomTo(origin, [sW, sH]);
248
- this.flatmapMarkerZoomUpdate(false, undefined);
249
247
  }
250
248
  }
251
249
  },
@@ -322,7 +320,7 @@ export default {
322
320
  flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
323
321
  this.flatmapReady = true;
324
322
  const flatmapImp = flatmap.mapImp;
325
- this.flatmapMarkerZoomUpdate(true, flatmapImp);
323
+ this.flatmapMarkerUpdate(flatmapImp);
326
324
  this.updateProvCard();
327
325
  }
328
326
  },
@@ -344,11 +342,13 @@ export default {
344
342
  EventBus.emit("PopoverActionClick", returnedAction);
345
343
  },
346
344
  restoreFeaturedMarkers: function (flatmap) {
345
+
347
346
  this.settingsStore.resetFeaturedMarkerIdentifier();
348
347
  const markers = this.settingsStore.featuredMarkers;
349
- this.updateFeatureMarkers(markers, flatmap);
348
+ this.updateFeaturedMarkers(markers, flatmap);
350
349
  },
351
- updateFeatureMarkers: function (markers, flatmap) {
350
+ // updateFeaturedMarkers will step through the featured markers and add them to the map
351
+ updateFeaturedMarkers: function (markers, flatmap) {
352
352
  this.showStarInLegend = false; // will show if we have a featured marker
353
353
  for (let index = 0; index < markers.length; ++index) {
354
354
  if (markers[index]) {
@@ -364,6 +364,7 @@ export default {
364
364
  }
365
365
  }
366
366
  },
367
+ // addFeaturedMarker: add a featured marker to the map at the specified uberon location
367
368
  addFeaturedMarker: function (marker, index, flatmap) {
368
369
  const markerSpecies =
369
370
  this.settingsStore.featuredMarkerSpecies[index];
@@ -415,7 +416,7 @@ export default {
415
416
  return;
416
417
  }
417
418
 
418
- this.updateFeatureMarkers(markers, undefined);
419
+ this.updateFeaturedMarkers(markers, undefined);
419
420
  },
420
421
  },
421
422
  mounted: function () {
@@ -423,7 +424,9 @@ export default {
423
424
  this.getFeaturedDatasets();
424
425
 
425
426
  EventBus.on("markerUpdate", () => {
426
- this.flatmapMarkerZoomUpdate(true, undefined);
427
+ if (this.flatmapReady) {
428
+ this.flatmapMarkerUpdate(this.$refs.multiflatmap.getCurrentFlatmap().mapImp);
429
+ }
427
430
  });
428
431
  },
429
432
  };
@@ -446,6 +449,12 @@ export default {
446
449
  cursor: pointer !important;
447
450
  z-index: 2;
448
451
  }
452
+ &.hovered {
453
+ div {
454
+ scale: 2;
455
+ transform: translate(0px, -5px);
456
+ }
457
+ }
449
458
  &.highlight-marker {
450
459
  visibility: visible !important;
451
460
  cursor: pointer !important;
@@ -455,14 +464,6 @@ export default {
455
464
  transform: translate(45px, -7px);
456
465
  }
457
466
  }
458
- &.hovered-marker {
459
- cursor: pointer !important;
460
- z-index: 2;
461
- div {
462
- scale: 2;
463
- transform: translate(0px, -5px);
464
- }
465
- }
466
467
  }
467
468
 
468
469
  </style>
@@ -187,7 +187,7 @@ export default {
187
187
  }
188
188
  },
189
189
  markerLabels: function () {
190
- return this.settingsStore.facetLabels;
190
+ return this.settingsStore.numberOfDatasetsForFacets;
191
191
  },
192
192
  },
193
193
  data: function () {
@@ -268,6 +268,7 @@ export default {
268
268
  }
269
269
  return { id, name };
270
270
  },
271
+ // Get the species and andaotmy info for the featured datasets
271
272
  getDatasetAnatomyInfo: function (identifier) {
272
273
  fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${identifier}`)
273
274
  .then(response => response.json())
@@ -300,7 +301,8 @@ export default {
300
301
  } catch (error) {
301
302
  markerSpecies = undefined;
302
303
  }
303
- this.updateFeatureMarkers([markerCurie], undefined)
304
+ // can test the featured marker by uncommenting the line below:
305
+ // markerSpecies = "Rat"
304
306
  this.settingsStore.updateFeaturedMarker({
305
307
  identifier,
306
308
  marker: markerCurie,
@@ -412,7 +414,7 @@ export default {
412
414
  });
413
415
  }
414
416
  },
415
- flatmapMarkerZoomUpdate() {
417
+ flatmapMarkerUpdate() {
416
418
  return;
417
419
  },
418
420
  onResize: function () {
@@ -4,36 +4,13 @@ import { mapStores } from 'pinia';
4
4
  import { useSettingsStore } from '../stores/settings';
5
5
 
6
6
 
7
- /*
8
- * Function to check markers visibility at the given zoom level.
9
- * I have modified it to make sure the marker is displayed
10
- * if the uberon is not present in the hardcoded zoom-level list.
11
- */
12
- const checkMarkersAtZoomLevel = (flatmapImp, markers, zoomLevel, hoveredMarkers) => {
13
- if (markers) {
14
- markers.forEach(id => {
15
- let foundInArray = false;
16
- // First check if uberon is in the list, check for zoom level
17
- // if true. Note: markerZoomLevels is imported.
18
- for (let i = 0; i < markerZoomLevels.length; i++) {
19
- if (markerZoomLevels[i].id === id) {
20
- foundInArray = true;
21
- if (zoomLevel >= markerZoomLevels[i].showAtZoom) {
22
- let markerClass = "standard-marker"
23
- if (hoveredMarkers.includes(id)) markerClass = "hovered-marker"
24
- flatmapImp.addMarker(id, { className: markerClass, cluster: false});
25
- }
26
- break;
27
- }
28
- }
29
- // Did not match, add it regardless so we do not lose any
30
- // markers.
31
- if (!foundInArray) {
32
- flatmapImp.addMarker(id, {className: "standard-marker", cluster: false});
33
- }
34
- });
35
- }
36
- };
7
+ // remove duplicates by stringifying the objects
8
+ const removeDuplicates = function (arrayOfAnything) {
9
+ if (!arrayOfAnything) return []
10
+ return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
11
+ JSON.parse(e)
12
+ )
13
+ }
37
14
 
38
15
  /* eslint-disable no-alert, no-console */
39
16
  export default {
@@ -49,16 +26,14 @@ export default {
49
26
  payload: payload,
50
27
  type: this.entry.type,
51
28
  };
52
- this.flatmapMarkerZoomUpdate(false, undefined);
53
29
  this.$emit("resource-selected", result);
54
30
  }
55
31
  },
56
32
  /**
57
33
  * Function used for updating the flatmap markers.
58
- * It will only update the markers if zoom level has changed or
59
- * the force flag is true.
34
+ * We set the markers based on what was searched and the flatmap clusters them.
60
35
  */
61
- flatmapMarkerZoomUpdate(force, flatmap) {
36
+ flatmapMarkerUpdate(flatmap) {
62
37
  if (!this.flatmapReady) return;
63
38
 
64
39
  let flatmapImp = flatmap;
@@ -66,16 +41,32 @@ export default {
66
41
  flatmapImp = this.getFlatmapImp();
67
42
 
68
43
  if (flatmapImp) {
69
- let currentZoom = flatmapImp.getZoom()["zoom"];
70
- if (force || this.zoomLevel !== currentZoom) {
71
- this.zoomLevel = currentZoom;
72
- flatmapImp.clearMarkers();
73
- let markers = this.settingsStore.markers;
74
- let hoveredMarkers = this.settingsStore.hoveredMarkers;
75
- checkMarkersAtZoomLevel(flatmapImp, markers, this.zoomLevel, hoveredMarkers);
76
- if (this.entry.type === "MultiFlatmap") {
77
- this.restoreFeaturedMarkers(flatmapImp);
78
- }
44
+ // Set the dataset markers
45
+ let markers = this.settingsStore.markers;
46
+ markers = removeDuplicates(markers);
47
+ flatmapImp.clearMarkers();
48
+ flatmapImp.clearDatasetMarkers();
49
+ flatmapImp.addDatasetMarkers(markers);
50
+
51
+ // Set the hovered markers
52
+ let hoveredMarkers = this.settingsStore.hoveredMarkers
53
+ let previousHoveredMarkers = this.settingsStore.previousHoveredMarkers
54
+ hoveredMarkers.forEach(id => {
55
+ let markerClass = "standard-marker" + " hovered" // Space-separated CSS class names
56
+ let markerCluster = false // Disable cluster when related dataset is hovered
57
+ flatmapImp.addMarker(id, { className: markerClass, cluster: markerCluster })
58
+ })
59
+ if (previousHoveredMarkers !== null && previousHoveredMarkers.length >= 0) {
60
+ previousHoveredMarkers.forEach(id => {
61
+ let markerClass = "standard-marker"
62
+ let markerCluster = true
63
+ flatmapImp.addMarker(id, { className: markerClass, cluster: markerCluster })
64
+ })
65
+ }
66
+
67
+ // Set the featured markers
68
+ if (this.entry.type === "MultiFlatmap") {
69
+ this.restoreFeaturedMarkers(flatmapImp);
79
70
  }
80
71
  }
81
72
  },
@@ -84,7 +75,7 @@ export default {
84
75
  flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
85
76
  this.flatmapReady = true;
86
77
  const flatmapImp = flatmap.mapImp;
87
- this.flatmapMarkerZoomUpdate(true, flatmapImp);
78
+ this.flatmapMarkerUpdate(flatmapImp);
88
79
  }
89
80
  },
90
81
  }
@@ -15,9 +15,10 @@ export const useSettingsStore = defineStore('settings', {
15
15
  nlLinkPrefix: undefined,
16
16
  rootUrl: undefined,
17
17
  facets: { species: [], gender: [], organ: [] },
18
- facetLabels: [],
18
+ numberOfDatasetsForFacets: [],
19
19
  markers: [],
20
20
  hoveredMarkers: [],
21
+ previousHoveredMarkers: null,
21
22
  featuredMarkers: [],
22
23
  featuredMarkerIdentifiers: [],
23
24
  featuredMarkerDois: [],
@@ -70,6 +71,7 @@ export const useSettingsStore = defineStore('settings', {
70
71
  this.markers = markers;
71
72
  },
72
73
  updateHoveredMarkers(markers) {
74
+ this.previousHoveredMarkers = this.hoveredMarkers;
73
75
  this.hoveredMarkers = markers;
74
76
  },
75
77
  updateFeatured(datasetIdentifiers) {
@@ -142,8 +144,8 @@ export const useSettingsStore = defineStore('settings', {
142
144
  }
143
145
  }
144
146
  },
145
- updateFacetLabels(facetLabels) {
146
- this.facetLabels = facetLabels;
147
+ updateNumberOfDatasetsForFacets(numberOfDatasetsForFacets) {
148
+ this.numberOfDatasetsForFacets = numberOfDatasetsForFacets;
147
149
  },
148
150
  updateUseHelpModeDialog(helpModeOption) {
149
151
  this.useHelpModeDialog = helpModeOption;
@@ -1,62 +0,0 @@
1
- import { m as i } from "./ContentMixin-mZX2duoM.js";
2
- import { mapStores as n } from "pinia";
3
- import { u as f } from "./index-nmieCwQF.js";
4
- const p = (e, r, t, o) => {
5
- r && r.forEach((a) => {
6
- let s = !1;
7
- for (let m = 0; m < i.length; m++)
8
- if (i[m].id === a) {
9
- if (s = !0, t >= i[m].showAtZoom) {
10
- let l = "standard-marker";
11
- o.includes(a) && (l = "hovered-marker"), e.addMarker(a, { className: l, cluster: !1 });
12
- }
13
- break;
14
- }
15
- s || e.addMarker(a, { className: "standard-marker", cluster: !1 });
16
- });
17
- }, k = {
18
- computed: {
19
- ...n(f)
20
- },
21
- methods: {
22
- flatmapPanZoomCallback: function(e) {
23
- if (this.mouseHovered) {
24
- const r = {
25
- paneIndex: this.entry.id,
26
- eventType: "panZoom",
27
- payload: e,
28
- type: this.entry.type
29
- };
30
- this.flatmapMarkerZoomUpdate(!1, void 0), this.$emit("resource-selected", r);
31
- }
32
- },
33
- /**
34
- * Function used for updating the flatmap markers.
35
- * It will only update the markers if zoom level has changed or
36
- * the force flag is true.
37
- */
38
- flatmapMarkerZoomUpdate(e, r) {
39
- if (!this.flatmapReady)
40
- return;
41
- let t = r;
42
- if (t || (t = this.getFlatmapImp()), t) {
43
- let o = t.getZoom().zoom;
44
- if (e || this.zoomLevel !== o) {
45
- this.zoomLevel = o, t.clearMarkers();
46
- let a = this.settingsStore.markers, s = this.settingsStore.hoveredMarkers;
47
- p(t, a, this.zoomLevel, s), this.entry.type === "MultiFlatmap" && this.restoreFeaturedMarkers(t);
48
- }
49
- }
50
- },
51
- flatmapReadyForMarkerUpdates: function(e) {
52
- if (e) {
53
- e.enablePanZoomEvents(!0), this.flatmapReady = !0;
54
- const r = e.mapImp;
55
- this.flatmapMarkerZoomUpdate(!0, r);
56
- }
57
- }
58
- }
59
- };
60
- export {
61
- k as D
62
- };