@maptiler/sdk 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "module": "dist/maptiler-sdk.mjs",
6
6
  "types": "dist/maptiler-sdk.d.ts",
@@ -1,9 +1,13 @@
1
- import { GeolocateControl, LngLat, LngLatLike, Marker } from "maplibre-gl";
1
+ import type { LngLatLike } from "maplibre-gl";
2
+ import maplibregl from "maplibre-gl";
2
3
  import { DOMcreate } from "./tools";
3
4
 
5
+ const GeolocateControl = maplibregl.GeolocateControl;
6
+ const Marker = maplibregl.Marker;
7
+ const LngLat = maplibregl.LngLat;
8
+
4
9
  export class CustomGeolocateControl extends GeolocateControl {
5
- private lastUpdatedCenter: LngLat;
6
- private lastUpdatedZoom: number;
10
+ private lastUpdatedCenter = new LngLat(0, 0);
7
11
 
8
12
  /**
9
13
  * Update the camera location to center on the current position
@@ -59,13 +63,11 @@ export class CustomGeolocateControl extends GeolocateControl {
59
63
  }
60
64
 
61
65
  this.lastUpdatedCenter = this._map.getCenter();
62
- this.lastUpdatedZoom = this._map.getZoom();
63
66
  });
64
67
  }
65
68
 
66
69
  _setupUI(supported: boolean) {
67
70
  this.lastUpdatedCenter = this._map.getCenter();
68
- this.lastUpdatedZoom = this._map.getZoom();
69
71
 
70
72
  this._container.addEventListener("contextmenu", (e: MouseEvent) =>
71
73
  e.preventDefault()