@nextgis/leaflet-map-adapter 4.0.0-rc.2 → 4.0.0

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,4 +1,4 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.0-rc.2; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.0; author: NextGIS */
2
2
  import { LeafletControlContainer, createControl, createButtonControl, createToggleControl } from '@nextgis/leaflet-control-container';
3
3
  import { EventEmitter } from 'events';
4
4
  import { Control, GeoJSON, DomEvent, DivIcon, Marker, CircleMarker, FeatureGroup, ImageOverlay as ImageOverlay$1, Layer, Util, GridLayer, DomUtil, TileLayer as TileLayer$1, Map, latLngBounds, latLng } from 'leaflet';
@@ -136,13 +136,22 @@ class BaseAdapter {
136
136
  __publicField$7(this, "options", options);
137
137
  __publicField$7(this, "layer");
138
138
  __publicField$7(this, "pane", "order-0");
139
+ var _a, _b;
139
140
  if (options.order !== void 0) {
140
- const pane = "order-" + options.order;
141
+ const order = options.order;
142
+ const pane = "order-" + order;
141
143
  let exist = map.getPane(pane);
142
144
  if (!exist) {
143
145
  exist = map.createPane(pane);
146
+ const nextPane = (_a = Object.entries(map.getPanes()).filter(([name]) => name.startsWith("order-")).map(([name, element]) => ({
147
+ element,
148
+ order: Number(name.slice("order-".length))
149
+ })).filter((candidate) => candidate.order > order).sort((a, b) => a.order - b.order)[0]) == null ? void 0 : _a.element;
150
+ if (nextPane) {
151
+ (_b = exist.parentElement) == null ? void 0 : _b.insertBefore(exist, nextPane);
152
+ }
144
153
  }
145
- exist.style.zIndex = String(Math.round(options.order * 100));
154
+ exist.style.zIndex = String(Math.round(order * 100));
146
155
  this.pane = pane;
147
156
  }
148
157
  }