@abi-software/flatmapvuer 1.7.2 → 1.7.3-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/flatmapvuer",
3
- "version": "1.7.2",
3
+ "version": "1.7.3-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -43,7 +43,7 @@
43
43
  "./src/*": "./src/*"
44
44
  },
45
45
  "dependencies": {
46
- "@abi-software/flatmap-viewer": "3.2.10",
46
+ "@abi-software/flatmap-viewer": "3.2.12",
47
47
  "@abi-software/map-utilities": "^1.3.1",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
49
  "@abi-software/svg-sprite": "^1.0.1",
@@ -644,7 +644,7 @@ const centroid = (geometry) => {
644
644
  } else {
645
645
  coordinates = geometry.coordinates
646
646
  }
647
- if (coordinates) {
647
+ if (coordinates) {
648
648
  if (!(geometry.type === 'Point')) {
649
649
  coordinates.map((coor) => {
650
650
  featureGeometry.lng += parseFloat(coor[0])
@@ -1703,6 +1703,12 @@ export default {
1703
1703
  * Function to remove active tooltips on map.
1704
1704
  */
1705
1705
  removeActiveTooltips: function () {
1706
+ // Remove active tooltip/popup on map
1707
+ if (this.mapImp) {
1708
+ this.mapImp.removePopup();
1709
+ }
1710
+
1711
+ // Fallback: remove any existing toolitp on DOM
1706
1712
  const tooltips = this.$el.querySelectorAll('.flatmap-tooltip-popup');
1707
1713
  tooltips.forEach((tooltip) => tooltip.remove());
1708
1714
  },
@@ -1710,7 +1716,7 @@ export default {
1710
1716
  * Function to create tooltip for the provided connectivity data.
1711
1717
  * @arg {Array} `connectivityData`
1712
1718
  */
1713
- createTooltipForConnectivity: function (connectivityData) {
1719
+ createTooltipForConnectivity: function (connectivityData, geojsonId) {
1714
1720
  // combine all labels to show together
1715
1721
  // content type must be DOM object to use HTML
1716
1722
  const labelsContainer = document.createElement('div');
@@ -1727,7 +1733,7 @@ export default {
1727
1733
  });
1728
1734
 
1729
1735
  this.mapImp.showPopup(
1730
- connectivityData[0].featureId,
1736
+ geojsonId,
1731
1737
  labelsContainer,
1732
1738
  {
1733
1739
  className: 'custom-popup flatmap-tooltip-popup',
@@ -1744,6 +1750,7 @@ export default {
1744
1750
  showConnectivityTooltips: function (payload) {
1745
1751
  const { connectivityInfo, data } = payload;
1746
1752
  const featuresToHighlight = [];
1753
+ const geojsonHighlights = [];
1747
1754
  const connectivityData = [];
1748
1755
  const filteredConnectivityData = [];
1749
1756
  const errorData = [];
@@ -1779,16 +1786,31 @@ export default {
1779
1786
  id,
1780
1787
  label,
1781
1788
  });
1782
- featuresToHighlight.push(id);
1783
1789
  } else {
1784
1790
  errorData.push(connectivity);
1785
1791
  }
1786
1792
  });
1787
1793
 
1788
1794
  if (filteredConnectivityData.length) {
1789
- // show tooltip of the first item
1790
- // with all labels
1791
- this.createTooltipForConnectivity(filteredConnectivityData);
1795
+ let geojsonId = filteredConnectivityData[0].featureId;
1796
+
1797
+ this.mapImp.annotations.forEach((annotation) => {
1798
+ const anatomicalNodes = annotation['anatomical-nodes'];
1799
+
1800
+ if (anatomicalNodes) {
1801
+ const anatomicalNodesString = anatomicalNodes.join('');
1802
+ const foundItem = filteredConnectivityData.every((item) =>
1803
+ anatomicalNodesString.indexOf(item.id) !== -1
1804
+ );
1805
+
1806
+ if (foundItem) {
1807
+ geojsonId = annotation.featureId;
1808
+ geojsonHighlights.push(geojsonId);
1809
+ }
1810
+ }
1811
+ });
1812
+
1813
+ this.createTooltipForConnectivity(filteredConnectivityData, geojsonId);
1792
1814
  } else {
1793
1815
  errorData.push(...connectivityData);
1794
1816
  // Close all tooltips on the current flatmap element
@@ -1802,6 +1824,10 @@ export default {
1802
1824
 
1803
1825
  // highlight all available features
1804
1826
  this.mapImp.selectFeatures(featuresToHighlight);
1827
+
1828
+ if (geojsonHighlights.length) {
1829
+ this.mapImp.selectGeoJSONFeatures(geojsonHighlights);
1830
+ }
1805
1831
  }
1806
1832
  },
1807
1833
  emitConnectivityGraphError: function (errorData) {
@@ -3405,6 +3431,12 @@ export default {
3405
3431
  border-style: solid;
3406
3432
  flex-shrink: 0;
3407
3433
  }
3434
+
3435
+ hr {
3436
+ margin: 0.5rem 0;
3437
+ border: 0;
3438
+ border-top: 1px solid var(--el-border-color);
3439
+ }
3408
3440
  }
3409
3441
  .maplibregl-popup-tip {
3410
3442
  display: none;