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

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.0",
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",
52
+ "@abi-software/map-side-bar": "^2.2.1-alpha-1",
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,7 @@
28
28
  @actionClick="actionClick"
29
29
  @tabClicked="tabClicked"
30
30
  @search-changed="searchChanged($event)"
31
+ @anatomy-in-datasets="updateMarkers($event)"
31
32
  @hover-changed="hoverChanged($event)"
32
33
  @contextUpdate="contextUpdate($event)"
33
34
  @datalink-clicked="datalinkClicked($event)"
@@ -93,6 +94,7 @@ export default {
93
94
  startUp: true,
94
95
  search: '',
95
96
  activeDockedId : 1,
97
+ hoveredMarkerDelay: undefined,
96
98
  filterTriggered: false,
97
99
  availableFacets: [],
98
100
  }
@@ -257,7 +259,14 @@ export default {
257
259
  hoverChanged: function (data) {
258
260
  const hoverEntries = data && data.anatomy ? data.anatomy : []
259
261
  this.settingsStore.updateHoveredMarkers(hoverEntries);
260
- EventBus.emit("markerUpdate");
262
+ if (!hoverEntries.length) {
263
+ this.hoveredMarkerDelay = setTimeout(() => {
264
+ EventBus.emit("markerUpdate");
265
+ }, 3000)
266
+ } else {
267
+ clearTimeout(this.hoveredMarkerDelay)
268
+ EventBus.emit("markerUpdate");
269
+ }
261
270
  },
262
271
  searchChanged: function (data) {
263
272
  if (data && data.type == "query-update") {
@@ -296,13 +305,10 @@ export default {
296
305
  }
297
306
  this.filterTriggered = false; // reset for next action
298
307
  }
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
- }
308
+ },
309
+ updateMarkers: function (data) {
310
+ this.settingsStore.updateMarkers(data);
311
+ EventBus.emit("markerUpdate");
306
312
  },
307
313
  getNewEntryId: function() {
308
314
  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
  },
@@ -346,9 +344,9 @@ export default {
346
344
  restoreFeaturedMarkers: function (flatmap) {
347
345
  this.settingsStore.resetFeaturedMarkerIdentifier();
348
346
  const markers = this.settingsStore.featuredMarkers;
349
- this.updateFeatureMarkers(markers, flatmap);
347
+ this.updateFeaturedMarkers(markers, flatmap);
350
348
  },
351
- updateFeatureMarkers: function (markers, flatmap) {
349
+ updateFeaturedMarkers: function (markers, flatmap) {
352
350
  this.showStarInLegend = false; // will show if we have a featured marker
353
351
  for (let index = 0; index < markers.length; ++index) {
354
352
  if (markers[index]) {
@@ -415,7 +413,7 @@ export default {
415
413
  return;
416
414
  }
417
415
 
418
- this.updateFeatureMarkers(markers, undefined);
416
+ this.updateFeaturedMarkers(markers, undefined);
419
417
  },
420
418
  },
421
419
  mounted: function () {
@@ -423,7 +421,7 @@ export default {
423
421
  this.getFeaturedDatasets();
424
422
 
425
423
  EventBus.on("markerUpdate", () => {
426
- this.flatmapMarkerZoomUpdate(true, undefined);
424
+ this.flatmapMarkerUpdate(this.$refs.multiflatmap.getCurrentFlatmap().mapImp);
427
425
  });
428
426
  },
429
427
  };
@@ -446,6 +444,12 @@ export default {
446
444
  cursor: pointer !important;
447
445
  z-index: 2;
448
446
  }
447
+ &.hovered {
448
+ div {
449
+ scale: 2;
450
+ transform: translate(0px, -5px);
451
+ }
452
+ }
449
453
  &.highlight-marker {
450
454
  visibility: visible !important;
451
455
  cursor: pointer !important;
@@ -455,14 +459,6 @@ export default {
455
459
  transform: translate(45px, -7px);
456
460
  }
457
461
  }
458
- &.hovered-marker {
459
- cursor: pointer !important;
460
- z-index: 2;
461
- div {
462
- scale: 2;
463
- transform: translate(0px, -5px);
464
- }
465
- }
466
462
  }
467
463
 
468
464
  </style>
@@ -300,7 +300,7 @@ export default {
300
300
  } catch (error) {
301
301
  markerSpecies = undefined;
302
302
  }
303
- this.updateFeatureMarkers([markerCurie], undefined)
303
+ this.updateFeaturedMarkers([markerCurie], undefined)
304
304
  this.settingsStore.updateFeaturedMarker({
305
305
  identifier,
306
306
  marker: markerCurie,
@@ -412,7 +412,7 @@ export default {
412
412
  });
413
413
  }
414
414
  },
415
- flatmapMarkerZoomUpdate() {
415
+ flatmapMarkerUpdate() {
416
416
  return;
417
417
  },
418
418
  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,24 @@ 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.addDatasetMarkers(markers);
49
+
50
+ // Set the hovered markers
51
+ let hoveredMarkers = this.settingsStore.hoveredMarkers
52
+ hoveredMarkers = removeDuplicates(hoveredMarkers);
53
+ hoveredMarkers.forEach(id => {
54
+ let markerClass = "standard-marker" + " hovered" // Space-separated CSS class names
55
+ let markerCluster = false // Disable cluster when related dataset is hovered
56
+ flatmapImp.addMarker(id, { className: markerClass, cluster: markerCluster })
57
+ })
58
+
59
+ // Set the featured markers
60
+ if (this.entry.type === "MultiFlatmap") {
61
+ this.restoreFeaturedMarkers(flatmapImp);
79
62
  }
80
63
  }
81
64
  },
@@ -84,7 +67,7 @@ export default {
84
67
  flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
85
68
  this.flatmapReady = true;
86
69
  const flatmapImp = flatmap.mapImp;
87
- this.flatmapMarkerZoomUpdate(true, flatmapImp);
70
+ this.flatmapMarkerUpdate(flatmapImp);
88
71
  }
89
72
  },
90
73
  }
@@ -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
- };