@vcmap/core 6.1.6 → 6.1.7
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.
|
@@ -13,6 +13,9 @@ class FeatureProviderInteraction extends AbstractInteraction {
|
|
|
13
13
|
}
|
|
14
14
|
// eslint-disable-next-line class-methods-use-this
|
|
15
15
|
async pipe(event) {
|
|
16
|
+
if (event.feature) {
|
|
17
|
+
return event;
|
|
18
|
+
}
|
|
16
19
|
const layersWithProvider = [...event.map.layerCollection]
|
|
17
20
|
.filter((l) => {
|
|
18
21
|
return (l.featureProvider &&
|
|
@@ -27,17 +30,15 @@ class FeatureProviderInteraction extends AbstractInteraction {
|
|
|
27
30
|
const features = (await Promise.all(layersWithProvider.map((l) => l.featureProvider?.getFeaturesByCoordinate?.(event.position, resolution, l.headers))))
|
|
28
31
|
.filter((f) => !!f)
|
|
29
32
|
.flat();
|
|
30
|
-
if (features.length
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
event.feature = features[0];
|
|
40
|
-
}
|
|
33
|
+
if (features.length === 1) {
|
|
34
|
+
event.feature = features[0];
|
|
35
|
+
}
|
|
36
|
+
else if (features.length > 1) {
|
|
37
|
+
const feature = new Feature({ features });
|
|
38
|
+
feature[isProvidedFeature] = true; // backward compatibility, may remove in future
|
|
39
|
+
feature[isProvidedClusterFeature] = true;
|
|
40
|
+
feature.setGeometry(new Point(event.position));
|
|
41
|
+
event.feature = feature;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
return event;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureProviderInteraction.js","sourceRoot":"","sources":["../../../src/interaction/featureProviderInteraction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,mBAEN,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AAC,CAAC;iBAClB,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"featureProviderInteraction.js","sourceRoot":"","sources":["../../../src/interaction/featureProviderInteraction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,mBAEN,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,8CAA8C,CAAC;AAEtD;;GAEG;AACH,MAAM,0BAA2B,SAAQ,mBAAmB;IAC1D;QACE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;QAEpE,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,kDAAkD;IAClD,KAAK,CAAC,IAAI,CAAC,KAAuB;QAChC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,kBAAkB,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC;aACtD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;YACZ,OAAO,CACL,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;gBACxB,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CACzC,CAAC;QACJ,CAAC,CAAC;aACD,OAAO,EAAE,CAAC;QAEb,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAC/C,KAAK,CAAC,QAAsB,CAC7B,CAAC;YACF,4EAA4E;YAC5E,MAAM,QAAQ,GAAG,CACf,MAAM,OAAO,CAAC,GAAG,CACf,kBAAkB,CAAC,GAAG,CACpB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,eAAe,EAAE,uBAAuB,EAAE,CAC1C,KAAK,CAAC,QAAsB,EAC5B,UAAU,EACV,CAAC,CAAC,OAAO,CACV,CACJ,CACF,CACF;iBACE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;iBAClB,IAAI,EAAE,CAAC;YACV,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,KAAK,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC;iBAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAC1C,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC,+CAA+C;gBAClF,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC;gBACzC,OAAO,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,QAAsB,CAAC,CAAC,CAAC;gBAC7D,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,eAAe,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,10 @@ class FeatureProviderInteraction extends AbstractInteraction {
|
|
|
27
27
|
|
|
28
28
|
// eslint-disable-next-line class-methods-use-this
|
|
29
29
|
async pipe(event: InteractionEvent): Promise<InteractionEvent> {
|
|
30
|
+
if (event.feature) {
|
|
31
|
+
return event;
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
const layersWithProvider = [...event.map.layerCollection]
|
|
31
35
|
.filter((l) => {
|
|
32
36
|
return (
|
|
@@ -57,19 +61,17 @@ class FeatureProviderInteraction extends AbstractInteraction {
|
|
|
57
61
|
)
|
|
58
62
|
.filter((f) => !!f)
|
|
59
63
|
.flat();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} else if (!event.feature) {
|
|
69
|
-
event.feature = features[0];
|
|
70
|
-
}
|
|
64
|
+
if (features.length === 1) {
|
|
65
|
+
event.feature = features[0];
|
|
66
|
+
} else if (features.length > 1) {
|
|
67
|
+
const feature = new Feature({ features });
|
|
68
|
+
feature[isProvidedFeature] = true; // backward compatibility, may remove in future
|
|
69
|
+
feature[isProvidedClusterFeature] = true;
|
|
70
|
+
feature.setGeometry(new Point(event.position as Coordinate));
|
|
71
|
+
event.feature = feature;
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
|
|
73
75
|
return event;
|
|
74
76
|
}
|
|
75
77
|
}
|