@abi-software/flatmapvuer 1.7.3 → 1.7.4-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.3",
3
+ "version": "1.7.4-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -1716,7 +1716,7 @@ export default {
1716
1716
  * Function to create tooltip for the provided connectivity data.
1717
1717
  * @arg {Array} `connectivityData`
1718
1718
  */
1719
- createTooltipForConnectivity: function (connectivityData) {
1719
+ createTooltipForConnectivity: function (connectivityData, geojsonId) {
1720
1720
  // combine all labels to show together
1721
1721
  // content type must be DOM object to use HTML
1722
1722
  const labelsContainer = document.createElement('div');
@@ -1733,7 +1733,7 @@ export default {
1733
1733
  });
1734
1734
 
1735
1735
  this.mapImp.showPopup(
1736
- connectivityData[0].featureId,
1736
+ geojsonId,
1737
1737
  labelsContainer,
1738
1738
  {
1739
1739
  className: 'custom-popup flatmap-tooltip-popup',
@@ -1750,6 +1750,7 @@ export default {
1750
1750
  showConnectivityTooltips: function (payload) {
1751
1751
  const { connectivityInfo, data } = payload;
1752
1752
  const featuresToHighlight = [];
1753
+ const geojsonHighlights = [];
1753
1754
  const connectivityData = [];
1754
1755
  const filteredConnectivityData = [];
1755
1756
  const errorData = [];
@@ -1785,16 +1786,31 @@ export default {
1785
1786
  id,
1786
1787
  label,
1787
1788
  });
1788
- featuresToHighlight.push(id);
1789
1789
  } else {
1790
1790
  errorData.push(connectivity);
1791
1791
  }
1792
1792
  });
1793
1793
 
1794
1794
  if (filteredConnectivityData.length) {
1795
- // show tooltip of the first item
1796
- // with all labels
1797
- 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);
1798
1814
  } else {
1799
1815
  errorData.push(...connectivityData);
1800
1816
  // Close all tooltips on the current flatmap element
@@ -1807,7 +1823,13 @@ export default {
1807
1823
  }
1808
1824
 
1809
1825
  // highlight all available features
1810
- this.mapImp.selectFeatures(featuresToHighlight);
1826
+ const featureIdsToHighlight = this.mapImp.modelFeatureIdList(featuresToHighlight);
1827
+ const allFeaturesToHighlight = [
1828
+ ...featureIdsToHighlight,
1829
+ ...geojsonHighlights
1830
+ ];
1831
+
1832
+ this.mapImp.selectGeoJSONFeatures(allFeaturesToHighlight);
1811
1833
  }
1812
1834
  },
1813
1835
  emitConnectivityGraphError: function (errorData) {