@abi-software/flatmap-viewer 2.2.3 → 2.2.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/README.rst CHANGED
@@ -38,7 +38,7 @@ The map server endpoint is specified as ``MAP_ENDPOINT`` in ``src/main.js``. It
38
38
  Package Installation
39
39
  ====================
40
40
 
41
- * ``npm install @abi-software/flatmap-viewer@2.2.3``
41
+ * ``npm install @abi-software/flatmap-viewer@2.2.4``
42
42
 
43
43
  Documentation
44
44
  -------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmap-viewer",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Flatmap viewer using Maplibre GL",
5
5
  "repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
6
6
  "main": "src/main.js",
@@ -323,7 +323,7 @@ export class UserInteractions
323
323
  );
324
324
  }
325
325
 
326
- activateFeature_(feature)
326
+ __activateFeature(feature)
327
327
  //=======================
328
328
  {
329
329
  this._map.setFeatureState(feature, { active: true });
@@ -342,7 +342,7 @@ export class UserInteractions
342
342
  //==========================
343
343
  {
344
344
  featureId = +featureId; // Ensure numeric
345
- this.activateFeature_(this.mapFeature_(featureId));
345
+ this.__activateFeature(this.mapFeature_(featureId));
346
346
  }
347
347
 
348
348
  unhighlightFeatures_()
@@ -732,7 +732,7 @@ export class UserInteractions
732
732
  let tooltip = '';
733
733
  if (displayInfo) {
734
734
  if (!'tooltip' in features[0].properties) {
735
- this.activateFeature_(features[0]);
735
+ this.__activateFeature(features[0]);
736
736
  }
737
737
  info = this._infoControl.featureInformation(features, event.lngLat);
738
738
  }
@@ -746,11 +746,11 @@ export class UserInteractions
746
746
  tooltip = this.lineTooltip_(enabledFeatures);
747
747
  for (const lineFeature of enabledFeatures) {
748
748
  const lineFeatureId = +lineFeature.properties.featureId; // Ensure numeric
749
- this.activateFeature_(lineFeature);
749
+ this.__activateFeature(lineFeature);
750
750
  const lineIds = new Set(enabledFeatures.map(f => f.properties.featureId));
751
751
  for (const featureId of this._pathways.lineFeatureIds(lineIds)) {
752
752
  if (+featureId !== lineFeatureId) {
753
- this.activateFeature_(this.mapFeature_(featureId));
753
+ this.__activateFeature(this.mapFeature_(featureId));
754
754
  }
755
755
  }
756
756
  }
@@ -799,14 +799,8 @@ export class UserInteractions
799
799
  }
800
800
  info = `<div id="info-control-info">${htmlList.join('\n')}</div>`;
801
801
  }
802
- if ('nerveId' in feature.properties) {
803
- if (feature.properties.active) {
804
- this.activateFeature_(feature);
805
- }
806
- this.activateNerveFeatures_(feature.properties.nerveId);
807
- } else {
808
- this.activateFeature_(feature);
809
- }
802
+ this.__activateFeature(feature);
803
+ this.__activateRelatedFeatures(feature);
810
804
  if ('hyperlink' in feature.properties) {
811
805
  this._map.getCanvas().style.cursor = 'pointer';
812
806
  }
@@ -900,11 +894,18 @@ export class UserInteractions
900
894
  }
901
895
  }
902
896
 
903
- activateNerveFeatures_(nerveId)
904
- //=============================
897
+ __activateRelatedFeatures(feature)
898
+ //================================
905
899
  {
906
- for (const featureId of this._pathways.nerveFeatureIds(nerveId)) {
907
- this.activateFeature_(this.mapFeature_(featureId));
900
+ if ('nerveId' in feature.properties) {
901
+ for (const featureId of this._pathways.nerveFeatureIds(feature.properties.nerveId)) {
902
+ this.__activateFeature(this.mapFeature_(featureId));
903
+ }
904
+ }
905
+ if ('nodeId' in feature.properties) {
906
+ for (const featureId of this._pathways.nodeFeatureIds(feature.properties.nodeId)) {
907
+ this.__activateFeature(this.mapFeature_(featureId));
908
+ }
908
909
  }
909
910
  }
910
911
 
@@ -1144,7 +1145,7 @@ export class UserInteractions
1144
1145
  if (event.type === 'mouseenter') {
1145
1146
  // Highlight on mouse enter
1146
1147
  this.resetActiveFeatures_();
1147
- this.activateFeature_(feature);
1148
+ this.__activateFeature(feature);
1148
1149
  } else {
1149
1150
  this.selectionEvent_(event, feature)
1150
1151
  }
package/src/pathways.js CHANGED
@@ -175,6 +175,16 @@ export class Pathways
175
175
  return featureIds;
176
176
  }
177
177
 
178
+ nodeFeatureIds(nodeId)
179
+ //===================
180
+ {
181
+ const featureIds = new Set();
182
+ if (nodeId in this._nodePaths) {
183
+ this.addPathsToFeatureSet_(this._nodePaths[nodeId], featureIds);
184
+ }
185
+ return featureIds;
186
+ }
187
+
178
188
  pathProperties(feature)
179
189
  //=====================
180
190
  {