@abi-software/flatmap-viewer 2.2.3 → 2.2.5
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 +20 -19
- package/src/pathways.js +10 -0
- package/src/styling.js +1 -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.5``
|
|
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
|
}
|
|
@@ -900,11 +894,18 @@ export class UserInteractions
|
|
|
900
894
|
}
|
|
901
895
|
}
|
|
902
896
|
|
|
903
|
-
|
|
904
|
-
|
|
897
|
+
__activateRelatedFeatures(feature)
|
|
898
|
+
//================================
|
|
905
899
|
{
|
|
906
|
-
|
|
907
|
-
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
|
+
}
|
|
908
909
|
}
|
|
909
910
|
}
|
|
910
911
|
|
|
@@ -912,7 +913,7 @@ export class UserInteractions
|
|
|
912
913
|
//=======================
|
|
913
914
|
{
|
|
914
915
|
const state = this._map.getFeatureState(feature);
|
|
915
|
-
return
|
|
916
|
+
return true;
|
|
916
917
|
}
|
|
917
918
|
|
|
918
919
|
enablePaths_(enable, event)
|
|
@@ -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.
|
|
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
|
{
|
package/src/styling.js
CHANGED
|
@@ -117,6 +117,7 @@ export class FeatureFillLayer extends VectorStyleLayer
|
|
|
117
117
|
const paintStyle = {
|
|
118
118
|
'fill-color': [
|
|
119
119
|
'case',
|
|
120
|
+
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
120
121
|
['has', 'colour'], ['get', 'colour'],
|
|
121
122
|
['boolean', ['feature-state', 'active'], false], coloured ? '#D88' : '#CCC',
|
|
122
123
|
['any',
|