@geospatial-sdk/openlayers 0.0.5-dev.18 → 0.0.5-dev.20
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/apply-context-diff.d.ts.map +1 -1
- package/dist/map/apply-context-diff.js +4 -3
- package/dist/map/create-map.d.ts +1 -1
- package/dist/map/create-map.d.ts.map +1 -1
- package/dist/map/create-map.js +18 -11
- package/dist/map/register-events.js +1 -1
- package/lib/map/apply-context-diff.test.ts +61 -7
- package/lib/map/apply-context-diff.ts +4 -3
- package/lib/map/create-map.test.ts +4 -2
- package/lib/map/create-map.ts +15 -8
- package/lib/map/register-events.test.ts +1 -1
- package/lib/map/register-events.ts +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-context-diff.d.ts","sourceRoot":"","sources":["../../lib/map/apply-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"apply-context-diff.d.ts","sourceRoot":"","sources":["../../lib/map/apply-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,GAAG,CAAC,CAwFd"}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { createLayer } from "./create-map";
|
|
10
|
+
import { createLayer, createView } from "./create-map";
|
|
11
11
|
import { fromLonLat, transformExtent } from "ol/proj";
|
|
12
12
|
import GeoJSON from "ol/format/GeoJSON";
|
|
13
13
|
const GEOJSON = new GeoJSON();
|
|
@@ -55,11 +55,12 @@ export function applyContextDiffToMap(map, contextDiff) {
|
|
|
55
55
|
layers.setAt(layerChanged.position, layer);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
58
|
+
if (typeof contextDiff.viewChanges !== "undefined") {
|
|
59
59
|
const { viewChanges } = contextDiff;
|
|
60
60
|
const view = map.getView();
|
|
61
61
|
const projection = view.getProjection();
|
|
62
|
-
if (
|
|
62
|
+
if (viewChanges === null) {
|
|
63
|
+
map.setView(createView(viewChanges, map));
|
|
63
64
|
return map;
|
|
64
65
|
}
|
|
65
66
|
if ("geometry" in viewChanges) {
|
package/dist/map/create-map.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import Map from "ol/Map";
|
|
|
3
3
|
import View from "ol/View";
|
|
4
4
|
import Layer from "ol/layer/Layer";
|
|
5
5
|
export declare function createLayer(layerModel: MapContextLayer): Promise<Layer>;
|
|
6
|
-
export declare function createView(viewModel: MapContextView, map: Map): View;
|
|
6
|
+
export declare function createView(viewModel: MapContextView | null, map: Map): View;
|
|
7
7
|
/**
|
|
8
8
|
* Create an OpenLayers map from a context; optionally specify a target (root element) for the map
|
|
9
9
|
* @param context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-map.d.ts","sourceRoot":"","sources":["../../lib/map/create-map.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-map.d.ts","sourceRoot":"","sources":["../../lib/map/create-map.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,gBAAgB,CAAC;AA4BnC,wBAAsB,WAAW,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,CAuL7E;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CA+B3E;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,UAAU,EACnB,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAC5B,OAAO,CAAC,GAAG,CAAC,CAKd;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,GAAG,CAAC,CAQd"}
|
package/dist/map/create-map.js
CHANGED
|
@@ -20,17 +20,18 @@ import { fromLonLat } from "ol/proj";
|
|
|
20
20
|
import { bbox as bboxStrategy } from "ol/loadingstrategy";
|
|
21
21
|
import { defaultStyle } from "./styles";
|
|
22
22
|
import VectorTileLayer from "ol/layer/VectorTile";
|
|
23
|
-
import
|
|
24
|
-
import
|
|
23
|
+
import OGCMapTile from "ol/source/OGCMapTile";
|
|
24
|
+
import OGCVectorTile from "ol/source/OGCVectorTile";
|
|
25
|
+
import WMTS from "ol/source/WMTS";
|
|
26
|
+
import MVT from "ol/format/MVT";
|
|
25
27
|
import { OgcApiEndpoint, WfsEndpoint, WmtsEndpoint, } from "@camptocamp/ogc-client";
|
|
26
28
|
import { MapboxVectorLayer } from "ol-mapbox-style";
|
|
27
29
|
const GEOJSON = new GeoJSON();
|
|
28
30
|
const WFS_MAX_FEATURES = 10000;
|
|
29
31
|
export function createLayer(layerModel) {
|
|
30
|
-
var _a;
|
|
32
|
+
var _a, _b, _c, _d, _e;
|
|
31
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
34
|
const { type } = layerModel;
|
|
33
|
-
const style = defaultStyle;
|
|
34
35
|
let layer;
|
|
35
36
|
switch (type) {
|
|
36
37
|
case "xyz":
|
|
@@ -55,8 +56,8 @@ export function createLayer(layerModel) {
|
|
|
55
56
|
const olLayer = new TileLayer({});
|
|
56
57
|
const endpoint = new WmtsEndpoint(layerModel.url);
|
|
57
58
|
endpoint.isReady().then((endpoint) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
var
|
|
59
|
-
const layerName = (
|
|
59
|
+
var _f;
|
|
60
|
+
const layerName = (_f = endpoint.getSingleLayerName()) !== null && _f !== void 0 ? _f : layerModel.name;
|
|
60
61
|
const layer = endpoint.getLayerByName(layerName);
|
|
61
62
|
const matrixSet = layer.matrixSets[0];
|
|
62
63
|
const tileGrid = yield endpoint.getOpenLayersTileGrid(layer.name);
|
|
@@ -83,7 +84,7 @@ export function createLayer(layerModel) {
|
|
|
83
84
|
}
|
|
84
85
|
case "wfs": {
|
|
85
86
|
const olLayer = new VectorLayer({
|
|
86
|
-
style,
|
|
87
|
+
style: (_a = layerModel.style) !== null && _a !== void 0 ? _a : defaultStyle,
|
|
87
88
|
});
|
|
88
89
|
new WfsEndpoint(layerModel.url).isReady().then((endpoint) => {
|
|
89
90
|
var _a;
|
|
@@ -121,7 +122,7 @@ export function createLayer(layerModel) {
|
|
|
121
122
|
url: layerModel.url,
|
|
122
123
|
attributions: layerModel.attributions,
|
|
123
124
|
}),
|
|
124
|
-
style,
|
|
125
|
+
style: (_b = layerModel.style) !== null && _b !== void 0 ? _b : defaultStyle,
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
else {
|
|
@@ -144,7 +145,7 @@ export function createLayer(layerModel) {
|
|
|
144
145
|
features,
|
|
145
146
|
attributions: layerModel.attributions,
|
|
146
147
|
}),
|
|
147
|
-
style,
|
|
148
|
+
style: (_c = layerModel.style) !== null && _c !== void 0 ? _c : defaultStyle,
|
|
148
149
|
});
|
|
149
150
|
}
|
|
150
151
|
break;
|
|
@@ -181,7 +182,7 @@ export function createLayer(layerModel) {
|
|
|
181
182
|
url: layerUrl,
|
|
182
183
|
attributions: layerModel.attributions,
|
|
183
184
|
}),
|
|
184
|
-
style,
|
|
185
|
+
style: (_d = layerModel.style) !== null && _d !== void 0 ? _d : defaultStyle,
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
188
|
break;
|
|
@@ -197,12 +198,18 @@ export function createLayer(layerModel) {
|
|
|
197
198
|
typeof layerModel.opacity !== "undefined" &&
|
|
198
199
|
layer.setOpacity(layerModel.opacity);
|
|
199
200
|
typeof layerModel.attributions !== "undefined" &&
|
|
200
|
-
((
|
|
201
|
+
((_e = layer.getSource()) === null || _e === void 0 ? void 0 : _e.setAttributions(layerModel.attributions));
|
|
201
202
|
layer.set("label", layerModel.label);
|
|
202
203
|
return layer;
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
206
|
export function createView(viewModel, map) {
|
|
207
|
+
if (viewModel === null) {
|
|
208
|
+
return new View({
|
|
209
|
+
center: [0, 0],
|
|
210
|
+
zoom: 0,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
206
213
|
const view = new View(Object.assign(Object.assign(Object.assign({}, ("maxExtent" in viewModel && { extent: viewModel.maxExtent })), ("maxZoom" in viewModel && { maxZoom: viewModel.maxZoom })), { multiWorld: false, constrainResolution: true }));
|
|
207
214
|
if ("geometry" in viewModel) {
|
|
208
215
|
const geom = GEOJSON.readGeometry(viewModel.geometry);
|
|
@@ -101,7 +101,7 @@ export function listen(map, eventType, callback) {
|
|
|
101
101
|
break;
|
|
102
102
|
case MapClickEventType:
|
|
103
103
|
map.on("click", (event) => {
|
|
104
|
-
const coordinate = toLonLat(event.
|
|
104
|
+
const coordinate = toLonLat(event.coordinate, map.getView().getProjection());
|
|
105
105
|
callback({
|
|
106
106
|
type: "map-click",
|
|
107
107
|
coordinate,
|
|
@@ -53,7 +53,6 @@ describe("applyContextDiffToMap", () => {
|
|
|
53
53
|
layersChanged: [],
|
|
54
54
|
layersRemoved: [],
|
|
55
55
|
layersReordered: [],
|
|
56
|
-
viewChanges: {},
|
|
57
56
|
};
|
|
58
57
|
await applyContextDiffToMap(map, diff);
|
|
59
58
|
layersArray = map.getLayers().getArray();
|
|
@@ -81,7 +80,6 @@ describe("applyContextDiffToMap", () => {
|
|
|
81
80
|
layersChanged: [],
|
|
82
81
|
layersRemoved: [],
|
|
83
82
|
layersReordered: [],
|
|
84
|
-
viewChanges: {},
|
|
85
83
|
};
|
|
86
84
|
applyContextDiffToMap(map, diff);
|
|
87
85
|
layersArray = map.getLayers().getArray();
|
|
@@ -111,7 +109,6 @@ describe("applyContextDiffToMap", () => {
|
|
|
111
109
|
},
|
|
112
110
|
],
|
|
113
111
|
layersReordered: [],
|
|
114
|
-
viewChanges: {},
|
|
115
112
|
};
|
|
116
113
|
applyContextDiffToMap(map, diff);
|
|
117
114
|
});
|
|
@@ -145,7 +142,6 @@ describe("applyContextDiffToMap", () => {
|
|
|
145
142
|
],
|
|
146
143
|
layersRemoved: [],
|
|
147
144
|
layersReordered: [],
|
|
148
|
-
viewChanges: {},
|
|
149
145
|
};
|
|
150
146
|
applyContextDiffToMap(map, diff);
|
|
151
147
|
layersArray = map.getLayers().getArray();
|
|
@@ -181,7 +177,6 @@ describe("applyContextDiffToMap", () => {
|
|
|
181
177
|
previousPosition: 0,
|
|
182
178
|
},
|
|
183
179
|
],
|
|
184
|
-
viewChanges: {},
|
|
185
180
|
};
|
|
186
181
|
applyContextDiffToMap(map, diff);
|
|
187
182
|
layersArray = map.getLayers().getArray();
|
|
@@ -217,7 +212,67 @@ describe("applyContextDiffToMap", () => {
|
|
|
217
212
|
previousPosition: 0,
|
|
218
213
|
},
|
|
219
214
|
],
|
|
220
|
-
|
|
215
|
+
};
|
|
216
|
+
applyContextDiffToMap(map, diff);
|
|
217
|
+
layersArray = map.getLayers().getArray();
|
|
218
|
+
});
|
|
219
|
+
it("moves the layers accordingly", () => {
|
|
220
|
+
expect(layersArray.length).toEqual(4);
|
|
221
|
+
assertEqualsToModel(layersArray[0], SAMPLE_LAYER4);
|
|
222
|
+
assertEqualsToModel(layersArray[1], SAMPLE_LAYER3);
|
|
223
|
+
assertEqualsToModel(layersArray[2], SAMPLE_LAYER1);
|
|
224
|
+
assertEqualsToModel(layersArray[3], SAMPLE_LAYER2);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
describe("view change", () => {
|
|
230
|
+
describe("set to default view", () => {
|
|
231
|
+
beforeEach(async () => {
|
|
232
|
+
context = {
|
|
233
|
+
...SAMPLE_CONTEXT,
|
|
234
|
+
layers: [SAMPLE_LAYER1, SAMPLE_LAYER2, SAMPLE_LAYER3],
|
|
235
|
+
};
|
|
236
|
+
map = await createMapFromContext(context);
|
|
237
|
+
diff = {
|
|
238
|
+
layersAdded: [],
|
|
239
|
+
layersChanged: [],
|
|
240
|
+
layersRemoved: [],
|
|
241
|
+
layersReordered: [],
|
|
242
|
+
viewChanges: null,
|
|
243
|
+
};
|
|
244
|
+
applyContextDiffToMap(map, diff);
|
|
245
|
+
});
|
|
246
|
+
it("set the view back to default", () => {
|
|
247
|
+
const view = map.getView();
|
|
248
|
+
expect(view.getCenter()).toEqual([0, 0]);
|
|
249
|
+
expect(view.getZoom()).toEqual(0);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
describe("four layers reordered", () => {
|
|
254
|
+
beforeEach(async () => {
|
|
255
|
+
context = {
|
|
256
|
+
...SAMPLE_CONTEXT,
|
|
257
|
+
layers: [SAMPLE_LAYER1, SAMPLE_LAYER3, SAMPLE_LAYER4, SAMPLE_LAYER2],
|
|
258
|
+
};
|
|
259
|
+
map = await createMapFromContext(context);
|
|
260
|
+
diff = {
|
|
261
|
+
layersAdded: [],
|
|
262
|
+
layersChanged: [],
|
|
263
|
+
layersRemoved: [],
|
|
264
|
+
layersReordered: [
|
|
265
|
+
{
|
|
266
|
+
layer: SAMPLE_LAYER4,
|
|
267
|
+
newPosition: 0,
|
|
268
|
+
previousPosition: 2,
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
layer: SAMPLE_LAYER1,
|
|
272
|
+
newPosition: 2,
|
|
273
|
+
previousPosition: 0,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
221
276
|
};
|
|
222
277
|
applyContextDiffToMap(map, diff);
|
|
223
278
|
layersArray = map.getLayers().getArray();
|
|
@@ -276,7 +331,6 @@ describe("applyContextDiffToMap", () => {
|
|
|
276
331
|
previousPosition: 1,
|
|
277
332
|
},
|
|
278
333
|
],
|
|
279
|
-
viewChanges: {},
|
|
280
334
|
};
|
|
281
335
|
applyContextDiffToMap(map, diff);
|
|
282
336
|
layersArray = map.getLayers().getArray();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Map from "ol/Map";
|
|
2
2
|
import { MapContextDiff } from "@geospatial-sdk/core";
|
|
3
|
-
import { createLayer } from "./create-map";
|
|
3
|
+
import { createLayer, createView } from "./create-map";
|
|
4
4
|
import { fromLonLat, transformExtent } from "ol/proj";
|
|
5
5
|
import GeoJSON from "ol/format/GeoJSON";
|
|
6
6
|
import SimpleGeometry from "ol/geom/SimpleGeometry";
|
|
@@ -66,11 +66,12 @@ export async function applyContextDiffToMap(
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
if (
|
|
69
|
+
if (typeof contextDiff.viewChanges !== "undefined") {
|
|
70
70
|
const { viewChanges } = contextDiff;
|
|
71
71
|
const view = map.getView();
|
|
72
72
|
const projection = view.getProjection();
|
|
73
|
-
if (
|
|
73
|
+
if (viewChanges === null) {
|
|
74
|
+
map.setView(createView(viewChanges, map));
|
|
74
75
|
return map;
|
|
75
76
|
}
|
|
76
77
|
if ("geometry" in viewChanges) {
|
|
@@ -263,7 +263,9 @@ describe("MapContextService", () => {
|
|
|
263
263
|
});
|
|
264
264
|
it("set the url to point to the file", () => {
|
|
265
265
|
const source = layer.getSource() as VectorSource;
|
|
266
|
-
expect(source.getUrl()).toBe(
|
|
266
|
+
expect(source.getUrl()).toBe(
|
|
267
|
+
(layerModel as MapContextLayerGeojson).url,
|
|
268
|
+
);
|
|
267
269
|
});
|
|
268
270
|
});
|
|
269
271
|
});
|
|
@@ -386,7 +388,7 @@ describe("MapContextService", () => {
|
|
|
386
388
|
let view: View;
|
|
387
389
|
const map = new Map({});
|
|
388
390
|
const mapContext: MapContext = {
|
|
389
|
-
view:
|
|
391
|
+
view: null,
|
|
390
392
|
layers: [
|
|
391
393
|
MAP_CTX_LAYER_XYZ_FIXTURE,
|
|
392
394
|
MAP_CTX_LAYER_WMS_FIXTURE,
|
package/lib/map/create-map.ts
CHANGED
|
@@ -20,8 +20,10 @@ import { fromLonLat } from "ol/proj";
|
|
|
20
20
|
import { bbox as bboxStrategy } from "ol/loadingstrategy";
|
|
21
21
|
import { defaultStyle } from "./styles";
|
|
22
22
|
import VectorTileLayer from "ol/layer/VectorTile";
|
|
23
|
-
import
|
|
24
|
-
import
|
|
23
|
+
import OGCMapTile from "ol/source/OGCMapTile";
|
|
24
|
+
import OGCVectorTile from "ol/source/OGCVectorTile";
|
|
25
|
+
import WMTS from "ol/source/WMTS";
|
|
26
|
+
import MVT from "ol/format/MVT";
|
|
25
27
|
import {
|
|
26
28
|
OgcApiEndpoint,
|
|
27
29
|
WfsEndpoint,
|
|
@@ -34,7 +36,6 @@ const WFS_MAX_FEATURES = 10000;
|
|
|
34
36
|
|
|
35
37
|
export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
|
|
36
38
|
const { type } = layerModel;
|
|
37
|
-
const style = defaultStyle;
|
|
38
39
|
let layer: Layer | undefined;
|
|
39
40
|
switch (type) {
|
|
40
41
|
case "xyz":
|
|
@@ -91,7 +92,7 @@ export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
|
|
|
91
92
|
}
|
|
92
93
|
case "wfs": {
|
|
93
94
|
const olLayer = new VectorLayer({
|
|
94
|
-
style,
|
|
95
|
+
style: layerModel.style ?? defaultStyle,
|
|
95
96
|
});
|
|
96
97
|
new WfsEndpoint(layerModel.url).isReady().then((endpoint) => {
|
|
97
98
|
const featureType =
|
|
@@ -131,7 +132,7 @@ export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
|
|
|
131
132
|
url: layerModel.url,
|
|
132
133
|
attributions: layerModel.attributions,
|
|
133
134
|
}),
|
|
134
|
-
style,
|
|
135
|
+
style: layerModel.style ?? defaultStyle,
|
|
135
136
|
});
|
|
136
137
|
} else {
|
|
137
138
|
let geojson = layerModel.data;
|
|
@@ -152,7 +153,7 @@ export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
|
|
|
152
153
|
features,
|
|
153
154
|
attributions: layerModel.attributions,
|
|
154
155
|
}),
|
|
155
|
-
style,
|
|
156
|
+
style: layerModel.style ?? defaultStyle,
|
|
156
157
|
});
|
|
157
158
|
}
|
|
158
159
|
break;
|
|
@@ -196,7 +197,7 @@ export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
|
|
|
196
197
|
url: layerUrl,
|
|
197
198
|
attributions: layerModel.attributions,
|
|
198
199
|
}),
|
|
199
|
-
style,
|
|
200
|
+
style: layerModel.style ?? defaultStyle,
|
|
200
201
|
});
|
|
201
202
|
}
|
|
202
203
|
break;
|
|
@@ -218,7 +219,13 @@ export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
|
|
|
218
219
|
return layer;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
|
-
export function createView(viewModel: MapContextView, map: Map): View {
|
|
222
|
+
export function createView(viewModel: MapContextView | null, map: Map): View {
|
|
223
|
+
if (viewModel === null) {
|
|
224
|
+
return new View({
|
|
225
|
+
center: [0, 0],
|
|
226
|
+
zoom: 0,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
222
229
|
const view = new View({
|
|
223
230
|
...("maxExtent" in viewModel && { extent: viewModel.maxExtent }),
|
|
224
231
|
...("maxZoom" in viewModel && { maxZoom: viewModel.maxZoom }),
|
|
@@ -191,7 +191,7 @@ describe("event registration", () => {
|
|
|
191
191
|
});
|
|
192
192
|
it("registers the event on the map", () => {
|
|
193
193
|
expect(callback).toHaveBeenCalledWith({
|
|
194
|
-
coordinate: toLonLat([
|
|
194
|
+
coordinate: toLonLat([123, 123]),
|
|
195
195
|
type: "map-click",
|
|
196
196
|
});
|
|
197
197
|
});
|
|
@@ -143,7 +143,7 @@ export function listen<T extends keyof MapEventsByType>(
|
|
|
143
143
|
case MapClickEventType:
|
|
144
144
|
map.on("click", (event) => {
|
|
145
145
|
const coordinate = toLonLat(
|
|
146
|
-
event.
|
|
146
|
+
event.coordinate,
|
|
147
147
|
map.getView().getProjection(),
|
|
148
148
|
) as [number, number];
|
|
149
149
|
(callback as (event: unknown) => void)({
|
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.20+87e3bcf",
|
|
4
4
|
"description": "OpenLayers-related utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ol",
|
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
"ol": ">6.x"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@geospatial-sdk/core": "^0.0.5-dev.
|
|
40
|
+
"@geospatial-sdk/core": "^0.0.5-dev.20+87e3bcf",
|
|
41
41
|
"chroma-js": "^2.4.2",
|
|
42
|
-
"lodash.throttle": "^4.1.1"
|
|
42
|
+
"lodash.throttle": "^4.1.1",
|
|
43
|
+
"ol-mapbox-style": "^12.3.5"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "87e3bcfa08f4efbcd7ca4991d829bc165aa104db"
|
|
45
46
|
}
|