@geospatial-sdk/maplibre 0.0.5-dev.58 → 0.0.5-dev.60

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.
@@ -1 +1 @@
1
- {"version":3,"file":"apply-context-diff.d.ts","sourceRoot":"","sources":["../../lib/map/apply-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAUvC;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,eAAe,EAC3B,kBAAkB,EAAE,eAAe,EACnC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,GAAG,CAAC,CAgGd"}
1
+ {"version":3,"file":"apply-context-diff.d.ts","sourceRoot":"","sources":["../../lib/map/apply-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAUvC;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,eAAe,EAC3B,kBAAkB,EAAE,eAAe,EACnC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,GAAG,CAAC,CAoGd"}
@@ -109,6 +109,13 @@ export async function applyContextDiffToMap(map, contextDiff) {
109
109
  duration: 1000,
110
110
  });
111
111
  }
112
+ else if (viewChanges && "center" in viewChanges) {
113
+ const { center, zoom } = viewChanges;
114
+ if (center)
115
+ map.setCenter(center);
116
+ if (zoom !== undefined)
117
+ map.setZoom(zoom);
118
+ }
112
119
  }
113
120
  return map;
114
121
  }
@@ -325,6 +325,34 @@ describe("applyContextDiffToMap (mocked Map)", () => {
325
325
  );
326
326
  });
327
327
 
328
+ it("calls setCenter and setZoom for viewChanges with center and zoom", async () => {
329
+ diff = {
330
+ layersAdded: [],
331
+ layersChanged: [],
332
+ layersRemoved: [],
333
+ layersReordered: [],
334
+ viewChanges: { center: [2.35, 48.86], zoom: 12 },
335
+ };
336
+ await applyContextDiffToMap(map, diff);
337
+ expect(map.setCenter).toHaveBeenCalledWith([2.35, 48.86]);
338
+ expect(map.setZoom).toHaveBeenCalledWith(12);
339
+ expect(map.fitBounds).not.toHaveBeenCalled();
340
+ });
341
+
342
+ it("calls setCenter without setZoom when only center is provided", async () => {
343
+ diff = {
344
+ layersAdded: [],
345
+ layersChanged: [],
346
+ layersRemoved: [],
347
+ layersReordered: [],
348
+ viewChanges: { center: [2.35, 48.86] },
349
+ };
350
+ await applyContextDiffToMap(map, diff);
351
+ expect(map.setCenter).toHaveBeenCalledWith([2.35, 48.86]);
352
+ expect(map.setZoom).not.toHaveBeenCalled();
353
+ expect(map.fitBounds).not.toHaveBeenCalled();
354
+ });
355
+
328
356
  describe("reordering", () => {
329
357
  describe("2 layers inverted", () => {
330
358
  beforeEach(async () => {
@@ -155,6 +155,10 @@ export async function applyContextDiffToMap(
155
155
  duration: 1000,
156
156
  },
157
157
  );
158
+ } else if (viewChanges && "center" in viewChanges) {
159
+ const { center, zoom } = viewChanges;
160
+ if (center) map.setCenter(center as [number, number]);
161
+ if (zoom !== undefined) map.setZoom(zoom);
158
162
  }
159
163
  }
160
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geospatial-sdk/maplibre",
3
- "version": "0.0.5-dev.58+2a0ef33",
3
+ "version": "0.0.5-dev.60+f826933",
4
4
  "description": "Maplibre-related utilities",
5
5
  "keywords": [
6
6
  "maplibre",
@@ -33,8 +33,8 @@
33
33
  "maplibre-gl": "^5.19.0"
34
34
  },
35
35
  "dependencies": {
36
- "@geospatial-sdk/core": "^0.0.5-dev.58+2a0ef33",
37
- "@geospatial-sdk/style": "^0.0.5-dev.58+2a0ef33"
36
+ "@geospatial-sdk/core": "^0.0.5-dev.60+f826933",
37
+ "@geospatial-sdk/style": "^0.0.5-dev.60+f826933"
38
38
  },
39
- "gitHead": "2a0ef33a707649901451dfc3572c2b9efdb00c26"
39
+ "gitHead": "f8269338a04fb473cb6a467a12d2cddad89e6b98"
40
40
  }