@abi-software/flatmap-viewer 2.2.2 → 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 +1 -1
- package/package.json +1 -1
- package/src/interactions.js +27 -21
- package/src/pathways.js +10 -0
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.
|
|
41
|
+
* ``npm install @abi-software/flatmap-viewer@2.2.4``
|
|
42
42
|
|
|
43
43
|
Documentation
|
|
44
44
|
-------------
|
package/package.json
CHANGED
package/src/interactions.js
CHANGED
|
@@ -323,7 +323,7 @@ export class UserInteractions
|
|
|
323
323
|
);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
803
|
-
|
|
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
|
}
|
|
@@ -837,8 +831,8 @@ export class UserInteractions
|
|
|
837
831
|
}
|
|
838
832
|
}
|
|
839
833
|
|
|
840
|
-
selectionEvent_(
|
|
841
|
-
|
|
834
|
+
selectionEvent_(event, feature)
|
|
835
|
+
//=============================
|
|
842
836
|
{
|
|
843
837
|
const multipleSelect = event.ctrlKey || event.metaKey;
|
|
844
838
|
if (!multipleSelect) {
|
|
@@ -874,9 +868,14 @@ export class UserInteractions
|
|
|
874
868
|
{
|
|
875
869
|
this.clearActiveMarker_();
|
|
876
870
|
const clickedFeature = this._map.queryRenderedFeatures(event.point)[0];
|
|
871
|
+
const originalEvent = event.originalEvent;
|
|
877
872
|
if (clickedFeature === undefined || this._activeFeatures.length === 1) {
|
|
878
|
-
this.selectionEvent_(
|
|
873
|
+
this.selectionEvent_(originalEvent, clickedFeature);
|
|
879
874
|
} else if (this._activeFeatures.length > 1) {
|
|
875
|
+
const multipleSelect = originalEvent.ctrlKey || originalEvent.metaKey;
|
|
876
|
+
if (!multipleSelect) {
|
|
877
|
+
this.__unselectFeatures();
|
|
878
|
+
}
|
|
880
879
|
for (const feature of this._activeFeatures) {
|
|
881
880
|
this.selectFeature_(feature.id);
|
|
882
881
|
}
|
|
@@ -895,11 +894,18 @@ export class UserInteractions
|
|
|
895
894
|
}
|
|
896
895
|
}
|
|
897
896
|
|
|
898
|
-
|
|
899
|
-
|
|
897
|
+
__activateRelatedFeatures(feature)
|
|
898
|
+
//================================
|
|
900
899
|
{
|
|
901
|
-
|
|
902
|
-
this.
|
|
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
|
+
}
|
|
903
909
|
}
|
|
904
910
|
}
|
|
905
911
|
|
|
@@ -1139,7 +1145,7 @@ export class UserInteractions
|
|
|
1139
1145
|
if (event.type === 'mouseenter') {
|
|
1140
1146
|
// Highlight on mouse enter
|
|
1141
1147
|
this.resetActiveFeatures_();
|
|
1142
|
-
this.
|
|
1148
|
+
this.__activateFeature(feature);
|
|
1143
1149
|
} else {
|
|
1144
1150
|
this.selectionEvent_(event, feature)
|
|
1145
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
|
{
|