@abi-software/flatmap-viewer 2.2.8 → 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/interactions.js +40 -41
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/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
|
//==============================================================================
|
|
@@ -842,31 +843,34 @@ export class UserInteractions
|
|
|
842
843
|
selectionEvent_(event, feature)
|
|
843
844
|
//=============================
|
|
844
845
|
{
|
|
845
|
-
const multipleSelect = event.ctrlKey || event.metaKey;
|
|
846
|
-
if (!multipleSelect) {
|
|
847
|
-
this.__unselectFeatures();
|
|
848
|
-
}
|
|
849
846
|
if (feature !== undefined) {
|
|
850
|
-
const
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
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);
|
|
855
867
|
for (const feature of this._activeFeatures) {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
this.selectFeature_(featureId);
|
|
868
|
+
if (clickedSelected) {
|
|
869
|
+
this.unselectFeature_(feature.id);
|
|
859
870
|
} else {
|
|
860
|
-
this.
|
|
871
|
+
this.selectFeature_(feature.id, dim);
|
|
861
872
|
}
|
|
862
873
|
}
|
|
863
|
-
} else if (selecting) {
|
|
864
|
-
const dim = !('properties' in feature
|
|
865
|
-
&& 'kind' in feature.properties
|
|
866
|
-
&& ['cell-type', 'scaffold', 'tissue'].indexOf(feature.properties.kind) >= 0);
|
|
867
|
-
this.selectFeature_(featureId, dim);
|
|
868
|
-
} else {
|
|
869
|
-
this.unselectFeature_(featureId);
|
|
870
874
|
}
|
|
871
875
|
}
|
|
872
876
|
}
|
|
@@ -875,24 +879,14 @@ export class UserInteractions
|
|
|
875
879
|
//================
|
|
876
880
|
{
|
|
877
881
|
this.clearActiveMarker_();
|
|
878
|
-
const clickedFeatures = this._map.queryRenderedFeatures(event.point)
|
|
879
|
-
.filter(feature => this.__enabledFeature(feature));
|
|
882
|
+
const clickedFeatures = this._map.queryRenderedFeatures(event.point);
|
|
880
883
|
if (clickedFeatures.length == 0){
|
|
884
|
+
this.__unselectFeatures();
|
|
881
885
|
return;
|
|
882
886
|
}
|
|
883
887
|
const clickedFeature = clickedFeatures[0];
|
|
884
888
|
const originalEvent = event.originalEvent;
|
|
885
|
-
|
|
886
|
-
this.selectionEvent_(originalEvent, clickedFeature);
|
|
887
|
-
} else if (this._activeFeatures.length > 1) {
|
|
888
|
-
const multipleSelect = originalEvent.ctrlKey || originalEvent.metaKey;
|
|
889
|
-
if (!multipleSelect) {
|
|
890
|
-
this.__unselectFeatures();
|
|
891
|
-
}
|
|
892
|
-
for (const feature of this._activeFeatures) {
|
|
893
|
-
this.selectFeature_(feature.id);
|
|
894
|
-
}
|
|
895
|
-
}
|
|
889
|
+
this.selectionEvent_(originalEvent, clickedFeature);
|
|
896
890
|
if (this._modal) {
|
|
897
891
|
// Remove tooltip, reset active features, etc
|
|
898
892
|
this.__resetFeatureDisplay();
|
|
@@ -976,18 +970,23 @@ export class UserInteractions
|
|
|
976
970
|
//===============================
|
|
977
971
|
{
|
|
978
972
|
// Disable/enable all paths except those with `pathTypes`
|
|
979
|
-
|
|
980
|
-
this.enablePathFeatures_(!enable, this._pathways.allFeatureIds());
|
|
981
|
-
|
|
982
973
|
if (Array.isArray(pathTypes)) {
|
|
983
|
-
for (const pathType of
|
|
984
|
-
|
|
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
|
+
}
|
|
985
980
|
}
|
|
986
981
|
} else {
|
|
987
|
-
|
|
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
|
+
}
|
|
988
989
|
}
|
|
989
|
-
|
|
990
|
-
this._disabledPathFeatures = true;
|
|
991
990
|
}
|
|
992
991
|
|
|
993
992
|
pathwaysFeatureIds(externalIds)
|