@sigma/layer-maplibre 3.0.0-beta.7 → 3.0.0-beta.9

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.
@@ -142,9 +142,15 @@ function bindMaplibreLayer(sigma, opts) {
142
142
  var prevSigmaSettings = sigma.getSettings();
143
143
 
144
144
  // Creating map container
145
- var mapContainer = document.createElement("div");
146
- mapContainer.classList.add("sigma-layer-maplibre");
147
- mapContainer.setAttribute("style", "position: absolute; inset: 0");
145
+ var mapLayerName = "layer-maplibre";
146
+ var mapContainer = sigma.createLayer(mapLayerName, "div", {
147
+ style: {
148
+ position: "absolute",
149
+ inset: "0"
150
+ },
151
+ // 'edges' is the first sigma layer
152
+ beforeLayer: "edges"
153
+ });
148
154
  sigma.getContainer().prepend(mapContainer);
149
155
 
150
156
  // Initialize the map
@@ -215,7 +221,7 @@ function bindMaplibreLayer(sigma, opts) {
215
221
  isKilled = true;
216
222
  map.off("moveend", fnSyncSigmaWithMap);
217
223
  map.remove();
218
- mapContainer.remove();
224
+ sigma.killLayer(mapLayerName);
219
225
  sigma.off("afterRender", fnSyncMapWithSigma);
220
226
  sigma.off("resize", fnOnResize);
221
227
 
@@ -142,9 +142,15 @@ function bindMaplibreLayer(sigma, opts) {
142
142
  var prevSigmaSettings = sigma.getSettings();
143
143
 
144
144
  // Creating map container
145
- var mapContainer = document.createElement("div");
146
- mapContainer.classList.add("sigma-layer-maplibre");
147
- mapContainer.setAttribute("style", "position: absolute; inset: 0");
145
+ var mapLayerName = "layer-maplibre";
146
+ var mapContainer = sigma.createLayer(mapLayerName, "div", {
147
+ style: {
148
+ position: "absolute",
149
+ inset: "0"
150
+ },
151
+ // 'edges' is the first sigma layer
152
+ beforeLayer: "edges"
153
+ });
148
154
  sigma.getContainer().prepend(mapContainer);
149
155
 
150
156
  // Initialize the map
@@ -215,7 +221,7 @@ function bindMaplibreLayer(sigma, opts) {
215
221
  isKilled = true;
216
222
  map.off("moveend", fnSyncSigmaWithMap);
217
223
  map.remove();
218
- mapContainer.remove();
224
+ sigma.killLayer(mapLayerName);
219
225
  sigma.off("afterRender", fnSyncMapWithSigma);
220
226
  sigma.off("resize", fnOnResize);
221
227
 
@@ -138,9 +138,15 @@ function bindMaplibreLayer(sigma, opts) {
138
138
  var prevSigmaSettings = sigma.getSettings();
139
139
 
140
140
  // Creating map container
141
- var mapContainer = document.createElement("div");
142
- mapContainer.classList.add("sigma-layer-maplibre");
143
- mapContainer.setAttribute("style", "position: absolute; inset: 0");
141
+ var mapLayerName = "layer-maplibre";
142
+ var mapContainer = sigma.createLayer(mapLayerName, "div", {
143
+ style: {
144
+ position: "absolute",
145
+ inset: "0"
146
+ },
147
+ // 'edges' is the first sigma layer
148
+ beforeLayer: "edges"
149
+ });
144
150
  sigma.getContainer().prepend(mapContainer);
145
151
 
146
152
  // Initialize the map
@@ -211,7 +217,7 @@ function bindMaplibreLayer(sigma, opts) {
211
217
  isKilled = true;
212
218
  map.off("moveend", fnSyncSigmaWithMap);
213
219
  map.remove();
214
- mapContainer.remove();
220
+ sigma.killLayer(mapLayerName);
215
221
  sigma.off("afterRender", fnSyncMapWithSigma);
216
222
  sigma.off("resize", fnOnResize);
217
223
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigma/layer-maplibre",
3
- "version": "3.0.0-beta.7",
3
+ "version": "3.0.0-beta.9",
4
4
  "description": "A plugin to set a geographical map in background",
5
5
  "main": "dist/sigma-layer-maplibre.cjs.js",
6
6
  "module": "dist/sigma-layer-maplibre.esm.js",
@@ -45,5 +45,5 @@
45
45
  },
46
46
  "./package.json": "./package.json"
47
47
  },
48
- "gitHead": "126195956b46275ff4b0d5dedd380aa17ab3c9e2"
48
+ "gitHead": "fc828dcb6e14282f323f2f1c62987444f9cf0c6f"
49
49
  }