@abi-software/flatmap-viewer 2.2.7 → 2.2.9
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/flatmap-viewer.js +13 -10
- package/src/info.js +0 -7
- package/src/interactions.js +111 -102
- package/src/pathways.js +19 -4
- package/src/styling.js +5 -5
- package/static/flatmap-viewer.css +3 -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.9``
|
|
42
42
|
|
|
43
43
|
Documentation
|
|
44
44
|
-------------
|
package/package.json
CHANGED
package/src/flatmap-viewer.js
CHANGED
|
@@ -58,7 +58,8 @@ class FlatMap
|
|
|
58
58
|
constructor(container, mapBaseUrl, mapDescription, resolve)
|
|
59
59
|
{
|
|
60
60
|
this._baseUrl = mapBaseUrl;
|
|
61
|
-
this.
|
|
61
|
+
this.__id = mapDescription.id;
|
|
62
|
+
this.__uuid = mapDescription.uuid;
|
|
62
63
|
this._details = mapDescription.details;
|
|
63
64
|
this._created = mapDescription.created;
|
|
64
65
|
this.__taxon = mapDescription.taxon;
|
|
@@ -75,7 +76,7 @@ class FlatMap
|
|
|
75
76
|
this.__idToAnnotation = new Map();
|
|
76
77
|
this.__datasetToFeatureIds = new Map();
|
|
77
78
|
this.__modelToFeatureIds = new Map();
|
|
78
|
-
this.
|
|
79
|
+
this.__mapSourceToFeatureIds = new Map();
|
|
79
80
|
for (const [featureId, annotation] of Object.entries(mapDescription.annotations)) {
|
|
80
81
|
this.__addAnnotation(featureId, annotation);
|
|
81
82
|
this.__searchIndex.indexMetadata(featureId, annotation);
|
|
@@ -354,7 +355,7 @@ class FlatMap
|
|
|
354
355
|
//==============
|
|
355
356
|
{
|
|
356
357
|
if (url.startsWith('/')) {
|
|
357
|
-
return `${this._baseUrl}flatmap/${this.
|
|
358
|
+
return `${this._baseUrl}flatmap/${this.__uuid}${url}`; // We don't want embedded `{` and `}` characters escaped
|
|
358
359
|
} else if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
|
359
360
|
console.log(`Invalid URL (${url}) in map's sources`);
|
|
360
361
|
}
|
|
@@ -402,7 +403,7 @@ class FlatMap
|
|
|
402
403
|
get id()
|
|
403
404
|
//======
|
|
404
405
|
{
|
|
405
|
-
return this.
|
|
406
|
+
return this.__uuid;
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
/**
|
|
@@ -424,7 +425,7 @@ class FlatMap
|
|
|
424
425
|
get uniqueId()
|
|
425
426
|
//============
|
|
426
427
|
{
|
|
427
|
-
return `${this.
|
|
428
|
+
return `${this.__uuid}-${this._mapNumber}`;
|
|
428
429
|
}
|
|
429
430
|
|
|
430
431
|
get activeLayerNames()
|
|
@@ -466,7 +467,7 @@ class FlatMap
|
|
|
466
467
|
this.__idToAnnotation.set(featureId, ann);
|
|
467
468
|
this.__updateFeatureIdMap('dataset', this.__datasetToFeatureIds, ann);
|
|
468
469
|
this.__updateFeatureIdMap('models', this.__modelToFeatureIds, ann);
|
|
469
|
-
this.__updateFeatureIdMap('source', this.
|
|
470
|
+
this.__updateFeatureIdMap('source', this.__mapSourceToFeatureIds, ann);
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
modelFeatureIds(anatomicalId)
|
|
@@ -490,7 +491,7 @@ class FlatMap
|
|
|
490
491
|
if (featureIds.length == 0) {
|
|
491
492
|
// We couldn't find a feature by anatomical id, so check dataset and source
|
|
492
493
|
featureIds.extend(this.__datasetToFeatureIds.get(anatomicalIds));
|
|
493
|
-
featureIds.extend(this.
|
|
494
|
+
featureIds.extend(this.__mapSourceToFeatureIds.get(anatomicalIds));
|
|
494
495
|
}
|
|
495
496
|
if (featureIds.length == 0 && this._userInteractions !== null) {
|
|
496
497
|
// We still haven't found a feature, so check connectivity
|
|
@@ -634,7 +635,7 @@ class FlatMap
|
|
|
634
635
|
return {
|
|
635
636
|
taxon: this.__taxon,
|
|
636
637
|
biologicalSex: this.__biologicalSex,
|
|
637
|
-
|
|
638
|
+
uuid: this.__uuid
|
|
638
639
|
};
|
|
639
640
|
}
|
|
640
641
|
|
|
@@ -1086,7 +1087,8 @@ export class MapManager
|
|
|
1086
1087
|
latestMap_(identifier)
|
|
1087
1088
|
//====================
|
|
1088
1089
|
{
|
|
1089
|
-
const mapDescribes = (
|
|
1090
|
+
const mapDescribes = (identifier.constructor.name === "String") ? identifier
|
|
1091
|
+
: ('uuid' in identifier) ? identifier.uuid
|
|
1090
1092
|
: ('taxon' in identifier) ? identifier.taxon
|
|
1091
1093
|
: null;
|
|
1092
1094
|
if (mapDescribes === null) {
|
|
@@ -1300,7 +1302,8 @@ export class MapManager
|
|
|
1300
1302
|
this._mapNumber += 1;
|
|
1301
1303
|
const flatmap = new FlatMap(container, this._mapServer.url(),
|
|
1302
1304
|
{
|
|
1303
|
-
id:
|
|
1305
|
+
id: map,
|
|
1306
|
+
uuid: mapId,
|
|
1304
1307
|
details: mapIndex,
|
|
1305
1308
|
taxon: map.taxon,
|
|
1306
1309
|
biologicalSex: map.biologicalSex,
|
package/src/info.js
CHANGED
|
@@ -247,13 +247,6 @@ export class InfoControl
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
const htmlList = [];
|
|
250
|
-
|
|
251
|
-
if (this._flatmap.options.showPosition) {
|
|
252
|
-
const position = location;
|
|
253
|
-
htmlList.push(`<span class="info-name">Position:</span>`);
|
|
254
|
-
htmlList.push(`<span class="info-value">(${position.lng}, ${position.lat})</span>`);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
250
|
for (const values of displayValues.values()) {
|
|
258
251
|
for (const prop of displayedProperties) {
|
|
259
252
|
if (prop in values) {
|
package/src/interactions.js
CHANGED
|
@@ -42,6 +42,7 @@ import {PathControl} from './controls.js';
|
|
|
42
42
|
import {SearchControl} from './search.js';
|
|
43
43
|
import {VECTOR_TILES_SOURCE} from './styling.js';
|
|
44
44
|
|
|
45
|
+
import * as pathways from './pathways.js';
|
|
45
46
|
import * as utils from './utils.js';
|
|
46
47
|
|
|
47
48
|
//==============================================================================
|
|
@@ -164,10 +165,8 @@ export class UserInteractions
|
|
|
164
165
|
|
|
165
166
|
for (const [id, ann] of flatmap.annotations) {
|
|
166
167
|
const feature = this.mapFeature_(id);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
this._map.setFeatureState(feature, { 'annotation-error': true });
|
|
170
|
-
console.log(`Annotation error, ${ann.layer}: ${ann.error} (${ann.text})`);
|
|
168
|
+
if (feature !== undefined) {
|
|
169
|
+
this._map.setFeatureState(feature, { 'annotated': true });
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
|
|
@@ -251,13 +250,15 @@ export class UserInteractions
|
|
|
251
250
|
//====================
|
|
252
251
|
{
|
|
253
252
|
const ann = this._flatmap.annotation(featureId);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
253
|
+
if (ann !== undefined) {
|
|
254
|
+
return {
|
|
255
|
+
id: featureId,
|
|
256
|
+
source: VECTOR_TILES_SOURCE,
|
|
257
|
+
sourceLayer: this._flatmap.options.separateLayers
|
|
258
|
+
? `${ann['layer']}_${ann['tile-layer']}`
|
|
259
|
+
: ann['tile-layer']
|
|
260
|
+
};
|
|
261
|
+
}
|
|
261
262
|
}
|
|
262
263
|
|
|
263
264
|
featureSelected_(featureId)
|
|
@@ -277,8 +278,10 @@ export class UserInteractions
|
|
|
277
278
|
this._selectedFeatureIds.set(featureId, this._selectedFeatureIds.get(featureId) + 1);
|
|
278
279
|
} else {
|
|
279
280
|
const feature = this.mapFeature_(featureId);
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
if (feature !== undefined) {
|
|
282
|
+
this._map.setFeatureState(feature, { 'selected': true });
|
|
283
|
+
this._selectedFeatureIds.set(featureId, 1);
|
|
284
|
+
}
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
287
|
|
|
@@ -292,8 +295,10 @@ export class UserInteractions
|
|
|
292
295
|
this._selectedFeatureIds.set(featureId, references - 1);
|
|
293
296
|
} else {
|
|
294
297
|
const feature = this.mapFeature_(featureId);
|
|
295
|
-
|
|
296
|
-
|
|
298
|
+
if (feature !== undefined) {
|
|
299
|
+
this._map.removeFeatureState(feature, 'selected');
|
|
300
|
+
this._selectedFeatureIds.delete(+featureId);
|
|
301
|
+
}
|
|
297
302
|
}
|
|
298
303
|
}
|
|
299
304
|
if (this._selectedFeatureIds.size === 0) {
|
|
@@ -306,7 +311,9 @@ export class UserInteractions
|
|
|
306
311
|
{
|
|
307
312
|
for (const featureId of this._selectedFeatureIds.keys()) {
|
|
308
313
|
const feature = this.mapFeature_(featureId);
|
|
309
|
-
|
|
314
|
+
if (feature !== undefined) {
|
|
315
|
+
this._map.removeFeatureState(feature, 'selected');
|
|
316
|
+
}
|
|
310
317
|
}
|
|
311
318
|
this._selectedFeatureIds.clear();
|
|
312
319
|
this._layerManager.setColour({...this.__colourOptions, dimmed: false});
|
|
@@ -318,7 +325,8 @@ export class UserInteractions
|
|
|
318
325
|
// Get the features covering the event's point that are in the active layers
|
|
319
326
|
|
|
320
327
|
return this._map.queryRenderedFeatures(event.point).filter(f => {
|
|
321
|
-
return (this.
|
|
328
|
+
return (this.__enabledFeature(f)
|
|
329
|
+
&& this.activeLayerNames.indexOf(f.sourceLayer) >= 0)
|
|
322
330
|
&& ('featureId' in f.properties);
|
|
323
331
|
}
|
|
324
332
|
);
|
|
@@ -327,8 +335,10 @@ export class UserInteractions
|
|
|
327
335
|
__activateFeature(feature)
|
|
328
336
|
//=======================
|
|
329
337
|
{
|
|
330
|
-
|
|
331
|
-
|
|
338
|
+
if (feature !== undefined) {
|
|
339
|
+
this._map.setFeatureState(feature, { active: true });
|
|
340
|
+
this._activeFeatures.push(feature);
|
|
341
|
+
}
|
|
332
342
|
}
|
|
333
343
|
|
|
334
344
|
resetActiveFeatures_()
|
|
@@ -617,17 +627,14 @@ export class UserInteractions
|
|
|
617
627
|
const tooltips = [];
|
|
618
628
|
for (const lineFeature of lineFeatures) {
|
|
619
629
|
const properties = lineFeature.properties;
|
|
620
|
-
if (
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
if (!tooltips.includes(cleanLabel)) {
|
|
629
|
-
tooltips.push(cleanLabel);
|
|
630
|
-
}
|
|
630
|
+
if ('label' in properties
|
|
631
|
+
&& (!('tooltip' in properties) || properties.tooltip)
|
|
632
|
+
&& !('labelled' in properties)) {
|
|
633
|
+
let tooltip = '';
|
|
634
|
+
const label = properties.label;
|
|
635
|
+
const cleanLabel = (label.substr(0, 1).toUpperCase() + label.substr(1)).replaceAll("\n", "<br/>");
|
|
636
|
+
if (!tooltips.includes(cleanLabel)) {
|
|
637
|
+
tooltips.push(cleanLabel);
|
|
631
638
|
}
|
|
632
639
|
}
|
|
633
640
|
}
|
|
@@ -662,13 +669,11 @@ export class UserInteractions
|
|
|
662
669
|
__featureEvent(type, feature)
|
|
663
670
|
//===========================
|
|
664
671
|
{
|
|
665
|
-
if (
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
return this._flatmap.featureEvent(type, feature.properties);
|
|
671
|
-
}
|
|
672
|
+
if (feature.sourceLayer === PATHWAYS_LAYER) { // I suspect this is never true as source layer
|
|
673
|
+
// names are like `neural_routes_pathways`
|
|
674
|
+
return this._flatmap.featureEvent(type, this._pathways.pathProperties(feature));
|
|
675
|
+
} else if ('properties' in feature) {
|
|
676
|
+
return this._flatmap.featureEvent(type, feature.properties);
|
|
672
677
|
}
|
|
673
678
|
return false;
|
|
674
679
|
}
|
|
@@ -704,7 +709,8 @@ export class UserInteractions
|
|
|
704
709
|
}
|
|
705
710
|
|
|
706
711
|
// Get all the features at the current point
|
|
707
|
-
const features = this._map.queryRenderedFeatures(event.point)
|
|
712
|
+
const features = this._map.queryRenderedFeatures(event.point)
|
|
713
|
+
.filter(feature => this.__enabledFeature(feature));
|
|
708
714
|
if (features.length === 0) {
|
|
709
715
|
this._lastFeatureMouseEntered = null;
|
|
710
716
|
this._lastFeatureModelsMouse = null;
|
|
@@ -742,17 +748,13 @@ export class UserInteractions
|
|
|
742
748
|
&& feature.properties.type.startsWith('line')) ));
|
|
743
749
|
if (lineFeatures.length > 0) {
|
|
744
750
|
tooltip = this.lineTooltip_(lineFeatures);
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
for (const featureId of this._pathways.lineFeatureIds(lineIds)) {
|
|
753
|
-
if (+featureId !== lineFeatureId) {
|
|
754
|
-
this.__activateFeature(this.mapFeature_(featureId));
|
|
755
|
-
}
|
|
751
|
+
for (const lineFeature of lineFeatures) {
|
|
752
|
+
const lineFeatureId = +lineFeature.properties.featureId; // Ensure numeric
|
|
753
|
+
this.__activateFeature(lineFeature);
|
|
754
|
+
const lineIds = new Set(lineFeatures.map(f => f.properties.featureId));
|
|
755
|
+
for (const featureId of this._pathways.lineFeatureIds(lineIds)) {
|
|
756
|
+
if (+featureId !== lineFeatureId) {
|
|
757
|
+
this.__activateFeature(this.mapFeature_(featureId));
|
|
756
758
|
}
|
|
757
759
|
}
|
|
758
760
|
}
|
|
@@ -841,31 +843,34 @@ export class UserInteractions
|
|
|
841
843
|
selectionEvent_(event, feature)
|
|
842
844
|
//=============================
|
|
843
845
|
{
|
|
844
|
-
const multipleSelect = event.ctrlKey || event.metaKey;
|
|
845
|
-
if (!multipleSelect) {
|
|
846
|
-
this.__unselectFeatures();
|
|
847
|
-
}
|
|
848
846
|
if (feature !== undefined) {
|
|
849
|
-
const
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
847
|
+
const clickedFeatureId = feature.id;
|
|
848
|
+
const dim = !('properties' in feature
|
|
849
|
+
&& 'kind' in feature.properties
|
|
850
|
+
&& ['cell-type', 'scaffold', 'tissue'].indexOf(feature.properties.kind) >= 0);
|
|
851
|
+
if (!(event.ctrlKey || event.metaKey)) {
|
|
852
|
+
let selecting = true;
|
|
853
|
+
for (const featureId of this._selectedFeatureIds.keys()) {
|
|
854
|
+
if (featureId === clickedFeatureId) {
|
|
855
|
+
selecting = false;
|
|
856
|
+
break;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
this.__unselectFeatures();
|
|
860
|
+
if (selecting) {
|
|
861
|
+
for (const feature of this._activeFeatures) {
|
|
862
|
+
this.selectFeature_(feature.id, dim);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
} else {
|
|
866
|
+
const clickedSelected = this.featureSelected_(clickedFeatureId);
|
|
854
867
|
for (const feature of this._activeFeatures) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
this.selectFeature_(featureId);
|
|
868
|
+
if (clickedSelected) {
|
|
869
|
+
this.unselectFeature_(feature.id);
|
|
858
870
|
} else {
|
|
859
|
-
this.
|
|
871
|
+
this.selectFeature_(feature.id, dim);
|
|
860
872
|
}
|
|
861
873
|
}
|
|
862
|
-
} else if (selecting) {
|
|
863
|
-
const dim = !('properties' in feature
|
|
864
|
-
&& 'kind' in feature.properties
|
|
865
|
-
&& ['cell-type', 'scaffold', 'tissue'].indexOf(feature.properties.kind) >= 0);
|
|
866
|
-
this.selectFeature_(featureId, dim);
|
|
867
|
-
} else {
|
|
868
|
-
this.unselectFeature_(featureId);
|
|
869
874
|
}
|
|
870
875
|
}
|
|
871
876
|
}
|
|
@@ -874,19 +879,14 @@ export class UserInteractions
|
|
|
874
879
|
//================
|
|
875
880
|
{
|
|
876
881
|
this.clearActiveMarker_();
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
} else if (this._activeFeatures.length > 1) {
|
|
882
|
-
const multipleSelect = originalEvent.ctrlKey || originalEvent.metaKey;
|
|
883
|
-
if (!multipleSelect) {
|
|
884
|
-
this.__unselectFeatures();
|
|
885
|
-
}
|
|
886
|
-
for (const feature of this._activeFeatures) {
|
|
887
|
-
this.selectFeature_(feature.id);
|
|
888
|
-
}
|
|
882
|
+
const clickedFeatures = this._map.queryRenderedFeatures(event.point);
|
|
883
|
+
if (clickedFeatures.length == 0){
|
|
884
|
+
this.__unselectFeatures();
|
|
885
|
+
return;
|
|
889
886
|
}
|
|
887
|
+
const clickedFeature = clickedFeatures[0];
|
|
888
|
+
const originalEvent = event.originalEvent;
|
|
889
|
+
this.selectionEvent_(originalEvent, clickedFeature);
|
|
890
890
|
if (this._modal) {
|
|
891
891
|
// Remove tooltip, reset active features, etc
|
|
892
892
|
this.__resetFeatureDisplay();
|
|
@@ -920,7 +920,8 @@ export class UserInteractions
|
|
|
920
920
|
//=======================
|
|
921
921
|
{
|
|
922
922
|
const state = this._map.getFeatureState(feature);
|
|
923
|
-
return
|
|
923
|
+
return (state !== undefined
|
|
924
|
+
&& (!('hidden' in state) || !state.hidden));
|
|
924
925
|
}
|
|
925
926
|
|
|
926
927
|
enablePaths_(enable, event)
|
|
@@ -937,11 +938,13 @@ export class UserInteractions
|
|
|
937
938
|
{
|
|
938
939
|
for (const featureId of featureIds) {
|
|
939
940
|
const feature = this.mapFeature_(featureId);
|
|
940
|
-
if (
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
941
|
+
if (feature !== undefined) {
|
|
942
|
+
if (enable) {
|
|
943
|
+
this._map.removeFeatureState(feature, 'hidden');
|
|
944
|
+
} else {
|
|
945
|
+
this._map.setFeatureState(feature, { 'hidden': true });
|
|
946
|
+
this._disabledPathFeatures = true;
|
|
947
|
+
}
|
|
945
948
|
}
|
|
946
949
|
}
|
|
947
950
|
}
|
|
@@ -967,18 +970,23 @@ export class UserInteractions
|
|
|
967
970
|
//===============================
|
|
968
971
|
{
|
|
969
972
|
// Disable/enable all paths except those with `pathTypes`
|
|
970
|
-
|
|
971
|
-
this.enablePathFeatures_(!enable, this._pathways.allFeatureIds());
|
|
972
|
-
|
|
973
973
|
if (Array.isArray(pathTypes)) {
|
|
974
|
-
for (const pathType of
|
|
975
|
-
|
|
974
|
+
for (const pathType of pathways.PATH_TYPES) {
|
|
975
|
+
if (pathTypes.indexOf(pathType.type) >= 0) {
|
|
976
|
+
this.enablePath(pathType.type, enable)
|
|
977
|
+
} else {
|
|
978
|
+
this.enablePath(pathType.type, !enable)
|
|
979
|
+
}
|
|
976
980
|
}
|
|
977
981
|
} else {
|
|
978
|
-
|
|
982
|
+
for (const pathType of pathways.PATH_TYPES) {
|
|
983
|
+
if (pathType.type === pathTypes) {
|
|
984
|
+
this.enablePath(pathType.type, enable)
|
|
985
|
+
} else {
|
|
986
|
+
this.enablePath(pathType.type, !enable)
|
|
987
|
+
}
|
|
988
|
+
}
|
|
979
989
|
}
|
|
980
|
-
|
|
981
|
-
this._disabledPathFeatures = true;
|
|
982
990
|
}
|
|
983
991
|
|
|
984
992
|
pathwaysFeatureIds(externalIds)
|
|
@@ -1149,14 +1157,15 @@ export class UserInteractions
|
|
|
1149
1157
|
const annotation = this.__annotationByMarkerId.get(markerId);
|
|
1150
1158
|
// The marker's feature
|
|
1151
1159
|
const feature = this.mapFeature_(annotation.featureId);
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1160
|
+
if (feature !== undefined) {
|
|
1161
|
+
if (event.type === 'mouseenter') {
|
|
1162
|
+
// Highlight on mouse enter
|
|
1163
|
+
this.resetActiveFeatures_();
|
|
1164
|
+
this.__activateFeature(feature);
|
|
1165
|
+
} else {
|
|
1166
|
+
this.selectionEvent_(event, feature)
|
|
1167
|
+
}
|
|
1158
1168
|
}
|
|
1159
|
-
|
|
1160
1169
|
// Show tooltip
|
|
1161
1170
|
const html = this.tooltipHtml_(annotation, true);
|
|
1162
1171
|
this.__showToolTip(html, marker.getLngLat());
|
package/src/pathways.js
CHANGED
|
@@ -34,7 +34,8 @@ export const PATH_TYPES = [
|
|
|
34
34
|
{ type: "sensory", label: "Sensory (afferent) neuron", colour: "#2A62F6"},
|
|
35
35
|
{ type: "somatic", label: "Somatic lower motor", colour: "#98561D"},
|
|
36
36
|
{ type: "symp-pre", label: "Sympathetic pre-ganglionic", colour: "#EA3423"},
|
|
37
|
-
{ type: "symp-post", label: "Sympathetic post-ganglionic", colour: "#EA3423"}
|
|
37
|
+
{ type: "symp-post", label: "Sympathetic post-ganglionic", colour: "#EA3423"},
|
|
38
|
+
{ type: "other", label: "Other neuron type", colour: "#888"}
|
|
38
39
|
];
|
|
39
40
|
|
|
40
41
|
//==============================================================================
|
|
@@ -120,7 +121,21 @@ export class Pathways
|
|
|
120
121
|
}
|
|
121
122
|
this._allFeatureIds = featureIds;
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
// Construct a list of path types we know about
|
|
125
|
+
const pathTypes = [];
|
|
126
|
+
for (const pathType of PATH_TYPES) {
|
|
127
|
+
pathTypes.push(pathType.type);
|
|
128
|
+
}
|
|
129
|
+
// Map unknown path types to ``other``
|
|
130
|
+
this.__typePaths = {};
|
|
131
|
+
this.__typePaths['other'] = [];
|
|
132
|
+
for (const [pathType, paths] of Object.entries(flatmap.pathways['type-paths'])) {
|
|
133
|
+
if (pathTypes.indexOf(pathType) >= 0) {
|
|
134
|
+
this.__typePaths[pathType] = paths;
|
|
135
|
+
} else {
|
|
136
|
+
this.__typePaths['other'].push(...paths);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
124
139
|
}
|
|
125
140
|
|
|
126
141
|
addPathsToFeatureSet_(paths, featureSet)
|
|
@@ -253,8 +268,8 @@ export class Pathways
|
|
|
253
268
|
//======================
|
|
254
269
|
{
|
|
255
270
|
const featureIds = new Set();
|
|
256
|
-
if (pathType in this.
|
|
257
|
-
this.addPathsToFeatureSet_(this.
|
|
271
|
+
if (pathType in this.__typePaths) {
|
|
272
|
+
this.addPathsToFeatureSet_(this.__typePaths[pathType], featureIds);
|
|
258
273
|
}
|
|
259
274
|
return featureIds;
|
|
260
275
|
}
|
package/src/styling.js
CHANGED
|
@@ -373,12 +373,12 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
373
373
|
],
|
|
374
374
|
'line-opacity': [
|
|
375
375
|
'case',
|
|
376
|
+
['boolean', ['feature-state', 'hidden'], false], 0.1,
|
|
376
377
|
['==', ['get', 'type'], 'bezier'], 1.0,
|
|
377
378
|
['boolean', ['get', 'invisible'], false], 0.001,
|
|
378
379
|
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
379
380
|
['boolean', ['feature-state', 'active'], false], 0.8,
|
|
380
|
-
|
|
381
|
-
dimmed ? 0.1 : 0.4
|
|
381
|
+
dimmed ? 0.1 : 0.5
|
|
382
382
|
],
|
|
383
383
|
'line-width': [
|
|
384
384
|
'let',
|
|
@@ -457,17 +457,17 @@ export class FeatureNerveLayer extends VectorStyleLayer
|
|
|
457
457
|
'paint': {
|
|
458
458
|
'line-color': [
|
|
459
459
|
'case',
|
|
460
|
+
['boolean', ['feature-state', 'hidden'], false], '#CCC',
|
|
460
461
|
['boolean', ['feature-state', 'active'], false], '#222',
|
|
461
462
|
['boolean', ['feature-state', 'selected'], false], 'red',
|
|
462
|
-
['boolean', ['feature-state', 'hidden'], false], '#CCC',
|
|
463
463
|
'#888'
|
|
464
464
|
],
|
|
465
465
|
'line-opacity': [
|
|
466
466
|
'case',
|
|
467
|
-
['boolean', ['feature-state', 'active'], false], 0.9,
|
|
468
|
-
['boolean', ['feature-state', 'selected'], false], 0.9,
|
|
469
467
|
['boolean', ['feature-state', 'hidden'], false], 0.3,
|
|
470
468
|
['boolean', ['get', 'invisible'], false], 0.001,
|
|
469
|
+
['boolean', ['feature-state', 'active'], false], 0.9,
|
|
470
|
+
['boolean', ['feature-state', 'selected'], false], 0.9,
|
|
471
471
|
0.9
|
|
472
472
|
],
|
|
473
473
|
'line-dasharray': [2, 1],
|