@geospatial-sdk/openlayers 0.0.5-dev.51 → 0.0.5-dev.53
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/dist/map/feature-hover.d.ts +4 -4
- package/dist/map/feature-hover.d.ts.map +1 -1
- package/dist/map/feature-hover.js +28 -7
- package/dist/map/feature-selection.d.ts +8 -0
- package/dist/map/feature-selection.d.ts.map +1 -0
- package/dist/map/feature-selection.js +76 -0
- package/dist/map/get-features.d.ts +10 -9
- package/dist/map/get-features.d.ts.map +1 -1
- package/dist/map/get-features.js +60 -31
- package/dist/map/layer-update.d.ts.map +1 -1
- package/dist/map/layer-update.js +8 -0
- package/dist/map/listen.d.ts +4 -0
- package/dist/map/listen.d.ts.map +1 -0
- package/dist/map/listen.js +83 -0
- package/dist/map/register-events.d.ts +1 -1
- package/dist/map/register-events.d.ts.map +1 -1
- package/dist/map/register-events.js +7 -2
- package/dist/map/resolved-map-state.d.ts +8 -0
- package/dist/map/resolved-map-state.d.ts.map +1 -0
- package/dist/map/resolved-map-state.js +27 -0
- package/dist/map/styles.d.ts +16 -0
- package/dist/map/styles.d.ts.map +1 -0
- package/dist/map/styles.js +77 -0
- package/dist/resolved-state/resolved-map-state.d.ts +2 -0
- package/dist/resolved-state/resolved-map-state.d.ts.map +1 -0
- package/dist/resolved-state/resolved-map-state.js +1 -0
- package/lib/map/feature-hover.ts +52 -17
- package/lib/map/get-features.test.ts +32 -20
- package/lib/map/get-features.ts +85 -48
- package/lib/map/handle-errors.test.ts +4 -4
- package/lib/map/layer-update.test.ts +6 -1
- package/lib/map/layer-update.ts +16 -1
- package/lib/map/register-events.test.ts +60 -64
- package/lib/map/register-events.ts +13 -5
- package/package.json +3 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Map, { MapObjectEventTypes } from "ol/Map.js";
|
|
2
1
|
import {
|
|
3
2
|
FeaturesClickEventType,
|
|
4
3
|
FeaturesHoverEventType,
|
|
@@ -7,21 +6,30 @@ import {
|
|
|
7
6
|
MapExtentChangeEventType,
|
|
8
7
|
SourceLoadErrorType,
|
|
9
8
|
} from "@geospatial-sdk/core";
|
|
10
|
-
import { toLonLat, transformExtent } from "ol/proj.js";
|
|
11
9
|
import BaseEvent from "ol/events/Event.js";
|
|
12
|
-
import Layer from "ol/layer/Layer.js";
|
|
13
|
-
import { BaseLayerObjectEventTypes } from "ol/layer/Base.js";
|
|
14
10
|
import { equals } from "ol/extent.js";
|
|
11
|
+
import type BaseLayer from "ol/layer/Base.js";
|
|
12
|
+
import { BaseLayerObjectEventTypes } from "ol/layer/Base.js";
|
|
13
|
+
import Layer from "ol/layer/Layer.js";
|
|
14
|
+
import Map, { MapObjectEventTypes } from "ol/Map.js";
|
|
15
|
+
import { toLonLat, transformExtent } from "ol/proj.js";
|
|
16
|
+
import { GEOSPATIAL_SDK_PREFIX } from "./constants.js";
|
|
15
17
|
import { readFeaturesAtPixel } from "./get-features.js";
|
|
16
18
|
|
|
17
19
|
function registerFeatureClickEvent(map: Map) {
|
|
18
20
|
if (map.get(FeaturesClickEventType)) return;
|
|
19
21
|
|
|
22
|
+
// Filter to only query layers with enableSelection
|
|
23
|
+
const layerFilter = (layer: BaseLayer) =>
|
|
24
|
+
!layer.get(`${GEOSPATIAL_SDK_PREFIX}disable-click`);
|
|
25
|
+
|
|
20
26
|
map.on("click", async (event: any) => {
|
|
21
|
-
const
|
|
27
|
+
const featuresByLayer = await readFeaturesAtPixel(map, event, layerFilter);
|
|
28
|
+
const features = Array.from(featuresByLayer.values()).flat();
|
|
22
29
|
map.dispatchEvent({
|
|
23
30
|
type: FeaturesClickEventType,
|
|
24
31
|
features,
|
|
32
|
+
featuresByLayer,
|
|
25
33
|
} as unknown as BaseEvent);
|
|
26
34
|
});
|
|
27
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geospatial-sdk/openlayers",
|
|
3
|
-
"version": "0.0.5-dev.
|
|
3
|
+
"version": "0.0.5-dev.53+85f2d77",
|
|
4
4
|
"description": "OpenLayers-related utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ol",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"ol": ">9.x"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@geospatial-sdk/core": "^0.0.5-dev.
|
|
40
|
+
"@geospatial-sdk/core": "^0.0.5-dev.53+85f2d77",
|
|
41
41
|
"chroma-js": "^2.4.2",
|
|
42
42
|
"lodash.throttle": "^4.1.1",
|
|
43
43
|
"ol-mapbox-style": "12.4.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "85f2d770cbe0bf97a4c2c5e0650fe7712f3396c8"
|
|
46
46
|
}
|