@nextgis/leaflet-map-adapter 3.1.0 → 4.0.0-alpha.1
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/lib/index.d.ts +4 -2
- package/lib/leaflet-map-adapter.css +1 -0
- package/lib/leaflet-map-adapter.esm-browser.js +1701 -930
- package/lib/leaflet-map-adapter.esm-browser.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js +2 -2
- package/lib/leaflet-map-adapter.esm-browser.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.js +67 -121
- package/lib/leaflet-map-adapter.esm-bundler.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.global.js +1701 -930
- package/lib/leaflet-map-adapter.global.js.map +1 -1
- package/lib/leaflet-map-adapter.global.prod.js +2 -2
- package/lib/leaflet-map-adapter.global.prod.js.map +1 -1
- package/package.json +4 -3
|
@@ -1,474 +1,599 @@
|
|
|
1
|
-
/** Bundle of @nextgis/leaflet-map-adapter; version:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.0-alpha.1; author: NextGIS */
|
|
2
|
+
function getElement(el) {
|
|
3
|
+
if (typeof el === "string") {
|
|
4
|
+
let el_ = document.getElementById(el);
|
|
5
|
+
if (!el_) {
|
|
6
|
+
try {
|
|
7
|
+
el_ = document.querySelector(el);
|
|
8
|
+
} catch (e) {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return el_ || void 0;
|
|
12
|
+
}
|
|
13
|
+
return el;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
var __defProp$h = Object.defineProperty;
|
|
17
|
+
var __defProps$8 = Object.defineProperties;
|
|
18
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
19
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
20
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
21
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
22
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
23
|
+
var __spreadValues$c = (a, b) => {
|
|
24
|
+
for (var prop in b || (b = {}))
|
|
25
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
26
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
27
|
+
if (__getOwnPropSymbols$c)
|
|
28
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
29
|
+
if (__propIsEnum$c.call(b, prop))
|
|
30
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
31
|
+
}
|
|
32
|
+
return a;
|
|
33
|
+
};
|
|
34
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
35
|
+
const controlOptions = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
function resolveControlOptions(options = {}) {
|
|
37
|
+
var _a;
|
|
38
|
+
return __spreadProps$8(__spreadValues$c({}, options), {
|
|
39
|
+
margin: (_a = options.margin) != null ? _a : options.bar
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function setControlOptions(control, options = {}) {
|
|
43
|
+
controlOptions.set(control, resolveControlOptions(options));
|
|
44
|
+
}
|
|
45
|
+
function getControlOptions(control) {
|
|
46
|
+
return control ? controlOptions.get(control) : void 0;
|
|
47
|
+
}
|
|
27
48
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
var __defProp$g = Object.defineProperty;
|
|
50
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
51
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
52
|
+
class ControlContainer {
|
|
53
|
+
constructor(opt = {}) {
|
|
54
|
+
__publicField$a(this, "classPrefix", "webmap");
|
|
55
|
+
__publicField$a(this, "addClass");
|
|
56
|
+
__publicField$a(this, "map");
|
|
57
|
+
__publicField$a(this, "wrapperClass");
|
|
58
|
+
__publicField$a(this, "ownsContainer");
|
|
59
|
+
__publicField$a(this, "_container");
|
|
60
|
+
__publicField$a(this, "_positionsContainers");
|
|
61
|
+
__publicField$a(this, "_targets", /* @__PURE__ */ new Set());
|
|
62
|
+
__publicField$a(this, "_idContainers", /* @__PURE__ */ new Map());
|
|
63
|
+
__publicField$a(this, "_pendingChildren", /* @__PURE__ */ new Map());
|
|
64
|
+
__publicField$a(this, "_orders", /* @__PURE__ */ new WeakMap());
|
|
65
|
+
__publicField$a(this, "_targetOptions", /* @__PURE__ */ new WeakMap());
|
|
66
|
+
__publicField$a(this, "_switchGroups", /* @__PURE__ */ new WeakMap());
|
|
67
|
+
__publicField$a(this, "_switchBindings", /* @__PURE__ */ new WeakMap());
|
|
68
|
+
this.classPrefix = opt.classPrefix || this.classPrefix;
|
|
69
|
+
this.addClass = opt.addClass;
|
|
70
|
+
this.map = opt.map;
|
|
71
|
+
this.wrapperClass = opt.wrapperClass;
|
|
72
|
+
const externalPositions = [
|
|
73
|
+
"top-right",
|
|
74
|
+
"top-left",
|
|
75
|
+
"bottom-right",
|
|
76
|
+
"bottom-left"
|
|
77
|
+
];
|
|
78
|
+
const positionContainers = externalPositions.some(
|
|
79
|
+
(position) => {
|
|
80
|
+
var _a;
|
|
81
|
+
return !!((_a = opt.positionContainers) == null ? void 0 : _a[position]);
|
|
82
|
+
}
|
|
83
|
+
) ? opt.positionContainers : void 0;
|
|
84
|
+
this.ownsContainer = !opt.container && !positionContainers;
|
|
85
|
+
const { element, positionsContainers } = this.createContainerElement(
|
|
86
|
+
opt.container,
|
|
87
|
+
positionContainers
|
|
88
|
+
);
|
|
89
|
+
this._container = element;
|
|
90
|
+
this._positionsContainers = positionsContainers;
|
|
33
91
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
92
|
+
addTo(el) {
|
|
93
|
+
if (!this.ownsContainer) {
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
const el_ = getElement(el);
|
|
97
|
+
if (el_) {
|
|
98
|
+
el_.appendChild(this._container);
|
|
99
|
+
}
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
detach() {
|
|
103
|
+
if (!this.ownsContainer) {
|
|
104
|
+
Array.from(this._targets).forEach((target) => this.removeTarget(target));
|
|
105
|
+
this._pendingChildren.clear();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const parent = this._container.parentElement;
|
|
109
|
+
if (parent) {
|
|
110
|
+
parent.removeChild(this._container);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
getContainer() {
|
|
114
|
+
return this._container;
|
|
115
|
+
}
|
|
116
|
+
getPositionContainer(position) {
|
|
117
|
+
return this._positionsContainers[position];
|
|
118
|
+
}
|
|
119
|
+
newPositionContainer(position, order = 0, control) {
|
|
120
|
+
var _a;
|
|
121
|
+
const newContainer = document.createElement("div");
|
|
122
|
+
newContainer.className = `${this.classPrefix}-ctrl-wrapper` + (this.wrapperClass ? " " + this.wrapperClass : "");
|
|
123
|
+
if ((_a = getControlOptions(control)) == null ? void 0 : _a.margin) {
|
|
124
|
+
newContainer.classList.add(`${this.classPrefix}-ctrl-margin`);
|
|
125
|
+
}
|
|
126
|
+
this.append(newContainer, position, order, control);
|
|
127
|
+
return newContainer;
|
|
128
|
+
}
|
|
129
|
+
addControl(control, position, options = {}) {
|
|
130
|
+
const controlContainer = control.onAdd(this.map);
|
|
131
|
+
if (controlContainer instanceof HTMLElement) {
|
|
132
|
+
const target = this.newPositionContainer(
|
|
133
|
+
position,
|
|
134
|
+
options.order,
|
|
135
|
+
control
|
|
136
|
+
);
|
|
137
|
+
if (target) {
|
|
138
|
+
target.appendChild(controlContainer);
|
|
139
|
+
if (options.id) {
|
|
140
|
+
this.registerIDContainer(options.id, controlContainer, control);
|
|
141
|
+
}
|
|
142
|
+
return target;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
append(element, position, order = 0, control) {
|
|
147
|
+
const node = this._normalizeElement(element);
|
|
148
|
+
if (!node) return;
|
|
149
|
+
const positionContainer = this._resolveTargetContainer(position);
|
|
150
|
+
if (positionContainer) {
|
|
151
|
+
this._insertSorted(positionContainer, node, order);
|
|
152
|
+
this._registerSwitchControl(node, control, positionContainer);
|
|
153
|
+
return positionContainer;
|
|
154
|
+
} else if (typeof position !== "string") {
|
|
155
|
+
this._appendPending(position.inside, node, order, control);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
registerIDContainer(id, controlRoot, control) {
|
|
159
|
+
this._idContainers.set(id, controlRoot);
|
|
160
|
+
this._registerTargetOptions(controlRoot, control);
|
|
161
|
+
this._flushPending(id, controlRoot);
|
|
162
|
+
}
|
|
163
|
+
unregisterIDContainer(id) {
|
|
164
|
+
const controlRoot = this._idContainers.get(id);
|
|
165
|
+
if (controlRoot) {
|
|
166
|
+
this._targetOptions.delete(controlRoot);
|
|
167
|
+
}
|
|
168
|
+
this._idContainers.delete(id);
|
|
169
|
+
this._pendingChildren.delete(id);
|
|
170
|
+
}
|
|
171
|
+
removeTarget(target) {
|
|
172
|
+
const parent = target.parentElement;
|
|
173
|
+
if (parent) {
|
|
174
|
+
parent.removeChild(target);
|
|
175
|
+
}
|
|
176
|
+
this._unregisterSwitchControl(target);
|
|
177
|
+
this._removePending(target);
|
|
178
|
+
this._targets.delete(target);
|
|
179
|
+
}
|
|
180
|
+
createContainerElement(container, positionContainers) {
|
|
181
|
+
const element = container || document.createElement("div");
|
|
182
|
+
if (!container) {
|
|
183
|
+
element.className = `${this.classPrefix}-control-container` + (this.addClass ? " " + this.addClass : "");
|
|
184
|
+
}
|
|
185
|
+
const positionsContainers = {};
|
|
186
|
+
const positions = [
|
|
187
|
+
"top-right",
|
|
188
|
+
"top-left",
|
|
189
|
+
"bottom-right",
|
|
190
|
+
"bottom-left"
|
|
191
|
+
];
|
|
192
|
+
positions.forEach((x) => {
|
|
193
|
+
const positionContainer = (positionContainers == null ? void 0 : positionContainers[x]) || this._createPositionContainer(x);
|
|
194
|
+
positionsContainers[x] = positionContainer;
|
|
195
|
+
if (!(positionContainers == null ? void 0 : positionContainers[x])) {
|
|
196
|
+
element.appendChild(positionContainer);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return { element, positionsContainers };
|
|
200
|
+
}
|
|
201
|
+
_createPositionContainer(position) {
|
|
202
|
+
const positionContainer = document.createElement("div");
|
|
203
|
+
positionContainer.className = `${this.classPrefix}-ctrl-${position}`;
|
|
204
|
+
return positionContainer;
|
|
205
|
+
}
|
|
206
|
+
_resolveTargetContainer(position) {
|
|
207
|
+
return typeof position === "string" ? this._positionsContainers[position] : this._idContainers.get(position.inside);
|
|
208
|
+
}
|
|
209
|
+
_normalizeElement(element) {
|
|
210
|
+
if (typeof element !== "string") {
|
|
211
|
+
return element;
|
|
212
|
+
}
|
|
213
|
+
const template = document.createElement("template");
|
|
214
|
+
template.innerHTML = element.trim();
|
|
215
|
+
return template.content.firstElementChild;
|
|
216
|
+
}
|
|
217
|
+
_insertSorted(positionContainer, element, order) {
|
|
218
|
+
this._orders.set(element, order);
|
|
219
|
+
element.style.order = String(order);
|
|
220
|
+
const isBottomPosition = this._isBottomPositionContainer(positionContainer);
|
|
221
|
+
const children = Array.from(positionContainer.children);
|
|
222
|
+
const before = children.find((child) => {
|
|
223
|
+
var _a;
|
|
224
|
+
if (child === element) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
const value = (_a = this._orders.get(child)) != null ? _a : Number.POSITIVE_INFINITY;
|
|
228
|
+
return isBottomPosition ? value <= order : value > order;
|
|
229
|
+
});
|
|
230
|
+
if (before) {
|
|
231
|
+
positionContainer.insertBefore(element, before);
|
|
232
|
+
} else if (element.parentElement === positionContainer) {
|
|
233
|
+
return;
|
|
234
|
+
} else {
|
|
235
|
+
positionContainer.appendChild(element);
|
|
236
|
+
}
|
|
237
|
+
this._targets.add(element);
|
|
238
|
+
}
|
|
239
|
+
_isBottomPositionContainer(element) {
|
|
240
|
+
return element === this._positionsContainers["bottom-left"] || element === this._positionsContainers["bottom-right"];
|
|
241
|
+
}
|
|
242
|
+
_appendPending(parentId, element, order, control) {
|
|
243
|
+
const parent = element.parentElement;
|
|
244
|
+
if (parent) {
|
|
245
|
+
parent.removeChild(element);
|
|
246
|
+
}
|
|
247
|
+
const pending = this._pendingChildren.get(parentId) || [];
|
|
248
|
+
pending.push({ element, order, control });
|
|
249
|
+
pending.sort((a, b) => a.order - b.order);
|
|
250
|
+
this._pendingChildren.set(parentId, pending);
|
|
251
|
+
this._targets.add(element);
|
|
252
|
+
}
|
|
253
|
+
_flushPending(parentId, target) {
|
|
254
|
+
const pending = this._pendingChildren.get(parentId);
|
|
255
|
+
if (!pending) return;
|
|
256
|
+
for (const { element, order, control } of pending) {
|
|
257
|
+
this._insertSorted(target, element, order);
|
|
258
|
+
this._registerSwitchControl(element, control, target);
|
|
259
|
+
}
|
|
260
|
+
this._pendingChildren.delete(parentId);
|
|
261
|
+
}
|
|
262
|
+
_removePending(target) {
|
|
263
|
+
this._pendingChildren.forEach((children, parentId) => {
|
|
264
|
+
const filtered = children.filter(({ element }) => element !== target);
|
|
265
|
+
if (filtered.length) {
|
|
266
|
+
this._pendingChildren.set(parentId, filtered);
|
|
267
|
+
} else {
|
|
268
|
+
this._pendingChildren.delete(parentId);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
_registerSwitchControl(element, control, target) {
|
|
273
|
+
if (!this._isSwitchToggleControl(control)) return;
|
|
274
|
+
this._unregisterSwitchControl(element);
|
|
275
|
+
const groupName = typeof control.switch === "string" ? control.switch : "default";
|
|
276
|
+
const group = this._getSwitchGroup(target, groupName);
|
|
277
|
+
const hadDisableOnSecondClick = Object.prototype.hasOwnProperty.call(
|
|
278
|
+
control,
|
|
279
|
+
"disableOnSecondClick"
|
|
280
|
+
);
|
|
281
|
+
const previousDisableOnSecondClick = control.disableOnSecondClick;
|
|
282
|
+
const targetDisableOnSecondClick = control.disableOnSecondClick === void 0 ? this._getTargetDisableOnSecondClick(target) : void 0;
|
|
283
|
+
if (targetDisableOnSecondClick !== void 0) {
|
|
284
|
+
control.disableOnSecondClick = targetDisableOnSecondClick;
|
|
285
|
+
}
|
|
286
|
+
group.add(control);
|
|
287
|
+
const unsubscribe = control.onStatusChange((status) => {
|
|
288
|
+
if (status) {
|
|
289
|
+
this._disableSwitchSiblings(control, group);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
this._switchBindings.set(element, {
|
|
293
|
+
control,
|
|
294
|
+
group,
|
|
295
|
+
unsubscribe,
|
|
296
|
+
hadDisableOnSecondClick,
|
|
297
|
+
previousDisableOnSecondClick
|
|
298
|
+
});
|
|
299
|
+
if (control.getStatus()) {
|
|
300
|
+
this._disableSwitchSiblings(control, group);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
_unregisterSwitchControl(element) {
|
|
304
|
+
const binding = this._switchBindings.get(element);
|
|
305
|
+
if (binding) {
|
|
306
|
+
binding.unsubscribe();
|
|
307
|
+
binding.group.delete(binding.control);
|
|
308
|
+
if (binding.hadDisableOnSecondClick) {
|
|
309
|
+
binding.control.disableOnSecondClick = binding.previousDisableOnSecondClick;
|
|
310
|
+
} else {
|
|
311
|
+
delete binding.control.disableOnSecondClick;
|
|
312
|
+
}
|
|
313
|
+
this._switchBindings.delete(element);
|
|
314
|
+
}
|
|
315
|
+
Array.from(element.children).forEach((child) => {
|
|
316
|
+
if (child instanceof HTMLElement) {
|
|
317
|
+
this._unregisterSwitchControl(child);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
_getSwitchGroup(target, groupName) {
|
|
322
|
+
let targetGroups = this._switchGroups.get(target);
|
|
323
|
+
if (!targetGroups) {
|
|
324
|
+
targetGroups = /* @__PURE__ */ new Map();
|
|
325
|
+
this._switchGroups.set(target, targetGroups);
|
|
326
|
+
}
|
|
327
|
+
let group = targetGroups.get(groupName);
|
|
328
|
+
if (!group) {
|
|
329
|
+
group = /* @__PURE__ */ new Set();
|
|
330
|
+
targetGroups.set(groupName, group);
|
|
331
|
+
}
|
|
332
|
+
return group;
|
|
333
|
+
}
|
|
334
|
+
_disableSwitchSiblings(activeControl, group) {
|
|
335
|
+
group.forEach((control) => {
|
|
336
|
+
if (control !== activeControl && control.getStatus()) {
|
|
337
|
+
control.onClick(false);
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
_getTargetDisableOnSecondClick(target) {
|
|
342
|
+
var _a;
|
|
343
|
+
return (_a = this._targetOptions.get(target)) == null ? void 0 : _a.disableOnSecondClick;
|
|
344
|
+
}
|
|
345
|
+
_isSwitchToggleControl(control) {
|
|
346
|
+
const toggle = control;
|
|
347
|
+
return !!((toggle == null ? void 0 : toggle.switch) && typeof toggle.onStatusChange === "function" && typeof toggle.getStatus === "function" && typeof toggle.onClick === "function");
|
|
348
|
+
}
|
|
349
|
+
_registerTargetOptions(target, control) {
|
|
350
|
+
const options = getControlOptions(control) || getControlOptions(target);
|
|
351
|
+
if (options) {
|
|
352
|
+
this._targetOptions.set(target, options);
|
|
353
|
+
} else {
|
|
354
|
+
this._targetOptions.delete(target);
|
|
355
|
+
}
|
|
38
356
|
}
|
|
39
|
-
|
|
40
|
-
this._maxListeners = this._maxListeners || undefined;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Obviously not all Emitters should be limited to 10. This function allows
|
|
44
|
-
// that to be increased. Set to zero for unlimited.
|
|
45
|
-
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
46
|
-
if (typeof n !== 'number' || n < 0 || isNaN(n))
|
|
47
|
-
throw new TypeError('"n" argument must be a positive number');
|
|
48
|
-
this._maxListeners = n;
|
|
49
|
-
return this;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
function $getMaxListeners(that) {
|
|
53
|
-
if (that._maxListeners === undefined)
|
|
54
|
-
return EventEmitter.defaultMaxListeners;
|
|
55
|
-
return that._maxListeners;
|
|
56
357
|
}
|
|
57
358
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var listeners = arrayClone(handler, len);
|
|
73
|
-
for (var i = 0; i < len; ++i)
|
|
74
|
-
listeners[i].call(self);
|
|
359
|
+
const STOP_PROPAGATION_EVENTS = [
|
|
360
|
+
"wheel",
|
|
361
|
+
"click",
|
|
362
|
+
"mouseup",
|
|
363
|
+
"touchend",
|
|
364
|
+
"dblclick",
|
|
365
|
+
"pointerup",
|
|
366
|
+
"mousedown",
|
|
367
|
+
"touchstart",
|
|
368
|
+
"pointerdown"
|
|
369
|
+
];
|
|
370
|
+
function addClasses(element, classes) {
|
|
371
|
+
if (classes) {
|
|
372
|
+
classes.split(" ").filter(Boolean).forEach((x) => element.classList.add(x));
|
|
75
373
|
}
|
|
76
374
|
}
|
|
77
|
-
function
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
else {
|
|
81
|
-
var len = handler.length;
|
|
82
|
-
var listeners = arrayClone(handler, len);
|
|
83
|
-
for (var i = 0; i < len; ++i)
|
|
84
|
-
listeners[i].call(self, arg1);
|
|
375
|
+
function removeElement(element) {
|
|
376
|
+
if (element == null ? void 0 : element.parentNode) {
|
|
377
|
+
element.parentNode.removeChild(element);
|
|
85
378
|
}
|
|
86
379
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
380
|
+
function stopPropagation(event) {
|
|
381
|
+
event.stopPropagation();
|
|
382
|
+
}
|
|
383
|
+
function preventMapEventPropagation(element) {
|
|
384
|
+
STOP_PROPAGATION_EVENTS.forEach((eventName) => {
|
|
385
|
+
element.addEventListener(eventName, stopPropagation);
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
function getAlignValue(align) {
|
|
389
|
+
if (align === "start") return "flex-start";
|
|
390
|
+
if (align === "end") return "flex-end";
|
|
391
|
+
return align;
|
|
392
|
+
}
|
|
393
|
+
function isZeroGap(gap) {
|
|
394
|
+
if (typeof gap === "number") {
|
|
395
|
+
return gap === 0;
|
|
95
396
|
}
|
|
397
|
+
if (typeof gap === "string") {
|
|
398
|
+
return gap.trim().split(/\s+/).every((x) => /^0(?:\.0+)?(?:[a-z%]+)?$/i.test(x));
|
|
399
|
+
}
|
|
400
|
+
return false;
|
|
96
401
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
402
|
+
function createControlContainer(options = {}) {
|
|
403
|
+
const resolvedOptions = resolveControlOptions(options);
|
|
404
|
+
const element = document.createElement("div");
|
|
405
|
+
element.className = "webmap-ctrl";
|
|
406
|
+
if (resolvedOptions.bar) {
|
|
407
|
+
element.classList.add("webmap-ctrl-group");
|
|
408
|
+
}
|
|
409
|
+
if (resolvedOptions.margin) {
|
|
410
|
+
element.classList.add("webmap-ctrl-margin");
|
|
411
|
+
}
|
|
412
|
+
const orientation = resolvedOptions.orientation || resolvedOptions.direction;
|
|
413
|
+
if (orientation) {
|
|
414
|
+
element.classList.add(`webmap-ctrl-${orientation}`);
|
|
105
415
|
}
|
|
416
|
+
if (resolvedOptions.gap !== void 0) {
|
|
417
|
+
const gap = typeof resolvedOptions.gap === "number" ? `${resolvedOptions.gap}px` : resolvedOptions.gap;
|
|
418
|
+
element.style.setProperty("--webmap-ctrl-gap", gap);
|
|
419
|
+
if (isZeroGap(resolvedOptions.gap)) {
|
|
420
|
+
element.classList.add("webmap-ctrl-gapless");
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const align = getAlignValue(resolvedOptions.align);
|
|
424
|
+
if (align) {
|
|
425
|
+
element.style.setProperty("--webmap-ctrl-align", align);
|
|
426
|
+
}
|
|
427
|
+
addClasses(element, resolvedOptions.addClass);
|
|
428
|
+
preventMapEventPropagation(element);
|
|
429
|
+
return element;
|
|
106
430
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var len = handler.length;
|
|
113
|
-
var listeners = arrayClone(handler, len);
|
|
114
|
-
for (var i = 0; i < len; ++i)
|
|
115
|
-
listeners[i].apply(self, args);
|
|
431
|
+
function appendHtml(element, html) {
|
|
432
|
+
if (html instanceof HTMLElement) {
|
|
433
|
+
element.appendChild(html);
|
|
434
|
+
} else if (typeof html === "string") {
|
|
435
|
+
element.innerHTML = html;
|
|
116
436
|
}
|
|
117
437
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
438
|
+
function createControlElement(control, options = {}, map) {
|
|
439
|
+
const element = createControlContainer(options);
|
|
440
|
+
setControlOptions(element, options);
|
|
441
|
+
const content = control.onAdd(map);
|
|
442
|
+
if (content) {
|
|
443
|
+
element.appendChild(content);
|
|
444
|
+
}
|
|
445
|
+
return element;
|
|
446
|
+
}
|
|
447
|
+
function createButtonControlContent(options) {
|
|
448
|
+
let button;
|
|
449
|
+
const onClick = (event) => {
|
|
450
|
+
event.preventDefault();
|
|
451
|
+
event.stopPropagation();
|
|
452
|
+
options.onClick();
|
|
453
|
+
};
|
|
454
|
+
const buttonControl = {
|
|
455
|
+
onAdd() {
|
|
456
|
+
button = document.createElement("button");
|
|
457
|
+
button.type = "button";
|
|
458
|
+
button.className = "webmap-ctrl-button";
|
|
459
|
+
addClasses(button, options.addClass);
|
|
460
|
+
if (options.title) {
|
|
461
|
+
button.title = options.title;
|
|
462
|
+
button.setAttribute("aria-label", options.title);
|
|
463
|
+
}
|
|
464
|
+
appendHtml(button, options.html);
|
|
465
|
+
button.addEventListener("click", onClick);
|
|
466
|
+
return button;
|
|
467
|
+
},
|
|
468
|
+
onRemove() {
|
|
469
|
+
if (button) {
|
|
470
|
+
button.removeEventListener("click", onClick);
|
|
471
|
+
removeElement(button);
|
|
472
|
+
button = void 0;
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
getContainer() {
|
|
476
|
+
return button;
|
|
148
477
|
}
|
|
149
|
-
|
|
478
|
+
};
|
|
479
|
+
buttonControl.remove = () => {
|
|
480
|
+
buttonControl.onRemove();
|
|
481
|
+
};
|
|
482
|
+
return buttonControl;
|
|
483
|
+
}
|
|
484
|
+
function createToggleControlContent(options) {
|
|
485
|
+
const link = document.createElement("div");
|
|
486
|
+
const statusListeners = /* @__PURE__ */ new Set();
|
|
487
|
+
let status = false;
|
|
488
|
+
if (options.getStatus) {
|
|
489
|
+
status = options.getStatus();
|
|
490
|
+
} else if (options.status) {
|
|
491
|
+
status = options.status;
|
|
150
492
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return false;
|
|
156
|
-
|
|
157
|
-
var isFn = typeof handler === 'function';
|
|
158
|
-
len = arguments.length;
|
|
159
|
-
switch (len) {
|
|
160
|
-
// fast cases
|
|
161
|
-
case 1:
|
|
162
|
-
emitNone(handler, isFn, this);
|
|
163
|
-
break;
|
|
164
|
-
case 2:
|
|
165
|
-
emitOne(handler, isFn, this, arguments[1]);
|
|
166
|
-
break;
|
|
167
|
-
case 3:
|
|
168
|
-
emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
|
169
|
-
break;
|
|
170
|
-
case 4:
|
|
171
|
-
emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
|
172
|
-
break;
|
|
173
|
-
// slower
|
|
174
|
-
default:
|
|
175
|
-
args = new Array(len - 1);
|
|
176
|
-
for (i = 1; i < len; i++)
|
|
177
|
-
args[i - 1] = arguments[i];
|
|
178
|
-
emitMany(handler, isFn, this, args);
|
|
493
|
+
const title = options.title || "";
|
|
494
|
+
const html = options.html;
|
|
495
|
+
function notifyStatusChange(control) {
|
|
496
|
+
statusListeners.forEach((listener) => listener(status, control));
|
|
179
497
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (typeof listener !== 'function')
|
|
190
|
-
throw new TypeError('"listener" argument must be a function');
|
|
191
|
-
|
|
192
|
-
events = target._events;
|
|
193
|
-
if (!events) {
|
|
194
|
-
events = target._events = new EventHandlers();
|
|
195
|
-
target._eventsCount = 0;
|
|
196
|
-
} else {
|
|
197
|
-
// To avoid recursion in the case that type === "newListener"! Before
|
|
198
|
-
// adding it to the listeners, first emit "newListener".
|
|
199
|
-
if (events.newListener) {
|
|
200
|
-
target.emit('newListener', type,
|
|
201
|
-
listener.listener ? listener.listener : listener);
|
|
202
|
-
|
|
203
|
-
// Re-assign `events` because a newListener handler could have caused the
|
|
204
|
-
// this._events to be assigned to a new object
|
|
205
|
-
events = target._events;
|
|
498
|
+
function setTitle() {
|
|
499
|
+
if (title) {
|
|
500
|
+
if (typeof title === "string") {
|
|
501
|
+
link.title = title;
|
|
502
|
+
} else {
|
|
503
|
+
link.title = status ? title.on : title.off;
|
|
504
|
+
}
|
|
505
|
+
link.setAttribute("aria-label", link.title);
|
|
206
506
|
}
|
|
207
|
-
existing = events[type];
|
|
208
507
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
} else {
|
|
215
|
-
if (typeof existing === 'function') {
|
|
216
|
-
// Adding the second element, need to change to array.
|
|
217
|
-
existing = events[type] = prepend ? [listener, existing] :
|
|
218
|
-
[existing, listener];
|
|
219
|
-
} else {
|
|
220
|
-
// If we've already got an array, just append.
|
|
221
|
-
if (prepend) {
|
|
222
|
-
existing.unshift(listener);
|
|
508
|
+
function setHtml() {
|
|
509
|
+
if (html) {
|
|
510
|
+
link.innerHTML = "";
|
|
511
|
+
if (typeof html === "string" || html instanceof HTMLElement) {
|
|
512
|
+
appendHtml(link, html);
|
|
223
513
|
} else {
|
|
224
|
-
|
|
514
|
+
appendHtml(link, status ? html.on : html.off);
|
|
225
515
|
}
|
|
226
516
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
existing.length + ' ' + type + ' listeners added. ' +
|
|
235
|
-
'Use emitter.setMaxListeners() to increase limit');
|
|
236
|
-
w.name = 'MaxListenersExceededWarning';
|
|
237
|
-
w.emitter = target;
|
|
238
|
-
w.type = type;
|
|
239
|
-
w.count = existing.length;
|
|
240
|
-
emitWarning(w);
|
|
517
|
+
}
|
|
518
|
+
function setClasses(classes, impact) {
|
|
519
|
+
classes.split(" ").filter(Boolean).forEach((x) => {
|
|
520
|
+
if (impact) {
|
|
521
|
+
link.classList.add(x);
|
|
522
|
+
} else {
|
|
523
|
+
link.classList.remove(x);
|
|
241
524
|
}
|
|
242
|
-
}
|
|
525
|
+
});
|
|
243
526
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
251
|
-
return _addListener(this, type, listener, false);
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
255
|
-
|
|
256
|
-
EventEmitter.prototype.prependListener =
|
|
257
|
-
function prependListener(type, listener) {
|
|
258
|
-
return _addListener(this, type, listener, true);
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
function _onceWrap(target, type, listener) {
|
|
262
|
-
var fired = false;
|
|
263
|
-
function g() {
|
|
264
|
-
target.removeListener(type, g);
|
|
265
|
-
if (!fired) {
|
|
266
|
-
fired = true;
|
|
267
|
-
listener.apply(target, arguments);
|
|
527
|
+
function setStatusClasses() {
|
|
528
|
+
if (options.addClassOn) {
|
|
529
|
+
setClasses(options.addClassOn, status);
|
|
530
|
+
}
|
|
531
|
+
if (options.addClassOff) {
|
|
532
|
+
setClasses(options.addClassOff, !status);
|
|
268
533
|
}
|
|
269
534
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return this;
|
|
300
|
-
|
|
301
|
-
list = events[type];
|
|
302
|
-
if (!list)
|
|
303
|
-
return this;
|
|
304
|
-
|
|
305
|
-
if (list === listener || (list.listener && list.listener === listener)) {
|
|
306
|
-
if (--this._eventsCount === 0)
|
|
307
|
-
this._events = new EventHandlers();
|
|
308
|
-
else {
|
|
309
|
-
delete events[type];
|
|
310
|
-
if (events.removeListener)
|
|
311
|
-
this.emit('removeListener', type, list.listener || listener);
|
|
312
|
-
}
|
|
313
|
-
} else if (typeof list !== 'function') {
|
|
314
|
-
position = -1;
|
|
315
|
-
|
|
316
|
-
for (i = list.length; i-- > 0;) {
|
|
317
|
-
if (list[i] === listener ||
|
|
318
|
-
(list[i].listener && list[i].listener === listener)) {
|
|
319
|
-
originalListener = list[i].listener;
|
|
320
|
-
position = i;
|
|
321
|
-
break;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (position < 0)
|
|
326
|
-
return this;
|
|
327
|
-
|
|
328
|
-
if (list.length === 1) {
|
|
329
|
-
list[0] = undefined;
|
|
330
|
-
if (--this._eventsCount === 0) {
|
|
331
|
-
this._events = new EventHandlers();
|
|
332
|
-
return this;
|
|
333
|
-
} else {
|
|
334
|
-
delete events[type];
|
|
335
|
-
}
|
|
336
|
-
} else {
|
|
337
|
-
spliceOne(list, position);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (events.removeListener)
|
|
341
|
-
this.emit('removeListener', type, originalListener || listener);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
return this;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
// Alias for removeListener added in NodeJS 10.0
|
|
348
|
-
// https://nodejs.org/api/events.html#events_emitter_off_eventname_listener
|
|
349
|
-
EventEmitter.prototype.off = function(type, listener){
|
|
350
|
-
return this.removeListener(type, listener);
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
EventEmitter.prototype.removeAllListeners =
|
|
354
|
-
function removeAllListeners(type) {
|
|
355
|
-
var listeners, events;
|
|
356
|
-
|
|
357
|
-
events = this._events;
|
|
358
|
-
if (!events)
|
|
359
|
-
return this;
|
|
360
|
-
|
|
361
|
-
// not listening for removeListener, no need to emit
|
|
362
|
-
if (!events.removeListener) {
|
|
363
|
-
if (arguments.length === 0) {
|
|
364
|
-
this._events = new EventHandlers();
|
|
365
|
-
this._eventsCount = 0;
|
|
366
|
-
} else if (events[type]) {
|
|
367
|
-
if (--this._eventsCount === 0)
|
|
368
|
-
this._events = new EventHandlers();
|
|
369
|
-
else
|
|
370
|
-
delete events[type];
|
|
371
|
-
}
|
|
372
|
-
return this;
|
|
535
|
+
setTitle();
|
|
536
|
+
setHtml();
|
|
537
|
+
if (options.addClass) {
|
|
538
|
+
setClasses(options.addClass, true);
|
|
539
|
+
}
|
|
540
|
+
setStatusClasses();
|
|
541
|
+
const changeStatus = (status_) => {
|
|
542
|
+
if (status_ !== void 0) {
|
|
543
|
+
status = status_;
|
|
544
|
+
}
|
|
545
|
+
setHtml();
|
|
546
|
+
setTitle();
|
|
547
|
+
setStatusClasses();
|
|
548
|
+
};
|
|
549
|
+
const getStatus = () => status;
|
|
550
|
+
const onClick = (status_) => {
|
|
551
|
+
if (status_ === void 0 && status && buttonControl.disableOnSecondClick) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
const previousStatus = status;
|
|
555
|
+
status = status_ !== void 0 ? status_ : !status;
|
|
556
|
+
if (options.onClick) {
|
|
557
|
+
let afterClick;
|
|
558
|
+
try {
|
|
559
|
+
afterClick = options.onClick(status);
|
|
560
|
+
} catch (er) {
|
|
561
|
+
status = previousStatus;
|
|
562
|
+
changeStatus();
|
|
563
|
+
throw er;
|
|
373
564
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
for (var i = 0, key; i < keys.length; ++i) {
|
|
379
|
-
key = keys[i];
|
|
380
|
-
if (key === 'removeListener') continue;
|
|
381
|
-
this.removeAllListeners(key);
|
|
565
|
+
Promise.resolve(afterClick).then(() => {
|
|
566
|
+
changeStatus();
|
|
567
|
+
if (previousStatus !== status) {
|
|
568
|
+
notifyStatusChange(buttonControl);
|
|
382
569
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
if (typeof listeners === 'function') {
|
|
392
|
-
this.removeListener(type, listeners);
|
|
393
|
-
} else if (listeners) {
|
|
394
|
-
// LIFO order
|
|
395
|
-
do {
|
|
396
|
-
this.removeListener(type, listeners[listeners.length - 1]);
|
|
397
|
-
} while (listeners[0]);
|
|
570
|
+
}).catch(() => {
|
|
571
|
+
status = previousStatus;
|
|
572
|
+
changeStatus();
|
|
573
|
+
});
|
|
574
|
+
} else {
|
|
575
|
+
changeStatus();
|
|
576
|
+
if (previousStatus !== status) {
|
|
577
|
+
notifyStatusChange(buttonControl);
|
|
398
578
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
evlistener = events[type];
|
|
412
|
-
if (!evlistener)
|
|
413
|
-
ret = [];
|
|
414
|
-
else if (typeof evlistener === 'function')
|
|
415
|
-
ret = [evlistener.listener || evlistener];
|
|
416
|
-
else
|
|
417
|
-
ret = unwrapListeners(evlistener);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return ret;
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
EventEmitter.listenerCount = function(emitter, type) {
|
|
424
|
-
if (typeof emitter.listenerCount === 'function') {
|
|
425
|
-
return emitter.listenerCount(type);
|
|
426
|
-
} else {
|
|
427
|
-
return listenerCount.call(emitter, type);
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
EventEmitter.prototype.listenerCount = listenerCount;
|
|
432
|
-
function listenerCount(type) {
|
|
433
|
-
var events = this._events;
|
|
434
|
-
|
|
435
|
-
if (events) {
|
|
436
|
-
var evlistener = events[type];
|
|
437
|
-
|
|
438
|
-
if (typeof evlistener === 'function') {
|
|
439
|
-
return 1;
|
|
440
|
-
} else if (evlistener) {
|
|
441
|
-
return evlistener.length;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
return 0;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
EventEmitter.prototype.eventNames = function eventNames() {
|
|
449
|
-
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
// About 1.5x faster than the two-arg version of Array#splice().
|
|
453
|
-
function spliceOne(list, index) {
|
|
454
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
|
|
455
|
-
list[i] = list[k];
|
|
456
|
-
list.pop();
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function arrayClone(arr, i) {
|
|
460
|
-
var copy = new Array(i);
|
|
461
|
-
while (i--)
|
|
462
|
-
copy[i] = arr[i];
|
|
463
|
-
return copy;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
function unwrapListeners(arr) {
|
|
467
|
-
var ret = new Array(arr.length);
|
|
468
|
-
for (var i = 0; i < ret.length; ++i) {
|
|
469
|
-
ret[i] = arr[i].listener || arr[i];
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
const buttonControl = createButtonControlContent({
|
|
582
|
+
html: link,
|
|
583
|
+
onClick
|
|
584
|
+
});
|
|
585
|
+
buttonControl.onClick = onClick;
|
|
586
|
+
buttonControl.changeStatus = changeStatus;
|
|
587
|
+
buttonControl.getStatus = getStatus;
|
|
588
|
+
buttonControl.switch = options.switch;
|
|
589
|
+
if (options.disableOnSecondClick !== void 0) {
|
|
590
|
+
buttonControl.disableOnSecondClick = options.disableOnSecondClick;
|
|
470
591
|
}
|
|
471
|
-
|
|
592
|
+
buttonControl.onStatusChange = (listener) => {
|
|
593
|
+
statusListeners.add(listener);
|
|
594
|
+
return () => statusListeners.delete(listener);
|
|
595
|
+
};
|
|
596
|
+
return buttonControl;
|
|
472
597
|
}
|
|
473
598
|
|
|
474
599
|
var leafletSrc$1 = {exports: {}};
|
|
@@ -14185,365 +14310,1019 @@ function requireLeafletSrc () {
|
|
|
14185
14310
|
});
|
|
14186
14311
|
|
|
14187
14312
|
// @section Handlers
|
|
14188
|
-
// @property scrollWheelZoom: Handler
|
|
14189
|
-
// Scroll wheel zoom handler.
|
|
14190
|
-
Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom);
|
|
14313
|
+
// @property scrollWheelZoom: Handler
|
|
14314
|
+
// Scroll wheel zoom handler.
|
|
14315
|
+
Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom);
|
|
14316
|
+
|
|
14317
|
+
/*
|
|
14318
|
+
* L.Map.Tap is used to enable mobile hacks like quick taps and long hold.
|
|
14319
|
+
*/
|
|
14320
|
+
|
|
14321
|
+
// @namespace Map
|
|
14322
|
+
// @section Interaction Options
|
|
14323
|
+
Map.mergeOptions({
|
|
14324
|
+
// @section Touch interaction options
|
|
14325
|
+
// @option tap: Boolean = true
|
|
14326
|
+
// Enables mobile hacks for supporting instant taps (fixing 200ms click
|
|
14327
|
+
// delay on iOS/Android) and touch holds (fired as `contextmenu` events).
|
|
14328
|
+
tap: true,
|
|
14329
|
+
|
|
14330
|
+
// @option tapTolerance: Number = 15
|
|
14331
|
+
// The max number of pixels a user can shift his finger during touch
|
|
14332
|
+
// for it to be considered a valid tap.
|
|
14333
|
+
tapTolerance: 15
|
|
14334
|
+
});
|
|
14335
|
+
|
|
14336
|
+
var Tap = Handler.extend({
|
|
14337
|
+
addHooks: function () {
|
|
14338
|
+
on(this._map._container, 'touchstart', this._onDown, this);
|
|
14339
|
+
},
|
|
14340
|
+
|
|
14341
|
+
removeHooks: function () {
|
|
14342
|
+
off(this._map._container, 'touchstart', this._onDown, this);
|
|
14343
|
+
},
|
|
14344
|
+
|
|
14345
|
+
_onDown: function (e) {
|
|
14346
|
+
if (!e.touches) { return; }
|
|
14347
|
+
|
|
14348
|
+
preventDefault(e);
|
|
14349
|
+
|
|
14350
|
+
this._fireClick = true;
|
|
14351
|
+
|
|
14352
|
+
// don't simulate click or track longpress if more than 1 touch
|
|
14353
|
+
if (e.touches.length > 1) {
|
|
14354
|
+
this._fireClick = false;
|
|
14355
|
+
clearTimeout(this._holdTimeout);
|
|
14356
|
+
return;
|
|
14357
|
+
}
|
|
14358
|
+
|
|
14359
|
+
var first = e.touches[0],
|
|
14360
|
+
el = first.target;
|
|
14361
|
+
|
|
14362
|
+
this._startPos = this._newPos = new Point(first.clientX, first.clientY);
|
|
14363
|
+
|
|
14364
|
+
// if touching a link, highlight it
|
|
14365
|
+
if (el.tagName && el.tagName.toLowerCase() === 'a') {
|
|
14366
|
+
addClass(el, 'leaflet-active');
|
|
14367
|
+
}
|
|
14368
|
+
|
|
14369
|
+
// simulate long hold but setting a timeout
|
|
14370
|
+
this._holdTimeout = setTimeout(bind(function () {
|
|
14371
|
+
if (this._isTapValid()) {
|
|
14372
|
+
this._fireClick = false;
|
|
14373
|
+
this._onUp();
|
|
14374
|
+
this._simulateEvent('contextmenu', first);
|
|
14375
|
+
}
|
|
14376
|
+
}, this), 1000);
|
|
14377
|
+
|
|
14378
|
+
this._simulateEvent('mousedown', first);
|
|
14379
|
+
|
|
14380
|
+
on(document, {
|
|
14381
|
+
touchmove: this._onMove,
|
|
14382
|
+
touchend: this._onUp
|
|
14383
|
+
}, this);
|
|
14384
|
+
},
|
|
14385
|
+
|
|
14386
|
+
_onUp: function (e) {
|
|
14387
|
+
clearTimeout(this._holdTimeout);
|
|
14388
|
+
|
|
14389
|
+
off(document, {
|
|
14390
|
+
touchmove: this._onMove,
|
|
14391
|
+
touchend: this._onUp
|
|
14392
|
+
}, this);
|
|
14393
|
+
|
|
14394
|
+
if (this._fireClick && e && e.changedTouches) {
|
|
14395
|
+
|
|
14396
|
+
var first = e.changedTouches[0],
|
|
14397
|
+
el = first.target;
|
|
14398
|
+
|
|
14399
|
+
if (el && el.tagName && el.tagName.toLowerCase() === 'a') {
|
|
14400
|
+
removeClass(el, 'leaflet-active');
|
|
14401
|
+
}
|
|
14402
|
+
|
|
14403
|
+
this._simulateEvent('mouseup', first);
|
|
14404
|
+
|
|
14405
|
+
// simulate click if the touch didn't move too much
|
|
14406
|
+
if (this._isTapValid()) {
|
|
14407
|
+
this._simulateEvent('click', first);
|
|
14408
|
+
}
|
|
14409
|
+
}
|
|
14410
|
+
},
|
|
14411
|
+
|
|
14412
|
+
_isTapValid: function () {
|
|
14413
|
+
return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance;
|
|
14414
|
+
},
|
|
14415
|
+
|
|
14416
|
+
_onMove: function (e) {
|
|
14417
|
+
var first = e.touches[0];
|
|
14418
|
+
this._newPos = new Point(first.clientX, first.clientY);
|
|
14419
|
+
this._simulateEvent('mousemove', first);
|
|
14420
|
+
},
|
|
14421
|
+
|
|
14422
|
+
_simulateEvent: function (type, e) {
|
|
14423
|
+
var simulatedEvent = document.createEvent('MouseEvents');
|
|
14424
|
+
|
|
14425
|
+
simulatedEvent._simulated = true;
|
|
14426
|
+
e.target._simulatedClick = true;
|
|
14427
|
+
|
|
14428
|
+
simulatedEvent.initMouseEvent(
|
|
14429
|
+
type, true, true, window, 1,
|
|
14430
|
+
e.screenX, e.screenY,
|
|
14431
|
+
e.clientX, e.clientY,
|
|
14432
|
+
false, false, false, false, 0, null);
|
|
14433
|
+
|
|
14434
|
+
e.target.dispatchEvent(simulatedEvent);
|
|
14435
|
+
}
|
|
14436
|
+
});
|
|
14437
|
+
|
|
14438
|
+
// @section Handlers
|
|
14439
|
+
// @property tap: Handler
|
|
14440
|
+
// Mobile touch hacks (quick tap and touch hold) handler.
|
|
14441
|
+
if (touch && (!pointer || safari)) {
|
|
14442
|
+
Map.addInitHook('addHandler', 'tap', Tap);
|
|
14443
|
+
}
|
|
14444
|
+
|
|
14445
|
+
/*
|
|
14446
|
+
* L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.
|
|
14447
|
+
*/
|
|
14448
|
+
|
|
14449
|
+
// @namespace Map
|
|
14450
|
+
// @section Interaction Options
|
|
14451
|
+
Map.mergeOptions({
|
|
14452
|
+
// @section Touch interaction options
|
|
14453
|
+
// @option touchZoom: Boolean|String = *
|
|
14454
|
+
// Whether the map can be zoomed by touch-dragging with two fingers. If
|
|
14455
|
+
// passed `'center'`, it will zoom to the center of the view regardless of
|
|
14456
|
+
// where the touch events (fingers) were. Enabled for touch-capable web
|
|
14457
|
+
// browsers except for old Androids.
|
|
14458
|
+
touchZoom: touch && !android23,
|
|
14459
|
+
|
|
14460
|
+
// @option bounceAtZoomLimits: Boolean = true
|
|
14461
|
+
// Set it to false if you don't want the map to zoom beyond min/max zoom
|
|
14462
|
+
// and then bounce back when pinch-zooming.
|
|
14463
|
+
bounceAtZoomLimits: true
|
|
14464
|
+
});
|
|
14465
|
+
|
|
14466
|
+
var TouchZoom = Handler.extend({
|
|
14467
|
+
addHooks: function () {
|
|
14468
|
+
addClass(this._map._container, 'leaflet-touch-zoom');
|
|
14469
|
+
on(this._map._container, 'touchstart', this._onTouchStart, this);
|
|
14470
|
+
},
|
|
14471
|
+
|
|
14472
|
+
removeHooks: function () {
|
|
14473
|
+
removeClass(this._map._container, 'leaflet-touch-zoom');
|
|
14474
|
+
off(this._map._container, 'touchstart', this._onTouchStart, this);
|
|
14475
|
+
},
|
|
14476
|
+
|
|
14477
|
+
_onTouchStart: function (e) {
|
|
14478
|
+
var map = this._map;
|
|
14479
|
+
if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }
|
|
14480
|
+
|
|
14481
|
+
var p1 = map.mouseEventToContainerPoint(e.touches[0]),
|
|
14482
|
+
p2 = map.mouseEventToContainerPoint(e.touches[1]);
|
|
14483
|
+
|
|
14484
|
+
this._centerPoint = map.getSize()._divideBy(2);
|
|
14485
|
+
this._startLatLng = map.containerPointToLatLng(this._centerPoint);
|
|
14486
|
+
if (map.options.touchZoom !== 'center') {
|
|
14487
|
+
this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2));
|
|
14488
|
+
}
|
|
14489
|
+
|
|
14490
|
+
this._startDist = p1.distanceTo(p2);
|
|
14491
|
+
this._startZoom = map.getZoom();
|
|
14492
|
+
|
|
14493
|
+
this._moved = false;
|
|
14494
|
+
this._zooming = true;
|
|
14495
|
+
|
|
14496
|
+
map._stop();
|
|
14497
|
+
|
|
14498
|
+
on(document, 'touchmove', this._onTouchMove, this);
|
|
14499
|
+
on(document, 'touchend', this._onTouchEnd, this);
|
|
14500
|
+
|
|
14501
|
+
preventDefault(e);
|
|
14502
|
+
},
|
|
14503
|
+
|
|
14504
|
+
_onTouchMove: function (e) {
|
|
14505
|
+
if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; }
|
|
14506
|
+
|
|
14507
|
+
var map = this._map,
|
|
14508
|
+
p1 = map.mouseEventToContainerPoint(e.touches[0]),
|
|
14509
|
+
p2 = map.mouseEventToContainerPoint(e.touches[1]),
|
|
14510
|
+
scale = p1.distanceTo(p2) / this._startDist;
|
|
14511
|
+
|
|
14512
|
+
this._zoom = map.getScaleZoom(scale, this._startZoom);
|
|
14513
|
+
|
|
14514
|
+
if (!map.options.bounceAtZoomLimits && (
|
|
14515
|
+
(this._zoom < map.getMinZoom() && scale < 1) ||
|
|
14516
|
+
(this._zoom > map.getMaxZoom() && scale > 1))) {
|
|
14517
|
+
this._zoom = map._limitZoom(this._zoom);
|
|
14518
|
+
}
|
|
14519
|
+
|
|
14520
|
+
if (map.options.touchZoom === 'center') {
|
|
14521
|
+
this._center = this._startLatLng;
|
|
14522
|
+
if (scale === 1) { return; }
|
|
14523
|
+
} else {
|
|
14524
|
+
// Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng
|
|
14525
|
+
var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint);
|
|
14526
|
+
if (scale === 1 && delta.x === 0 && delta.y === 0) { return; }
|
|
14527
|
+
this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);
|
|
14528
|
+
}
|
|
14529
|
+
|
|
14530
|
+
if (!this._moved) {
|
|
14531
|
+
map._moveStart(true, false);
|
|
14532
|
+
this._moved = true;
|
|
14533
|
+
}
|
|
14534
|
+
|
|
14535
|
+
cancelAnimFrame(this._animRequest);
|
|
14536
|
+
|
|
14537
|
+
var moveFn = bind(map._move, map, this._center, this._zoom, {pinch: true, round: false});
|
|
14538
|
+
this._animRequest = requestAnimFrame(moveFn, this, true);
|
|
14539
|
+
|
|
14540
|
+
preventDefault(e);
|
|
14541
|
+
},
|
|
14542
|
+
|
|
14543
|
+
_onTouchEnd: function () {
|
|
14544
|
+
if (!this._moved || !this._zooming) {
|
|
14545
|
+
this._zooming = false;
|
|
14546
|
+
return;
|
|
14547
|
+
}
|
|
14548
|
+
|
|
14549
|
+
this._zooming = false;
|
|
14550
|
+
cancelAnimFrame(this._animRequest);
|
|
14551
|
+
|
|
14552
|
+
off(document, 'touchmove', this._onTouchMove, this);
|
|
14553
|
+
off(document, 'touchend', this._onTouchEnd, this);
|
|
14554
|
+
|
|
14555
|
+
// Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate.
|
|
14556
|
+
if (this._map.options.zoomAnimation) {
|
|
14557
|
+
this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap);
|
|
14558
|
+
} else {
|
|
14559
|
+
this._map._resetView(this._center, this._map._limitZoom(this._zoom));
|
|
14560
|
+
}
|
|
14561
|
+
}
|
|
14562
|
+
});
|
|
14563
|
+
|
|
14564
|
+
// @section Handlers
|
|
14565
|
+
// @property touchZoom: Handler
|
|
14566
|
+
// Touch zoom handler.
|
|
14567
|
+
Map.addInitHook('addHandler', 'touchZoom', TouchZoom);
|
|
14191
14568
|
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14569
|
+
Map.BoxZoom = BoxZoom;
|
|
14570
|
+
Map.DoubleClickZoom = DoubleClickZoom;
|
|
14571
|
+
Map.Drag = Drag;
|
|
14572
|
+
Map.Keyboard = Keyboard;
|
|
14573
|
+
Map.ScrollWheelZoom = ScrollWheelZoom;
|
|
14574
|
+
Map.Tap = Tap;
|
|
14575
|
+
Map.TouchZoom = TouchZoom;
|
|
14195
14576
|
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14577
|
+
exports.version = version;
|
|
14578
|
+
exports.Control = Control;
|
|
14579
|
+
exports.control = control;
|
|
14580
|
+
exports.Browser = Browser;
|
|
14581
|
+
exports.Evented = Evented;
|
|
14582
|
+
exports.Mixin = Mixin;
|
|
14583
|
+
exports.Util = Util;
|
|
14584
|
+
exports.Class = Class;
|
|
14585
|
+
exports.Handler = Handler;
|
|
14586
|
+
exports.extend = extend;
|
|
14587
|
+
exports.bind = bind;
|
|
14588
|
+
exports.stamp = stamp;
|
|
14589
|
+
exports.setOptions = setOptions;
|
|
14590
|
+
exports.DomEvent = DomEvent;
|
|
14591
|
+
exports.DomUtil = DomUtil;
|
|
14592
|
+
exports.PosAnimation = PosAnimation;
|
|
14593
|
+
exports.Draggable = Draggable;
|
|
14594
|
+
exports.LineUtil = LineUtil;
|
|
14595
|
+
exports.PolyUtil = PolyUtil;
|
|
14596
|
+
exports.Point = Point;
|
|
14597
|
+
exports.point = toPoint;
|
|
14598
|
+
exports.Bounds = Bounds;
|
|
14599
|
+
exports.bounds = toBounds;
|
|
14600
|
+
exports.Transformation = Transformation;
|
|
14601
|
+
exports.transformation = toTransformation;
|
|
14602
|
+
exports.Projection = index;
|
|
14603
|
+
exports.LatLng = LatLng;
|
|
14604
|
+
exports.latLng = toLatLng;
|
|
14605
|
+
exports.LatLngBounds = LatLngBounds;
|
|
14606
|
+
exports.latLngBounds = toLatLngBounds;
|
|
14607
|
+
exports.CRS = CRS;
|
|
14608
|
+
exports.GeoJSON = GeoJSON;
|
|
14609
|
+
exports.geoJSON = geoJSON;
|
|
14610
|
+
exports.geoJson = geoJson;
|
|
14611
|
+
exports.Layer = Layer;
|
|
14612
|
+
exports.LayerGroup = LayerGroup;
|
|
14613
|
+
exports.layerGroup = layerGroup;
|
|
14614
|
+
exports.FeatureGroup = FeatureGroup;
|
|
14615
|
+
exports.featureGroup = featureGroup;
|
|
14616
|
+
exports.ImageOverlay = ImageOverlay;
|
|
14617
|
+
exports.imageOverlay = imageOverlay;
|
|
14618
|
+
exports.VideoOverlay = VideoOverlay;
|
|
14619
|
+
exports.videoOverlay = videoOverlay;
|
|
14620
|
+
exports.SVGOverlay = SVGOverlay;
|
|
14621
|
+
exports.svgOverlay = svgOverlay;
|
|
14622
|
+
exports.DivOverlay = DivOverlay;
|
|
14623
|
+
exports.Popup = Popup;
|
|
14624
|
+
exports.popup = popup;
|
|
14625
|
+
exports.Tooltip = Tooltip;
|
|
14626
|
+
exports.tooltip = tooltip;
|
|
14627
|
+
exports.Icon = Icon;
|
|
14628
|
+
exports.icon = icon;
|
|
14629
|
+
exports.DivIcon = DivIcon;
|
|
14630
|
+
exports.divIcon = divIcon;
|
|
14631
|
+
exports.Marker = Marker;
|
|
14632
|
+
exports.marker = marker;
|
|
14633
|
+
exports.TileLayer = TileLayer;
|
|
14634
|
+
exports.tileLayer = tileLayer;
|
|
14635
|
+
exports.GridLayer = GridLayer;
|
|
14636
|
+
exports.gridLayer = gridLayer;
|
|
14637
|
+
exports.SVG = SVG;
|
|
14638
|
+
exports.svg = svg$1;
|
|
14639
|
+
exports.Renderer = Renderer;
|
|
14640
|
+
exports.Canvas = Canvas;
|
|
14641
|
+
exports.canvas = canvas$1;
|
|
14642
|
+
exports.Path = Path;
|
|
14643
|
+
exports.CircleMarker = CircleMarker;
|
|
14644
|
+
exports.circleMarker = circleMarker;
|
|
14645
|
+
exports.Circle = Circle;
|
|
14646
|
+
exports.circle = circle;
|
|
14647
|
+
exports.Polyline = Polyline;
|
|
14648
|
+
exports.polyline = polyline;
|
|
14649
|
+
exports.Polygon = Polygon;
|
|
14650
|
+
exports.polygon = polygon;
|
|
14651
|
+
exports.Rectangle = Rectangle;
|
|
14652
|
+
exports.rectangle = rectangle;
|
|
14653
|
+
exports.Map = Map;
|
|
14654
|
+
exports.map = createMap;
|
|
14204
14655
|
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
}
|
|
14656
|
+
var oldL = window.L;
|
|
14657
|
+
exports.noConflict = function() {
|
|
14658
|
+
window.L = oldL;
|
|
14659
|
+
return this;
|
|
14660
|
+
};
|
|
14210
14661
|
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
on(this._map._container, 'touchstart', this._onDown, this);
|
|
14214
|
-
},
|
|
14662
|
+
// Always export us to window global (see #2364)
|
|
14663
|
+
window.L = exports;
|
|
14215
14664
|
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14665
|
+
})));
|
|
14666
|
+
|
|
14667
|
+
} (leafletSrc$1, leafletSrc$1.exports));
|
|
14668
|
+
return leafletSrc$1.exports;
|
|
14669
|
+
}
|
|
14219
14670
|
|
|
14220
|
-
|
|
14221
|
-
if (!e.touches) { return; }
|
|
14671
|
+
var leafletSrcExports = /*@__PURE__*/ requireLeafletSrc();
|
|
14222
14672
|
|
|
14223
|
-
|
|
14673
|
+
var __defProp$f = Object.defineProperty;
|
|
14674
|
+
var __defProps$7 = Object.defineProperties;
|
|
14675
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
14676
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
14677
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
14678
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
14679
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14680
|
+
var __spreadValues$b = (a, b) => {
|
|
14681
|
+
for (var prop in b || (b = {}))
|
|
14682
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
14683
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
14684
|
+
if (__getOwnPropSymbols$b)
|
|
14685
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
14686
|
+
if (__propIsEnum$b.call(b, prop))
|
|
14687
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
14688
|
+
}
|
|
14689
|
+
return a;
|
|
14690
|
+
};
|
|
14691
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
14692
|
+
function createControl(control, options = {}, map) {
|
|
14693
|
+
const resolvedOptions = resolveControlOptions(options);
|
|
14694
|
+
const C = leafletSrcExports.Control.extend({
|
|
14695
|
+
onAdd(leafletMap) {
|
|
14696
|
+
const addClass = [
|
|
14697
|
+
"leaflet-control",
|
|
14698
|
+
resolvedOptions.bar ? "leaflet-bar" : "",
|
|
14699
|
+
resolvedOptions.addClass
|
|
14700
|
+
].filter(Boolean).join(" ");
|
|
14701
|
+
const element = createControlElement(
|
|
14702
|
+
control,
|
|
14703
|
+
__spreadProps$7(__spreadValues$b({}, resolvedOptions), { addClass }),
|
|
14704
|
+
map != null ? map : leafletMap
|
|
14705
|
+
);
|
|
14706
|
+
if (!resolvedOptions.margin) {
|
|
14707
|
+
element.style.margin = "0px";
|
|
14708
|
+
}
|
|
14709
|
+
return element;
|
|
14710
|
+
},
|
|
14711
|
+
onRemove(leafletMap) {
|
|
14712
|
+
control.onRemove(map != null ? map : leafletMap);
|
|
14713
|
+
}
|
|
14714
|
+
});
|
|
14715
|
+
const instance = new C();
|
|
14716
|
+
setControlOptions(instance, resolvedOptions);
|
|
14717
|
+
return instance;
|
|
14718
|
+
}
|
|
14224
14719
|
|
|
14225
|
-
|
|
14720
|
+
function createButtonControl(options, map) {
|
|
14721
|
+
return createControl(
|
|
14722
|
+
createButtonControlContent(options),
|
|
14723
|
+
{ bar: true, margin: options.margin },
|
|
14724
|
+
map
|
|
14725
|
+
);
|
|
14726
|
+
}
|
|
14226
14727
|
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14728
|
+
function createToggleControl(options, map) {
|
|
14729
|
+
const toggleContent = createToggleControlContent(options);
|
|
14730
|
+
const control = createControl(
|
|
14731
|
+
toggleContent,
|
|
14732
|
+
{ bar: true, margin: options.margin },
|
|
14733
|
+
map
|
|
14734
|
+
);
|
|
14735
|
+
control.onClick = toggleContent.onClick;
|
|
14736
|
+
control.changeStatus = toggleContent.changeStatus;
|
|
14737
|
+
control.getStatus = toggleContent.getStatus;
|
|
14738
|
+
control.switch = toggleContent.switch;
|
|
14739
|
+
Object.defineProperty(control, "disableOnSecondClick", {
|
|
14740
|
+
configurable: true,
|
|
14741
|
+
get: () => toggleContent.disableOnSecondClick,
|
|
14742
|
+
set: (value) => {
|
|
14743
|
+
toggleContent.disableOnSecondClick = value;
|
|
14744
|
+
}
|
|
14745
|
+
});
|
|
14746
|
+
control.onStatusChange = toggleContent.onStatusChange;
|
|
14747
|
+
return control;
|
|
14748
|
+
}
|
|
14233
14749
|
|
|
14234
|
-
|
|
14235
|
-
|
|
14750
|
+
var __defProp$e = Object.defineProperty;
|
|
14751
|
+
var __defProps$6 = Object.defineProperties;
|
|
14752
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
14753
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
14754
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
14755
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
14756
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14757
|
+
var __spreadValues$a = (a, b) => {
|
|
14758
|
+
for (var prop in b || (b = {}))
|
|
14759
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
14760
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
14761
|
+
if (__getOwnPropSymbols$a)
|
|
14762
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
14763
|
+
if (__propIsEnum$a.call(b, prop))
|
|
14764
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
14765
|
+
}
|
|
14766
|
+
return a;
|
|
14767
|
+
};
|
|
14768
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
14769
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14770
|
+
class LeafletControlContainer {
|
|
14771
|
+
constructor(map, options = {}) {
|
|
14772
|
+
__publicField$9(this, "map");
|
|
14773
|
+
__publicField$9(this, "controlContainer");
|
|
14774
|
+
__publicField$9(this, "targets", /* @__PURE__ */ new WeakMap());
|
|
14775
|
+
__publicField$9(this, "ids", /* @__PURE__ */ new WeakMap());
|
|
14776
|
+
this.map = map;
|
|
14777
|
+
this.controlContainer = this.createControlContainer(options);
|
|
14778
|
+
this.controlContainer.addTo(map.getContainer());
|
|
14779
|
+
}
|
|
14780
|
+
addControl(control, position, options = {}) {
|
|
14781
|
+
const targetPosition = typeof position === "string" ? position : "top-left";
|
|
14782
|
+
control.options.position = targetPosition.replace(
|
|
14783
|
+
"-",
|
|
14784
|
+
""
|
|
14785
|
+
);
|
|
14786
|
+
this.map.addControl(control);
|
|
14787
|
+
const container = control.getContainer();
|
|
14788
|
+
if (container) {
|
|
14789
|
+
this.controlContainer.append(container, position, options.order, control);
|
|
14790
|
+
this.targets.set(control, container);
|
|
14791
|
+
if (options.id) {
|
|
14792
|
+
this.controlContainer.registerIDContainer(
|
|
14793
|
+
options.id,
|
|
14794
|
+
container,
|
|
14795
|
+
control
|
|
14796
|
+
);
|
|
14797
|
+
this.ids.set(control, options.id);
|
|
14798
|
+
}
|
|
14799
|
+
}
|
|
14800
|
+
return control;
|
|
14801
|
+
}
|
|
14802
|
+
removeControl(control) {
|
|
14803
|
+
this.map.removeControl(control);
|
|
14804
|
+
const id = this.ids.get(control);
|
|
14805
|
+
if (id) {
|
|
14806
|
+
this.controlContainer.unregisterIDContainer(id);
|
|
14807
|
+
this.ids.delete(control);
|
|
14808
|
+
}
|
|
14809
|
+
const target = this.targets.get(control);
|
|
14810
|
+
if (target) {
|
|
14811
|
+
this.controlContainer.removeTarget(target);
|
|
14812
|
+
this.targets.delete(control);
|
|
14813
|
+
}
|
|
14814
|
+
}
|
|
14815
|
+
append(element, position, order = 0) {
|
|
14816
|
+
this.controlContainer.append(element, position, order);
|
|
14817
|
+
}
|
|
14818
|
+
registerIDContainer(id, controlRoot, control) {
|
|
14819
|
+
this.controlContainer.registerIDContainer(id, controlRoot, control);
|
|
14820
|
+
}
|
|
14821
|
+
unregisterIDContainer(id) {
|
|
14822
|
+
this.controlContainer.unregisterIDContainer(id);
|
|
14823
|
+
}
|
|
14824
|
+
detach() {
|
|
14825
|
+
this.controlContainer.detach();
|
|
14826
|
+
}
|
|
14827
|
+
getContainer() {
|
|
14828
|
+
return this.controlContainer.getContainer();
|
|
14829
|
+
}
|
|
14830
|
+
getControlContainer() {
|
|
14831
|
+
return this.controlContainer;
|
|
14832
|
+
}
|
|
14833
|
+
createControlContainer(options) {
|
|
14834
|
+
const mapAny = this.map;
|
|
14835
|
+
const controlCorners = mapAny._controlCorners || {};
|
|
14836
|
+
const getCorner = (key, selector) => controlCorners[key] || this.map.getContainer().querySelector(selector) || void 0;
|
|
14837
|
+
return new ControlContainer(__spreadProps$6(__spreadValues$a({}, options), {
|
|
14838
|
+
map: this.map,
|
|
14839
|
+
container: mapAny._controlContainer,
|
|
14840
|
+
positionContainers: {
|
|
14841
|
+
"top-left": getCorner("topleft", ".leaflet-top.leaflet-left"),
|
|
14842
|
+
"top-right": getCorner("topright", ".leaflet-top.leaflet-right"),
|
|
14843
|
+
"bottom-left": getCorner("bottomleft", ".leaflet-bottom.leaflet-left"),
|
|
14844
|
+
"bottom-right": getCorner(
|
|
14845
|
+
"bottomright",
|
|
14846
|
+
".leaflet-bottom.leaflet-right"
|
|
14847
|
+
)
|
|
14848
|
+
}
|
|
14849
|
+
}));
|
|
14850
|
+
}
|
|
14851
|
+
}
|
|
14236
14852
|
|
|
14237
|
-
|
|
14853
|
+
var domain;
|
|
14238
14854
|
|
|
14239
|
-
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14855
|
+
// This constructor is used to store event handlers. Instantiating this is
|
|
14856
|
+
// faster than explicitly calling `Object.create(null)` to get a "clean" empty
|
|
14857
|
+
// object (tested with v8 v4.9).
|
|
14858
|
+
function EventHandlers() {}
|
|
14859
|
+
EventHandlers.prototype = Object.create(null);
|
|
14243
14860
|
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
this._fireClick = false;
|
|
14248
|
-
this._onUp();
|
|
14249
|
-
this._simulateEvent('contextmenu', first);
|
|
14250
|
-
}
|
|
14251
|
-
}, this), 1000);
|
|
14861
|
+
function EventEmitter() {
|
|
14862
|
+
EventEmitter.init.call(this);
|
|
14863
|
+
}
|
|
14252
14864
|
|
|
14253
|
-
|
|
14865
|
+
// nodejs oddity
|
|
14866
|
+
// require('events') === require('events').EventEmitter
|
|
14867
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
14254
14868
|
|
|
14255
|
-
|
|
14256
|
-
touchmove: this._onMove,
|
|
14257
|
-
touchend: this._onUp
|
|
14258
|
-
}, this);
|
|
14259
|
-
},
|
|
14869
|
+
EventEmitter.usingDomains = false;
|
|
14260
14870
|
|
|
14261
|
-
|
|
14262
|
-
|
|
14871
|
+
EventEmitter.prototype.domain = undefined;
|
|
14872
|
+
EventEmitter.prototype._events = undefined;
|
|
14873
|
+
EventEmitter.prototype._maxListeners = undefined;
|
|
14263
14874
|
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
}, this);
|
|
14875
|
+
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
14876
|
+
// added to it. This is a useful default which helps finding memory leaks.
|
|
14877
|
+
EventEmitter.defaultMaxListeners = 10;
|
|
14268
14878
|
|
|
14269
|
-
|
|
14879
|
+
EventEmitter.init = function() {
|
|
14880
|
+
this.domain = null;
|
|
14881
|
+
if (EventEmitter.usingDomains) {
|
|
14882
|
+
// if there is an active domain, then attach to it.
|
|
14883
|
+
if (domain.active && !(this instanceof domain.Domain)) {
|
|
14884
|
+
this.domain = domain.active;
|
|
14885
|
+
}
|
|
14886
|
+
}
|
|
14270
14887
|
|
|
14271
|
-
|
|
14272
|
-
|
|
14888
|
+
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
|
14889
|
+
this._events = new EventHandlers();
|
|
14890
|
+
this._eventsCount = 0;
|
|
14891
|
+
}
|
|
14273
14892
|
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14893
|
+
this._maxListeners = this._maxListeners || undefined;
|
|
14894
|
+
};
|
|
14895
|
+
|
|
14896
|
+
// Obviously not all Emitters should be limited to 10. This function allows
|
|
14897
|
+
// that to be increased. Set to zero for unlimited.
|
|
14898
|
+
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
14899
|
+
if (typeof n !== 'number' || n < 0 || isNaN(n))
|
|
14900
|
+
throw new TypeError('"n" argument must be a positive number');
|
|
14901
|
+
this._maxListeners = n;
|
|
14902
|
+
return this;
|
|
14903
|
+
};
|
|
14277
14904
|
|
|
14278
|
-
|
|
14905
|
+
function $getMaxListeners(that) {
|
|
14906
|
+
if (that._maxListeners === undefined)
|
|
14907
|
+
return EventEmitter.defaultMaxListeners;
|
|
14908
|
+
return that._maxListeners;
|
|
14909
|
+
}
|
|
14279
14910
|
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
}
|
|
14284
|
-
}
|
|
14285
|
-
},
|
|
14911
|
+
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
14912
|
+
return $getMaxListeners(this);
|
|
14913
|
+
};
|
|
14286
14914
|
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14915
|
+
// These standalone emit* functions are used to optimize calling of event
|
|
14916
|
+
// handlers for fast cases because emit() itself often has a variable number of
|
|
14917
|
+
// arguments and can be deoptimized because of that. These functions always have
|
|
14918
|
+
// the same number of arguments and thus do not get deoptimized, so the code
|
|
14919
|
+
// inside them can execute faster.
|
|
14920
|
+
function emitNone(handler, isFn, self) {
|
|
14921
|
+
if (isFn)
|
|
14922
|
+
handler.call(self);
|
|
14923
|
+
else {
|
|
14924
|
+
var len = handler.length;
|
|
14925
|
+
var listeners = arrayClone(handler, len);
|
|
14926
|
+
for (var i = 0; i < len; ++i)
|
|
14927
|
+
listeners[i].call(self);
|
|
14928
|
+
}
|
|
14929
|
+
}
|
|
14930
|
+
function emitOne(handler, isFn, self, arg1) {
|
|
14931
|
+
if (isFn)
|
|
14932
|
+
handler.call(self, arg1);
|
|
14933
|
+
else {
|
|
14934
|
+
var len = handler.length;
|
|
14935
|
+
var listeners = arrayClone(handler, len);
|
|
14936
|
+
for (var i = 0; i < len; ++i)
|
|
14937
|
+
listeners[i].call(self, arg1);
|
|
14938
|
+
}
|
|
14939
|
+
}
|
|
14940
|
+
function emitTwo(handler, isFn, self, arg1, arg2) {
|
|
14941
|
+
if (isFn)
|
|
14942
|
+
handler.call(self, arg1, arg2);
|
|
14943
|
+
else {
|
|
14944
|
+
var len = handler.length;
|
|
14945
|
+
var listeners = arrayClone(handler, len);
|
|
14946
|
+
for (var i = 0; i < len; ++i)
|
|
14947
|
+
listeners[i].call(self, arg1, arg2);
|
|
14948
|
+
}
|
|
14949
|
+
}
|
|
14950
|
+
function emitThree(handler, isFn, self, arg1, arg2, arg3) {
|
|
14951
|
+
if (isFn)
|
|
14952
|
+
handler.call(self, arg1, arg2, arg3);
|
|
14953
|
+
else {
|
|
14954
|
+
var len = handler.length;
|
|
14955
|
+
var listeners = arrayClone(handler, len);
|
|
14956
|
+
for (var i = 0; i < len; ++i)
|
|
14957
|
+
listeners[i].call(self, arg1, arg2, arg3);
|
|
14958
|
+
}
|
|
14959
|
+
}
|
|
14290
14960
|
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14961
|
+
function emitMany(handler, isFn, self, args) {
|
|
14962
|
+
if (isFn)
|
|
14963
|
+
handler.apply(self, args);
|
|
14964
|
+
else {
|
|
14965
|
+
var len = handler.length;
|
|
14966
|
+
var listeners = arrayClone(handler, len);
|
|
14967
|
+
for (var i = 0; i < len; ++i)
|
|
14968
|
+
listeners[i].apply(self, args);
|
|
14969
|
+
}
|
|
14970
|
+
}
|
|
14296
14971
|
|
|
14297
|
-
|
|
14298
|
-
|
|
14972
|
+
EventEmitter.prototype.emit = function emit(type) {
|
|
14973
|
+
var er, handler, len, args, i, events, domain;
|
|
14974
|
+
var doError = (type === 'error');
|
|
14299
14975
|
|
|
14300
|
-
|
|
14301
|
-
|
|
14976
|
+
events = this._events;
|
|
14977
|
+
if (events)
|
|
14978
|
+
doError = (doError && events.error == null);
|
|
14979
|
+
else if (!doError)
|
|
14980
|
+
return false;
|
|
14302
14981
|
|
|
14303
|
-
|
|
14304
|
-
type, true, true, window, 1,
|
|
14305
|
-
e.screenX, e.screenY,
|
|
14306
|
-
e.clientX, e.clientY,
|
|
14307
|
-
false, false, false, false, 0, null);
|
|
14982
|
+
domain = this.domain;
|
|
14308
14983
|
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14984
|
+
// If there is no 'error' event listener then throw.
|
|
14985
|
+
if (doError) {
|
|
14986
|
+
er = arguments[1];
|
|
14987
|
+
if (domain) {
|
|
14988
|
+
if (!er)
|
|
14989
|
+
er = new Error('Uncaught, unspecified "error" event');
|
|
14990
|
+
er.domainEmitter = this;
|
|
14991
|
+
er.domain = domain;
|
|
14992
|
+
er.domainThrown = false;
|
|
14993
|
+
domain.emit('error', er);
|
|
14994
|
+
} else if (er instanceof Error) {
|
|
14995
|
+
throw er; // Unhandled 'error' event
|
|
14996
|
+
} else {
|
|
14997
|
+
// At least give some kind of context to the user
|
|
14998
|
+
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
|
14999
|
+
err.context = er;
|
|
15000
|
+
throw err;
|
|
15001
|
+
}
|
|
15002
|
+
return false;
|
|
15003
|
+
}
|
|
14312
15004
|
|
|
14313
|
-
|
|
14314
|
-
// @property tap: Handler
|
|
14315
|
-
// Mobile touch hacks (quick tap and touch hold) handler.
|
|
14316
|
-
if (touch && (!pointer || safari)) {
|
|
14317
|
-
Map.addInitHook('addHandler', 'tap', Tap);
|
|
14318
|
-
}
|
|
15005
|
+
handler = events[type];
|
|
14319
15006
|
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
*/
|
|
15007
|
+
if (!handler)
|
|
15008
|
+
return false;
|
|
14323
15009
|
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
15010
|
+
var isFn = typeof handler === 'function';
|
|
15011
|
+
len = arguments.length;
|
|
15012
|
+
switch (len) {
|
|
15013
|
+
// fast cases
|
|
15014
|
+
case 1:
|
|
15015
|
+
emitNone(handler, isFn, this);
|
|
15016
|
+
break;
|
|
15017
|
+
case 2:
|
|
15018
|
+
emitOne(handler, isFn, this, arguments[1]);
|
|
15019
|
+
break;
|
|
15020
|
+
case 3:
|
|
15021
|
+
emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
|
15022
|
+
break;
|
|
15023
|
+
case 4:
|
|
15024
|
+
emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
|
15025
|
+
break;
|
|
15026
|
+
// slower
|
|
15027
|
+
default:
|
|
15028
|
+
args = new Array(len - 1);
|
|
15029
|
+
for (i = 1; i < len; i++)
|
|
15030
|
+
args[i - 1] = arguments[i];
|
|
15031
|
+
emitMany(handler, isFn, this, args);
|
|
15032
|
+
}
|
|
14334
15033
|
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
// and then bounce back when pinch-zooming.
|
|
14338
|
-
bounceAtZoomLimits: true
|
|
14339
|
-
});
|
|
15034
|
+
return true;
|
|
15035
|
+
};
|
|
14340
15036
|
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
},
|
|
15037
|
+
function _addListener(target, type, listener, prepend) {
|
|
15038
|
+
var m;
|
|
15039
|
+
var events;
|
|
15040
|
+
var existing;
|
|
14346
15041
|
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
off(this._map._container, 'touchstart', this._onTouchStart, this);
|
|
14350
|
-
},
|
|
15042
|
+
if (typeof listener !== 'function')
|
|
15043
|
+
throw new TypeError('"listener" argument must be a function');
|
|
14351
15044
|
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
15045
|
+
events = target._events;
|
|
15046
|
+
if (!events) {
|
|
15047
|
+
events = target._events = new EventHandlers();
|
|
15048
|
+
target._eventsCount = 0;
|
|
15049
|
+
} else {
|
|
15050
|
+
// To avoid recursion in the case that type === "newListener"! Before
|
|
15051
|
+
// adding it to the listeners, first emit "newListener".
|
|
15052
|
+
if (events.newListener) {
|
|
15053
|
+
target.emit('newListener', type,
|
|
15054
|
+
listener.listener ? listener.listener : listener);
|
|
14355
15055
|
|
|
14356
|
-
|
|
14357
|
-
|
|
15056
|
+
// Re-assign `events` because a newListener handler could have caused the
|
|
15057
|
+
// this._events to be assigned to a new object
|
|
15058
|
+
events = target._events;
|
|
15059
|
+
}
|
|
15060
|
+
existing = events[type];
|
|
15061
|
+
}
|
|
14358
15062
|
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
15063
|
+
if (!existing) {
|
|
15064
|
+
// Optimize the case of one listener. Don't need the extra array object.
|
|
15065
|
+
existing = events[type] = listener;
|
|
15066
|
+
++target._eventsCount;
|
|
15067
|
+
} else {
|
|
15068
|
+
if (typeof existing === 'function') {
|
|
15069
|
+
// Adding the second element, need to change to array.
|
|
15070
|
+
existing = events[type] = prepend ? [listener, existing] :
|
|
15071
|
+
[existing, listener];
|
|
15072
|
+
} else {
|
|
15073
|
+
// If we've already got an array, just append.
|
|
15074
|
+
if (prepend) {
|
|
15075
|
+
existing.unshift(listener);
|
|
15076
|
+
} else {
|
|
15077
|
+
existing.push(listener);
|
|
15078
|
+
}
|
|
15079
|
+
}
|
|
14364
15080
|
|
|
14365
|
-
|
|
14366
|
-
|
|
15081
|
+
// Check for listener leak
|
|
15082
|
+
if (!existing.warned) {
|
|
15083
|
+
m = $getMaxListeners(target);
|
|
15084
|
+
if (m && m > 0 && existing.length > m) {
|
|
15085
|
+
existing.warned = true;
|
|
15086
|
+
var w = new Error('Possible EventEmitter memory leak detected. ' +
|
|
15087
|
+
existing.length + ' ' + type + ' listeners added. ' +
|
|
15088
|
+
'Use emitter.setMaxListeners() to increase limit');
|
|
15089
|
+
w.name = 'MaxListenersExceededWarning';
|
|
15090
|
+
w.emitter = target;
|
|
15091
|
+
w.type = type;
|
|
15092
|
+
w.count = existing.length;
|
|
15093
|
+
emitWarning(w);
|
|
15094
|
+
}
|
|
15095
|
+
}
|
|
15096
|
+
}
|
|
14367
15097
|
|
|
14368
|
-
|
|
14369
|
-
|
|
15098
|
+
return target;
|
|
15099
|
+
}
|
|
15100
|
+
function emitWarning(e) {
|
|
15101
|
+
typeof console.warn === 'function' ? console.warn(e) : console.log(e);
|
|
15102
|
+
}
|
|
15103
|
+
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
15104
|
+
return _addListener(this, type, listener, false);
|
|
15105
|
+
};
|
|
14370
15106
|
|
|
14371
|
-
|
|
15107
|
+
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
14372
15108
|
|
|
14373
|
-
|
|
14374
|
-
|
|
15109
|
+
EventEmitter.prototype.prependListener =
|
|
15110
|
+
function prependListener(type, listener) {
|
|
15111
|
+
return _addListener(this, type, listener, true);
|
|
15112
|
+
};
|
|
14375
15113
|
|
|
14376
|
-
|
|
14377
|
-
|
|
15114
|
+
function _onceWrap(target, type, listener) {
|
|
15115
|
+
var fired = false;
|
|
15116
|
+
function g() {
|
|
15117
|
+
target.removeListener(type, g);
|
|
15118
|
+
if (!fired) {
|
|
15119
|
+
fired = true;
|
|
15120
|
+
listener.apply(target, arguments);
|
|
15121
|
+
}
|
|
15122
|
+
}
|
|
15123
|
+
g.listener = listener;
|
|
15124
|
+
return g;
|
|
15125
|
+
}
|
|
14378
15126
|
|
|
14379
|
-
|
|
14380
|
-
|
|
15127
|
+
EventEmitter.prototype.once = function once(type, listener) {
|
|
15128
|
+
if (typeof listener !== 'function')
|
|
15129
|
+
throw new TypeError('"listener" argument must be a function');
|
|
15130
|
+
this.on(type, _onceWrap(this, type, listener));
|
|
15131
|
+
return this;
|
|
15132
|
+
};
|
|
14381
15133
|
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
|
|
14385
|
-
|
|
15134
|
+
EventEmitter.prototype.prependOnceListener =
|
|
15135
|
+
function prependOnceListener(type, listener) {
|
|
15136
|
+
if (typeof listener !== 'function')
|
|
15137
|
+
throw new TypeError('"listener" argument must be a function');
|
|
15138
|
+
this.prependListener(type, _onceWrap(this, type, listener));
|
|
15139
|
+
return this;
|
|
15140
|
+
};
|
|
14386
15141
|
|
|
14387
|
-
|
|
15142
|
+
// emits a 'removeListener' event iff the listener was removed
|
|
15143
|
+
EventEmitter.prototype.removeListener =
|
|
15144
|
+
function removeListener(type, listener) {
|
|
15145
|
+
var list, events, position, i, originalListener;
|
|
14388
15146
|
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
(this._zoom > map.getMaxZoom() && scale > 1))) {
|
|
14392
|
-
this._zoom = map._limitZoom(this._zoom);
|
|
14393
|
-
}
|
|
15147
|
+
if (typeof listener !== 'function')
|
|
15148
|
+
throw new TypeError('"listener" argument must be a function');
|
|
14394
15149
|
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
} else {
|
|
14399
|
-
// Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng
|
|
14400
|
-
var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint);
|
|
14401
|
-
if (scale === 1 && delta.x === 0 && delta.y === 0) { return; }
|
|
14402
|
-
this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);
|
|
14403
|
-
}
|
|
15150
|
+
events = this._events;
|
|
15151
|
+
if (!events)
|
|
15152
|
+
return this;
|
|
14404
15153
|
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
}
|
|
15154
|
+
list = events[type];
|
|
15155
|
+
if (!list)
|
|
15156
|
+
return this;
|
|
14409
15157
|
|
|
14410
|
-
|
|
15158
|
+
if (list === listener || (list.listener && list.listener === listener)) {
|
|
15159
|
+
if (--this._eventsCount === 0)
|
|
15160
|
+
this._events = new EventHandlers();
|
|
15161
|
+
else {
|
|
15162
|
+
delete events[type];
|
|
15163
|
+
if (events.removeListener)
|
|
15164
|
+
this.emit('removeListener', type, list.listener || listener);
|
|
15165
|
+
}
|
|
15166
|
+
} else if (typeof list !== 'function') {
|
|
15167
|
+
position = -1;
|
|
14411
15168
|
|
|
14412
|
-
|
|
14413
|
-
|
|
15169
|
+
for (i = list.length; i-- > 0;) {
|
|
15170
|
+
if (list[i] === listener ||
|
|
15171
|
+
(list[i].listener && list[i].listener === listener)) {
|
|
15172
|
+
originalListener = list[i].listener;
|
|
15173
|
+
position = i;
|
|
15174
|
+
break;
|
|
15175
|
+
}
|
|
15176
|
+
}
|
|
14414
15177
|
|
|
14415
|
-
|
|
14416
|
-
|
|
15178
|
+
if (position < 0)
|
|
15179
|
+
return this;
|
|
14417
15180
|
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
15181
|
+
if (list.length === 1) {
|
|
15182
|
+
list[0] = undefined;
|
|
15183
|
+
if (--this._eventsCount === 0) {
|
|
15184
|
+
this._events = new EventHandlers();
|
|
15185
|
+
return this;
|
|
15186
|
+
} else {
|
|
15187
|
+
delete events[type];
|
|
15188
|
+
}
|
|
15189
|
+
} else {
|
|
15190
|
+
spliceOne(list, position);
|
|
15191
|
+
}
|
|
14423
15192
|
|
|
14424
|
-
|
|
14425
|
-
|
|
15193
|
+
if (events.removeListener)
|
|
15194
|
+
this.emit('removeListener', type, originalListener || listener);
|
|
15195
|
+
}
|
|
14426
15196
|
|
|
14427
|
-
|
|
14428
|
-
|
|
15197
|
+
return this;
|
|
15198
|
+
};
|
|
15199
|
+
|
|
15200
|
+
// Alias for removeListener added in NodeJS 10.0
|
|
15201
|
+
// https://nodejs.org/api/events.html#events_emitter_off_eventname_listener
|
|
15202
|
+
EventEmitter.prototype.off = function(type, listener){
|
|
15203
|
+
return this.removeListener(type, listener);
|
|
15204
|
+
};
|
|
14429
15205
|
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
} else {
|
|
14434
|
-
this._map._resetView(this._center, this._map._limitZoom(this._zoom));
|
|
14435
|
-
}
|
|
14436
|
-
}
|
|
14437
|
-
});
|
|
15206
|
+
EventEmitter.prototype.removeAllListeners =
|
|
15207
|
+
function removeAllListeners(type) {
|
|
15208
|
+
var listeners, events;
|
|
14438
15209
|
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
Map.addInitHook('addHandler', 'touchZoom', TouchZoom);
|
|
15210
|
+
events = this._events;
|
|
15211
|
+
if (!events)
|
|
15212
|
+
return this;
|
|
14443
15213
|
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
15214
|
+
// not listening for removeListener, no need to emit
|
|
15215
|
+
if (!events.removeListener) {
|
|
15216
|
+
if (arguments.length === 0) {
|
|
15217
|
+
this._events = new EventHandlers();
|
|
15218
|
+
this._eventsCount = 0;
|
|
15219
|
+
} else if (events[type]) {
|
|
15220
|
+
if (--this._eventsCount === 0)
|
|
15221
|
+
this._events = new EventHandlers();
|
|
15222
|
+
else
|
|
15223
|
+
delete events[type];
|
|
15224
|
+
}
|
|
15225
|
+
return this;
|
|
15226
|
+
}
|
|
14451
15227
|
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
exports.DomEvent = DomEvent;
|
|
14466
|
-
exports.DomUtil = DomUtil;
|
|
14467
|
-
exports.PosAnimation = PosAnimation;
|
|
14468
|
-
exports.Draggable = Draggable;
|
|
14469
|
-
exports.LineUtil = LineUtil;
|
|
14470
|
-
exports.PolyUtil = PolyUtil;
|
|
14471
|
-
exports.Point = Point;
|
|
14472
|
-
exports.point = toPoint;
|
|
14473
|
-
exports.Bounds = Bounds;
|
|
14474
|
-
exports.bounds = toBounds;
|
|
14475
|
-
exports.Transformation = Transformation;
|
|
14476
|
-
exports.transformation = toTransformation;
|
|
14477
|
-
exports.Projection = index;
|
|
14478
|
-
exports.LatLng = LatLng;
|
|
14479
|
-
exports.latLng = toLatLng;
|
|
14480
|
-
exports.LatLngBounds = LatLngBounds;
|
|
14481
|
-
exports.latLngBounds = toLatLngBounds;
|
|
14482
|
-
exports.CRS = CRS;
|
|
14483
|
-
exports.GeoJSON = GeoJSON;
|
|
14484
|
-
exports.geoJSON = geoJSON;
|
|
14485
|
-
exports.geoJson = geoJson;
|
|
14486
|
-
exports.Layer = Layer;
|
|
14487
|
-
exports.LayerGroup = LayerGroup;
|
|
14488
|
-
exports.layerGroup = layerGroup;
|
|
14489
|
-
exports.FeatureGroup = FeatureGroup;
|
|
14490
|
-
exports.featureGroup = featureGroup;
|
|
14491
|
-
exports.ImageOverlay = ImageOverlay;
|
|
14492
|
-
exports.imageOverlay = imageOverlay;
|
|
14493
|
-
exports.VideoOverlay = VideoOverlay;
|
|
14494
|
-
exports.videoOverlay = videoOverlay;
|
|
14495
|
-
exports.SVGOverlay = SVGOverlay;
|
|
14496
|
-
exports.svgOverlay = svgOverlay;
|
|
14497
|
-
exports.DivOverlay = DivOverlay;
|
|
14498
|
-
exports.Popup = Popup;
|
|
14499
|
-
exports.popup = popup;
|
|
14500
|
-
exports.Tooltip = Tooltip;
|
|
14501
|
-
exports.tooltip = tooltip;
|
|
14502
|
-
exports.Icon = Icon;
|
|
14503
|
-
exports.icon = icon;
|
|
14504
|
-
exports.DivIcon = DivIcon;
|
|
14505
|
-
exports.divIcon = divIcon;
|
|
14506
|
-
exports.Marker = Marker;
|
|
14507
|
-
exports.marker = marker;
|
|
14508
|
-
exports.TileLayer = TileLayer;
|
|
14509
|
-
exports.tileLayer = tileLayer;
|
|
14510
|
-
exports.GridLayer = GridLayer;
|
|
14511
|
-
exports.gridLayer = gridLayer;
|
|
14512
|
-
exports.SVG = SVG;
|
|
14513
|
-
exports.svg = svg$1;
|
|
14514
|
-
exports.Renderer = Renderer;
|
|
14515
|
-
exports.Canvas = Canvas;
|
|
14516
|
-
exports.canvas = canvas$1;
|
|
14517
|
-
exports.Path = Path;
|
|
14518
|
-
exports.CircleMarker = CircleMarker;
|
|
14519
|
-
exports.circleMarker = circleMarker;
|
|
14520
|
-
exports.Circle = Circle;
|
|
14521
|
-
exports.circle = circle;
|
|
14522
|
-
exports.Polyline = Polyline;
|
|
14523
|
-
exports.polyline = polyline;
|
|
14524
|
-
exports.Polygon = Polygon;
|
|
14525
|
-
exports.polygon = polygon;
|
|
14526
|
-
exports.Rectangle = Rectangle;
|
|
14527
|
-
exports.rectangle = rectangle;
|
|
14528
|
-
exports.Map = Map;
|
|
14529
|
-
exports.map = createMap;
|
|
15228
|
+
// emit removeListener for all listeners on all events
|
|
15229
|
+
if (arguments.length === 0) {
|
|
15230
|
+
var keys = Object.keys(events);
|
|
15231
|
+
for (var i = 0, key; i < keys.length; ++i) {
|
|
15232
|
+
key = keys[i];
|
|
15233
|
+
if (key === 'removeListener') continue;
|
|
15234
|
+
this.removeAllListeners(key);
|
|
15235
|
+
}
|
|
15236
|
+
this.removeAllListeners('removeListener');
|
|
15237
|
+
this._events = new EventHandlers();
|
|
15238
|
+
this._eventsCount = 0;
|
|
15239
|
+
return this;
|
|
15240
|
+
}
|
|
14530
15241
|
|
|
14531
|
-
|
|
14532
|
-
exports.noConflict = function() {
|
|
14533
|
-
window.L = oldL;
|
|
14534
|
-
return this;
|
|
14535
|
-
};
|
|
15242
|
+
listeners = events[type];
|
|
14536
15243
|
|
|
14537
|
-
|
|
14538
|
-
|
|
15244
|
+
if (typeof listeners === 'function') {
|
|
15245
|
+
this.removeListener(type, listeners);
|
|
15246
|
+
} else if (listeners) {
|
|
15247
|
+
// LIFO order
|
|
15248
|
+
do {
|
|
15249
|
+
this.removeListener(type, listeners[listeners.length - 1]);
|
|
15250
|
+
} while (listeners[0]);
|
|
15251
|
+
}
|
|
14539
15252
|
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
15253
|
+
return this;
|
|
15254
|
+
};
|
|
15255
|
+
|
|
15256
|
+
EventEmitter.prototype.listeners = function listeners(type) {
|
|
15257
|
+
var evlistener;
|
|
15258
|
+
var ret;
|
|
15259
|
+
var events = this._events;
|
|
15260
|
+
|
|
15261
|
+
if (!events)
|
|
15262
|
+
ret = [];
|
|
15263
|
+
else {
|
|
15264
|
+
evlistener = events[type];
|
|
15265
|
+
if (!evlistener)
|
|
15266
|
+
ret = [];
|
|
15267
|
+
else if (typeof evlistener === 'function')
|
|
15268
|
+
ret = [evlistener.listener || evlistener];
|
|
15269
|
+
else
|
|
15270
|
+
ret = unwrapListeners(evlistener);
|
|
15271
|
+
}
|
|
15272
|
+
|
|
15273
|
+
return ret;
|
|
15274
|
+
};
|
|
15275
|
+
|
|
15276
|
+
EventEmitter.listenerCount = function(emitter, type) {
|
|
15277
|
+
if (typeof emitter.listenerCount === 'function') {
|
|
15278
|
+
return emitter.listenerCount(type);
|
|
15279
|
+
} else {
|
|
15280
|
+
return listenerCount.call(emitter, type);
|
|
15281
|
+
}
|
|
15282
|
+
};
|
|
15283
|
+
|
|
15284
|
+
EventEmitter.prototype.listenerCount = listenerCount;
|
|
15285
|
+
function listenerCount(type) {
|
|
15286
|
+
var events = this._events;
|
|
15287
|
+
|
|
15288
|
+
if (events) {
|
|
15289
|
+
var evlistener = events[type];
|
|
15290
|
+
|
|
15291
|
+
if (typeof evlistener === 'function') {
|
|
15292
|
+
return 1;
|
|
15293
|
+
} else if (evlistener) {
|
|
15294
|
+
return evlistener.length;
|
|
15295
|
+
}
|
|
15296
|
+
}
|
|
15297
|
+
|
|
15298
|
+
return 0;
|
|
14544
15299
|
}
|
|
14545
15300
|
|
|
14546
|
-
|
|
15301
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
15302
|
+
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
15303
|
+
};
|
|
15304
|
+
|
|
15305
|
+
// About 1.5x faster than the two-arg version of Array#splice().
|
|
15306
|
+
function spliceOne(list, index) {
|
|
15307
|
+
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
|
|
15308
|
+
list[i] = list[k];
|
|
15309
|
+
list.pop();
|
|
15310
|
+
}
|
|
15311
|
+
|
|
15312
|
+
function arrayClone(arr, i) {
|
|
15313
|
+
var copy = new Array(i);
|
|
15314
|
+
while (i--)
|
|
15315
|
+
copy[i] = arr[i];
|
|
15316
|
+
return copy;
|
|
15317
|
+
}
|
|
15318
|
+
|
|
15319
|
+
function unwrapListeners(arr) {
|
|
15320
|
+
var ret = new Array(arr.length);
|
|
15321
|
+
for (var i = 0; i < ret.length; ++i) {
|
|
15322
|
+
ret[i] = arr[i].listener || arr[i];
|
|
15323
|
+
}
|
|
15324
|
+
return ret;
|
|
15325
|
+
}
|
|
14547
15326
|
|
|
14548
15327
|
class AttributionControl extends leafletSrcExports.Control.Attribution {
|
|
14549
15328
|
// options: AttributionControlOptions
|
|
@@ -14562,81 +15341,6 @@ class AttributionControl extends leafletSrcExports.Control.Attribution {
|
|
|
14562
15341
|
}
|
|
14563
15342
|
}
|
|
14564
15343
|
|
|
14565
|
-
function createControl(control, options = {}, map) {
|
|
14566
|
-
const C = leafletSrcExports.Control.extend({
|
|
14567
|
-
onAdd() {
|
|
14568
|
-
const element = document.createElement("div");
|
|
14569
|
-
const content = control.onAdd(map);
|
|
14570
|
-
element.classList.add("leaflet-control");
|
|
14571
|
-
if (options.bar) {
|
|
14572
|
-
element.classList.add("leaflet-bar");
|
|
14573
|
-
}
|
|
14574
|
-
if (options.addClass) {
|
|
14575
|
-
element.classList.add(options.addClass);
|
|
14576
|
-
}
|
|
14577
|
-
if (!options.margin && !options.bar) {
|
|
14578
|
-
element.style.marginBottom = "0px";
|
|
14579
|
-
element.style.marginTop = "0px";
|
|
14580
|
-
element.style.marginLeft = "0px";
|
|
14581
|
-
element.style.marginRight = "0px";
|
|
14582
|
-
}
|
|
14583
|
-
if (content) {
|
|
14584
|
-
element.appendChild(content);
|
|
14585
|
-
}
|
|
14586
|
-
leafletSrcExports.DomEvent.disableClickPropagation(element);
|
|
14587
|
-
return element;
|
|
14588
|
-
},
|
|
14589
|
-
onRemove() {
|
|
14590
|
-
control.onRemove();
|
|
14591
|
-
}
|
|
14592
|
-
});
|
|
14593
|
-
return new C();
|
|
14594
|
-
}
|
|
14595
|
-
|
|
14596
|
-
function createButtonControl(options, map) {
|
|
14597
|
-
const link = document.createElement("a");
|
|
14598
|
-
const title = options.title || "";
|
|
14599
|
-
link.href = "#";
|
|
14600
|
-
link.title = title;
|
|
14601
|
-
link.setAttribute("role", "button");
|
|
14602
|
-
link.setAttribute("aria-label", title);
|
|
14603
|
-
if (options.addClass) {
|
|
14604
|
-
link.classList.add(options.addClass);
|
|
14605
|
-
}
|
|
14606
|
-
leafletSrcExports.DomEvent.disableClickPropagation(link);
|
|
14607
|
-
leafletSrcExports.DomEvent.on(link, "click", leafletSrcExports.DomEvent.stop);
|
|
14608
|
-
if (options.html instanceof HTMLElement) {
|
|
14609
|
-
link.appendChild(options.html);
|
|
14610
|
-
} else if (typeof options.html === "string") {
|
|
14611
|
-
link.innerHTML = options.html;
|
|
14612
|
-
}
|
|
14613
|
-
const onClick = (e) => {
|
|
14614
|
-
e.stopPropagation();
|
|
14615
|
-
options.onClick();
|
|
14616
|
-
};
|
|
14617
|
-
return createControl(
|
|
14618
|
-
{
|
|
14619
|
-
onAdd() {
|
|
14620
|
-
if (options.onClick !== void 0) {
|
|
14621
|
-
link.addEventListener("click", onClick);
|
|
14622
|
-
}
|
|
14623
|
-
return link;
|
|
14624
|
-
},
|
|
14625
|
-
onRemove() {
|
|
14626
|
-
const parent = link.parentNode;
|
|
14627
|
-
if (parent) {
|
|
14628
|
-
parent.removeChild(link);
|
|
14629
|
-
}
|
|
14630
|
-
if (options.onClick !== void 0) {
|
|
14631
|
-
link.removeEventListener("click", onClick);
|
|
14632
|
-
}
|
|
14633
|
-
}
|
|
14634
|
-
},
|
|
14635
|
-
{ bar: true },
|
|
14636
|
-
map
|
|
14637
|
-
);
|
|
14638
|
-
}
|
|
14639
|
-
|
|
14640
15344
|
function debounce(cb, wait = 10) {
|
|
14641
15345
|
let timeoutId;
|
|
14642
15346
|
function wrapper(...args) {
|
|
@@ -14781,9 +15485,9 @@ function createFeaturePositionOptions(features) {
|
|
|
14781
15485
|
};
|
|
14782
15486
|
}
|
|
14783
15487
|
|
|
14784
|
-
var __defProp$
|
|
14785
|
-
var __defNormalProp$
|
|
14786
|
-
var __publicField$8 = (obj, key, value) => __defNormalProp$
|
|
15488
|
+
var __defProp$d = Object.defineProperty;
|
|
15489
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15490
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14787
15491
|
class BaseAdapter {
|
|
14788
15492
|
constructor(map, options) {
|
|
14789
15493
|
this.map = map;
|
|
@@ -14818,19 +15522,19 @@ function convertMapClickEvent(evt) {
|
|
|
14818
15522
|
};
|
|
14819
15523
|
}
|
|
14820
15524
|
|
|
14821
|
-
var __defProp$
|
|
14822
|
-
var __getOwnPropSymbols$
|
|
14823
|
-
var __hasOwnProp$
|
|
14824
|
-
var __propIsEnum$
|
|
14825
|
-
var __defNormalProp$
|
|
14826
|
-
var __spreadValues$
|
|
15525
|
+
var __defProp$c = Object.defineProperty;
|
|
15526
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
15527
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
15528
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
15529
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15530
|
+
var __spreadValues$9 = (a, b) => {
|
|
14827
15531
|
for (var prop in b || (b = {}))
|
|
14828
|
-
if (__hasOwnProp$
|
|
14829
|
-
__defNormalProp$
|
|
14830
|
-
if (__getOwnPropSymbols$
|
|
14831
|
-
for (var prop of __getOwnPropSymbols$
|
|
14832
|
-
if (__propIsEnum$
|
|
14833
|
-
__defNormalProp$
|
|
15532
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
15533
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
15534
|
+
if (__getOwnPropSymbols$9)
|
|
15535
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
15536
|
+
if (__propIsEnum$9.call(b, prop))
|
|
15537
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
14834
15538
|
}
|
|
14835
15539
|
return a;
|
|
14836
15540
|
};
|
|
@@ -14840,7 +15544,7 @@ function createMouseEvent({
|
|
|
14840
15544
|
}) {
|
|
14841
15545
|
const layer_ = source.target;
|
|
14842
15546
|
const feature = layer_.feature;
|
|
14843
|
-
const opt = __spreadValues$
|
|
15547
|
+
const opt = __spreadValues$9({
|
|
14844
15548
|
layer,
|
|
14845
15549
|
feature,
|
|
14846
15550
|
event: convertMapClickEvent(source),
|
|
@@ -14849,23 +15553,23 @@ function createMouseEvent({
|
|
|
14849
15553
|
return opt;
|
|
14850
15554
|
}
|
|
14851
15555
|
|
|
14852
|
-
var __defProp$
|
|
14853
|
-
var __getOwnPropSymbols$
|
|
14854
|
-
var __hasOwnProp$
|
|
14855
|
-
var __propIsEnum$
|
|
14856
|
-
var __defNormalProp$
|
|
14857
|
-
var __spreadValues$
|
|
15556
|
+
var __defProp$b = Object.defineProperty;
|
|
15557
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
15558
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
15559
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
15560
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15561
|
+
var __spreadValues$8 = (a, b) => {
|
|
14858
15562
|
for (var prop in b || (b = {}))
|
|
14859
|
-
if (__hasOwnProp$
|
|
14860
|
-
__defNormalProp$
|
|
14861
|
-
if (__getOwnPropSymbols$
|
|
14862
|
-
for (var prop of __getOwnPropSymbols$
|
|
14863
|
-
if (__propIsEnum$
|
|
14864
|
-
__defNormalProp$
|
|
15563
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
15564
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
15565
|
+
if (__getOwnPropSymbols$8)
|
|
15566
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
15567
|
+
if (__propIsEnum$8.call(b, prop))
|
|
15568
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
14865
15569
|
}
|
|
14866
15570
|
return a;
|
|
14867
15571
|
};
|
|
14868
|
-
var __publicField$7 = (obj, key, value) => __defNormalProp$
|
|
15572
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14869
15573
|
class GeoJsonEvents {
|
|
14870
15574
|
constructor(layer) {
|
|
14871
15575
|
__publicField$7(this, "layer");
|
|
@@ -14881,7 +15585,7 @@ class GeoJsonEvents {
|
|
|
14881
15585
|
if (onClick_) {
|
|
14882
15586
|
this._onclick = (e) => {
|
|
14883
15587
|
const selected = !!this.layer._getSelected(layer);
|
|
14884
|
-
onClick_(__spreadValues$
|
|
15588
|
+
onClick_(__spreadValues$8({
|
|
14885
15589
|
selected
|
|
14886
15590
|
}, this._createMouseEvent(e)));
|
|
14887
15591
|
};
|
|
@@ -14891,7 +15595,7 @@ class GeoJsonEvents {
|
|
|
14891
15595
|
this._ondblclick = (e) => {
|
|
14892
15596
|
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
14893
15597
|
const selected = !!this.layer._getSelected(layer);
|
|
14894
|
-
onDoubleClick(__spreadValues$
|
|
15598
|
+
onDoubleClick(__spreadValues$8({
|
|
14895
15599
|
selected
|
|
14896
15600
|
}, this._createMouseEvent(e)));
|
|
14897
15601
|
};
|
|
@@ -14942,21 +15646,21 @@ function isPaintCallback(paint) {
|
|
|
14942
15646
|
return false;
|
|
14943
15647
|
}
|
|
14944
15648
|
|
|
14945
|
-
var __defProp$
|
|
15649
|
+
var __defProp$a = Object.defineProperty;
|
|
14946
15650
|
var __defProps$5 = Object.defineProperties;
|
|
14947
15651
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
14948
|
-
var __getOwnPropSymbols$
|
|
14949
|
-
var __hasOwnProp$
|
|
14950
|
-
var __propIsEnum$
|
|
14951
|
-
var __defNormalProp$
|
|
14952
|
-
var __spreadValues$
|
|
15652
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
15653
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
15654
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
15655
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15656
|
+
var __spreadValues$7 = (a, b) => {
|
|
14953
15657
|
for (var prop in b || (b = {}))
|
|
14954
|
-
if (__hasOwnProp$
|
|
14955
|
-
__defNormalProp$
|
|
14956
|
-
if (__getOwnPropSymbols$
|
|
14957
|
-
for (var prop of __getOwnPropSymbols$
|
|
14958
|
-
if (__propIsEnum$
|
|
14959
|
-
__defNormalProp$
|
|
15658
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
15659
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
15660
|
+
if (__getOwnPropSymbols$7)
|
|
15661
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
15662
|
+
if (__propIsEnum$7.call(b, prop))
|
|
15663
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
14960
15664
|
}
|
|
14961
15665
|
return a;
|
|
14962
15666
|
};
|
|
@@ -14964,16 +15668,16 @@ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
|
14964
15668
|
var __objRest$2 = (source, exclude) => {
|
|
14965
15669
|
var target = {};
|
|
14966
15670
|
for (var prop in source)
|
|
14967
|
-
if (__hasOwnProp$
|
|
15671
|
+
if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
14968
15672
|
target[prop] = source[prop];
|
|
14969
|
-
if (source != null && __getOwnPropSymbols$
|
|
14970
|
-
for (var prop of __getOwnPropSymbols$
|
|
14971
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
15673
|
+
if (source != null && __getOwnPropSymbols$7)
|
|
15674
|
+
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
15675
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
14972
15676
|
target[prop] = source[prop];
|
|
14973
15677
|
}
|
|
14974
15678
|
return target;
|
|
14975
15679
|
};
|
|
14976
|
-
var __publicField$6 = (obj, key, value) => __defNormalProp$
|
|
15680
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
|
|
14977
15681
|
class GeoJsonPaint {
|
|
14978
15682
|
constructor(layer) {
|
|
14979
15683
|
__publicField$6(this, "layer");
|
|
@@ -15055,7 +15759,7 @@ class GeoJsonPaint {
|
|
|
15055
15759
|
if (html) {
|
|
15056
15760
|
element.innerHTML = html;
|
|
15057
15761
|
}
|
|
15058
|
-
const divIcon = new leafletSrcExports.DivIcon(__spreadProps$5(__spreadValues$
|
|
15762
|
+
const divIcon = new leafletSrcExports.DivIcon(__spreadProps$5(__spreadValues$7({
|
|
15059
15763
|
className: ""
|
|
15060
15764
|
}, toLIconOpt), {
|
|
15061
15765
|
html: element
|
|
@@ -15081,7 +15785,7 @@ class GeoJsonPaint {
|
|
|
15081
15785
|
}
|
|
15082
15786
|
return (_, latlng) => {
|
|
15083
15787
|
const p = PAINT;
|
|
15084
|
-
return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$
|
|
15788
|
+
return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$7(__spreadValues$7({}, p), icon)));
|
|
15085
15789
|
};
|
|
15086
15790
|
}
|
|
15087
15791
|
createPaintOptions(paint) {
|
|
@@ -15103,26 +15807,26 @@ class GeoJsonPaint {
|
|
|
15103
15807
|
}
|
|
15104
15808
|
}
|
|
15105
15809
|
|
|
15106
|
-
var __defProp$
|
|
15810
|
+
var __defProp$9 = Object.defineProperty;
|
|
15107
15811
|
var __defProps$4 = Object.defineProperties;
|
|
15108
15812
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
15109
|
-
var __getOwnPropSymbols$
|
|
15110
|
-
var __hasOwnProp$
|
|
15111
|
-
var __propIsEnum$
|
|
15112
|
-
var __defNormalProp$
|
|
15113
|
-
var __spreadValues$
|
|
15813
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
15814
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
15815
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
15816
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15817
|
+
var __spreadValues$6 = (a, b) => {
|
|
15114
15818
|
for (var prop in b || (b = {}))
|
|
15115
|
-
if (__hasOwnProp$
|
|
15116
|
-
__defNormalProp$
|
|
15117
|
-
if (__getOwnPropSymbols$
|
|
15118
|
-
for (var prop of __getOwnPropSymbols$
|
|
15119
|
-
if (__propIsEnum$
|
|
15120
|
-
__defNormalProp$
|
|
15819
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
15820
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
15821
|
+
if (__getOwnPropSymbols$6)
|
|
15822
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
15823
|
+
if (__propIsEnum$6.call(b, prop))
|
|
15824
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
15121
15825
|
}
|
|
15122
15826
|
return a;
|
|
15123
15827
|
};
|
|
15124
15828
|
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
15125
|
-
var __publicField$5 = (obj, key, value) => __defNormalProp$
|
|
15829
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15126
15830
|
var __async = (__this, __arguments, generator) => {
|
|
15127
15831
|
return new Promise((resolve, reject) => {
|
|
15128
15832
|
var fulfilled = (value) => {
|
|
@@ -15170,7 +15874,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15170
15874
|
addLayer(options) {
|
|
15171
15875
|
Object.assign(this.options, options);
|
|
15172
15876
|
this.paint = options.paint;
|
|
15173
|
-
this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$4(__spreadValues$
|
|
15877
|
+
this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$4(__spreadValues$6({}, options.nativeOptions), {
|
|
15174
15878
|
pane: this.pane
|
|
15175
15879
|
}));
|
|
15176
15880
|
this.selectedPaint = options.selectedPaint;
|
|
@@ -15219,7 +15923,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15219
15923
|
}
|
|
15220
15924
|
getSelected() {
|
|
15221
15925
|
return this._selectedLayers.map((x) => {
|
|
15222
|
-
return __spreadValues$
|
|
15926
|
+
return __spreadValues$6({
|
|
15223
15927
|
target: this,
|
|
15224
15928
|
feature: x.feature,
|
|
15225
15929
|
layer: x
|
|
@@ -15238,14 +15942,14 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15238
15942
|
const filteredLayers = [];
|
|
15239
15943
|
this._layers.forEach(({ feature, layer }) => {
|
|
15240
15944
|
if (layer) {
|
|
15241
|
-
const ok = fun ? fun(__spreadValues$
|
|
15945
|
+
const ok = fun ? fun(__spreadValues$6({
|
|
15242
15946
|
target: this,
|
|
15243
15947
|
feature,
|
|
15244
15948
|
layer
|
|
15245
15949
|
}, createFeaturePositionOptions(feature))) : true;
|
|
15246
15950
|
if (ok) {
|
|
15247
15951
|
layer_.addLayer(layer);
|
|
15248
|
-
filteredLayers.push(__spreadValues$
|
|
15952
|
+
filteredLayers.push(__spreadValues$6({
|
|
15249
15953
|
target: this,
|
|
15250
15954
|
feature,
|
|
15251
15955
|
layer
|
|
@@ -15266,7 +15970,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15266
15970
|
getLayers() {
|
|
15267
15971
|
return this._layers.map(({ layer, feature }) => {
|
|
15268
15972
|
const visible = layer && !!layer._map;
|
|
15269
|
-
return __spreadValues$
|
|
15973
|
+
return __spreadValues$6({
|
|
15270
15974
|
feature,
|
|
15271
15975
|
layer,
|
|
15272
15976
|
visible,
|
|
@@ -15384,13 +16088,13 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15384
16088
|
}
|
|
15385
16089
|
}
|
|
15386
16090
|
updatePaint(paint) {
|
|
15387
|
-
this.paint = __spreadValues$
|
|
16091
|
+
this.paint = __spreadValues$6(__spreadValues$6({}, this.paint), paint);
|
|
15388
16092
|
for (const l of this._layers) {
|
|
15389
16093
|
this._paint.setPaint(l, this.paint);
|
|
15390
16094
|
}
|
|
15391
16095
|
}
|
|
15392
16096
|
updateSelectedPaint(paint) {
|
|
15393
|
-
this.selectedPaint = __spreadValues$
|
|
16097
|
+
this.selectedPaint = __spreadValues$6(__spreadValues$6({}, this.selectedPaint), paint);
|
|
15394
16098
|
for (const l of this._selectedLayers) {
|
|
15395
16099
|
this._paint.setPaint(l, this.selectedPaint);
|
|
15396
16100
|
}
|
|
@@ -15407,7 +16111,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15407
16111
|
if (feature.properties && labelField) {
|
|
15408
16112
|
message = feature.properties[labelField];
|
|
15409
16113
|
} else if (label) {
|
|
15410
|
-
message = label(__spreadValues$
|
|
16114
|
+
message = label(__spreadValues$6(__spreadValues$6({
|
|
15411
16115
|
target: this
|
|
15412
16116
|
}, layerDef), createFeaturePositionOptions(feature)));
|
|
15413
16117
|
}
|
|
@@ -15426,7 +16130,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15426
16130
|
autoPan,
|
|
15427
16131
|
maxWidth,
|
|
15428
16132
|
closeButton: closeButton_
|
|
15429
|
-
} = __spreadValues$
|
|
16133
|
+
} = __spreadValues$6({
|
|
15430
16134
|
minWidth: 300
|
|
15431
16135
|
}, options);
|
|
15432
16136
|
const closeButton = closeButton_ != null ? closeButton_ : !this.options.selectOnHover;
|
|
@@ -15442,7 +16146,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15442
16146
|
};
|
|
15443
16147
|
let content;
|
|
15444
16148
|
if (options.createPopupContent) {
|
|
15445
|
-
content = yield options.createPopupContent(__spreadValues$
|
|
16149
|
+
content = yield options.createPopupContent(__spreadValues$6({
|
|
15446
16150
|
layer,
|
|
15447
16151
|
feature,
|
|
15448
16152
|
target: this,
|
|
@@ -15520,9 +16224,9 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15520
16224
|
lopt = {
|
|
15521
16225
|
style: (feature) => {
|
|
15522
16226
|
if (feature) {
|
|
15523
|
-
return this._paint.preparePaint(__spreadValues$
|
|
16227
|
+
return this._paint.preparePaint(__spreadValues$6(__spreadValues$6({}, PAINT), paint(feature)));
|
|
15524
16228
|
} else {
|
|
15525
|
-
return this._paint.preparePaint(__spreadProps$4(__spreadValues$
|
|
16229
|
+
return this._paint.preparePaint(__spreadProps$4(__spreadValues$6({}, PAINT), { type: "path" }));
|
|
15526
16230
|
}
|
|
15527
16231
|
}
|
|
15528
16232
|
};
|
|
@@ -15538,7 +16242,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15538
16242
|
_onEachFeature(feature, layer) {
|
|
15539
16243
|
const layer_ = this.layer;
|
|
15540
16244
|
if (layer_) {
|
|
15541
|
-
const def = __spreadValues$
|
|
16245
|
+
const def = __spreadValues$6({
|
|
15542
16246
|
target: this,
|
|
15543
16247
|
feature,
|
|
15544
16248
|
layer
|
|
@@ -15573,7 +16277,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15573
16277
|
setTimeout(() => {
|
|
15574
16278
|
if (popup) {
|
|
15575
16279
|
this._openPopup(
|
|
15576
|
-
__spreadValues$
|
|
16280
|
+
__spreadValues$6({
|
|
15577
16281
|
target: this,
|
|
15578
16282
|
layer,
|
|
15579
16283
|
feature
|
|
@@ -15591,7 +16295,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15591
16295
|
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
15592
16296
|
const layer = e.target;
|
|
15593
16297
|
const feature = layer.feature;
|
|
15594
|
-
const def = __spreadValues$
|
|
16298
|
+
const def = __spreadValues$6({
|
|
15595
16299
|
target: this,
|
|
15596
16300
|
layer,
|
|
15597
16301
|
feature
|
|
@@ -15624,7 +16328,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15624
16328
|
}
|
|
15625
16329
|
if (this.options.onSelect) {
|
|
15626
16330
|
const features = def.feature ? [def.feature] : [];
|
|
15627
|
-
this.options.onSelect(__spreadValues$
|
|
16331
|
+
this.options.onSelect(__spreadValues$6({
|
|
15628
16332
|
type,
|
|
15629
16333
|
layer: this,
|
|
15630
16334
|
features
|
|
@@ -15682,37 +16386,89 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15682
16386
|
}
|
|
15683
16387
|
}
|
|
15684
16388
|
|
|
16389
|
+
var __defProp$8 = Object.defineProperty;
|
|
16390
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
16391
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
16392
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
16393
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16394
|
+
var __spreadValues$5 = (a, b) => {
|
|
16395
|
+
for (var prop in b || (b = {}))
|
|
16396
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
16397
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
16398
|
+
if (__getOwnPropSymbols$5)
|
|
16399
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
16400
|
+
if (__propIsEnum$5.call(b, prop))
|
|
16401
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
16402
|
+
}
|
|
16403
|
+
return a;
|
|
16404
|
+
};
|
|
16405
|
+
function hasHeaders(headers) {
|
|
16406
|
+
return !!headers && Object.keys(headers).length > 0;
|
|
16407
|
+
}
|
|
16408
|
+
function normalizeLayerRequestOptions(request) {
|
|
16409
|
+
if (!request) {
|
|
16410
|
+
return void 0;
|
|
16411
|
+
}
|
|
16412
|
+
const normalized = __spreadValues$5({}, request);
|
|
16413
|
+
return hasLayerRequestOptions(normalized) ? normalized : void 0;
|
|
16414
|
+
}
|
|
16415
|
+
function getLayerRequestOptions(options) {
|
|
16416
|
+
const request = options == null ? void 0 : options.request;
|
|
16417
|
+
const headers = __spreadValues$5(__spreadValues$5({}, (options == null ? void 0 : options.headers) || {}), (request == null ? void 0 : request.headers) || {});
|
|
16418
|
+
const result = {};
|
|
16419
|
+
if (hasHeaders(headers)) {
|
|
16420
|
+
result.headers = headers;
|
|
16421
|
+
}
|
|
16422
|
+
if (options == null ? void 0 : options.withCredentials) {
|
|
16423
|
+
result.credentials = "include";
|
|
16424
|
+
}
|
|
16425
|
+
if ((request == null ? void 0 : request.credentials) !== void 0) {
|
|
16426
|
+
result.credentials = request.credentials;
|
|
16427
|
+
}
|
|
16428
|
+
if ((request == null ? void 0 : request.cache) !== void 0) {
|
|
16429
|
+
result.cache = request.cache;
|
|
16430
|
+
}
|
|
16431
|
+
return normalizeLayerRequestOptions(result);
|
|
16432
|
+
}
|
|
16433
|
+
function hasLayerRequestOptions(request) {
|
|
16434
|
+
return !!(request && (hasHeaders(request.headers) || request.credentials !== void 0 || request.cache !== void 0 && request.cache !== "default"));
|
|
16435
|
+
}
|
|
16436
|
+
|
|
15685
16437
|
function callAjax({
|
|
15686
16438
|
src,
|
|
15687
16439
|
headers,
|
|
15688
|
-
withCredentials
|
|
16440
|
+
withCredentials,
|
|
16441
|
+
request
|
|
15689
16442
|
}) {
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
16443
|
+
const layerRequest = getLayerRequestOptions({
|
|
16444
|
+
headers,
|
|
16445
|
+
request,
|
|
16446
|
+
withCredentials
|
|
16447
|
+
});
|
|
16448
|
+
const requestHeaders = (layerRequest == null ? void 0 : layerRequest.headers) || {};
|
|
16449
|
+
const controller = new AbortController();
|
|
16450
|
+
const promise = fetch(src, {
|
|
16451
|
+
cache: layerRequest == null ? void 0 : layerRequest.cache,
|
|
16452
|
+
credentials: layerRequest == null ? void 0 : layerRequest.credentials,
|
|
16453
|
+
headers: requestHeaders,
|
|
16454
|
+
signal: controller.signal
|
|
16455
|
+
}).then((response) => {
|
|
16456
|
+
if (!response.ok) {
|
|
16457
|
+
throw new Error(response.statusText);
|
|
15698
16458
|
}
|
|
15699
|
-
|
|
15700
|
-
|
|
16459
|
+
return response.blob();
|
|
16460
|
+
}).then((blob) => {
|
|
16461
|
+
const urlCreator = window.URL || window.webkitURL;
|
|
16462
|
+
return urlCreator.createObjectURL(blob);
|
|
16463
|
+
}).catch((er) => {
|
|
16464
|
+
if (er.name === "AbortError") {
|
|
16465
|
+
return "";
|
|
15701
16466
|
}
|
|
15702
|
-
|
|
15703
|
-
const arrayBufferView = new Uint8Array(this.response);
|
|
15704
|
-
const blob = new Blob([arrayBufferView], { type: "image/png" });
|
|
15705
|
-
const urlCreator = window.URL || window.webkitURL;
|
|
15706
|
-
const imageUrl = urlCreator.createObjectURL(blob);
|
|
15707
|
-
resolve(imageUrl);
|
|
15708
|
-
};
|
|
15709
|
-
xhr.onerror = reject;
|
|
15710
|
-
xhr.send();
|
|
15711
|
-
abortFunc = () => {
|
|
15712
|
-
xhr.abort();
|
|
15713
|
-
resolve("");
|
|
15714
|
-
};
|
|
16467
|
+
throw er;
|
|
15715
16468
|
});
|
|
16469
|
+
const abortFunc = () => {
|
|
16470
|
+
controller.abort();
|
|
16471
|
+
};
|
|
15716
16472
|
return [promise, abortFunc];
|
|
15717
16473
|
}
|
|
15718
16474
|
|
|
@@ -15821,7 +16577,7 @@ class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
|
15821
16577
|
}
|
|
15822
16578
|
_initImage() {
|
|
15823
16579
|
super._initImage();
|
|
15824
|
-
const { headers, withCredentials } = this.options;
|
|
16580
|
+
const { headers, request, withCredentials } = this.options;
|
|
15825
16581
|
const img = this._image;
|
|
15826
16582
|
const src = img.src;
|
|
15827
16583
|
img.src = "";
|
|
@@ -15829,6 +16585,7 @@ class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
|
15829
16585
|
const [promise, abortFunc] = callAjax({
|
|
15830
16586
|
src,
|
|
15831
16587
|
headers,
|
|
16588
|
+
request,
|
|
15832
16589
|
withCredentials
|
|
15833
16590
|
});
|
|
15834
16591
|
promise.then((imgUrl) => {
|
|
@@ -15937,6 +16694,7 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15937
16694
|
opacity: 0,
|
|
15938
16695
|
pane: this.options.pane,
|
|
15939
16696
|
headers: this.options.headers,
|
|
16697
|
+
request: this.options.request,
|
|
15940
16698
|
withCredentials: this.options.withCredentials
|
|
15941
16699
|
});
|
|
15942
16700
|
overlay.addTo(this._map);
|
|
@@ -16061,15 +16819,17 @@ class ImageAdapter extends BaseAdapter {
|
|
|
16061
16819
|
const url = options && options.url;
|
|
16062
16820
|
if (url) {
|
|
16063
16821
|
const updateWmsParamsFromOpt = options.updateWmsParams;
|
|
16064
|
-
|
|
16822
|
+
const request = getLayerRequestOptions(options);
|
|
16823
|
+
this.layer = new ImageLayer(url, __spreadProps$3(__spreadValues$4(__spreadValues$4(__spreadValues$4({
|
|
16065
16824
|
pane: this.pane,
|
|
16066
|
-
headers: options.headers,
|
|
16067
16825
|
setViewDelay: options.setViewDelay
|
|
16068
16826
|
}, __spreadProps$3(__spreadValues$4({
|
|
16069
16827
|
transparent: true
|
|
16070
16828
|
}, options), {
|
|
16071
16829
|
opacity: (_a = options.opacity) != null ? _a : void 0
|
|
16072
|
-
})), options.params), options.nativeOptions)
|
|
16830
|
+
})), options.params), options.nativeOptions), {
|
|
16831
|
+
request
|
|
16832
|
+
}));
|
|
16073
16833
|
if (updateWmsParamsFromOpt) {
|
|
16074
16834
|
const updateWmsParams = this.layer.updateWmsParams;
|
|
16075
16835
|
this.layer.updateWmsParams = function(map) {
|
|
@@ -16106,7 +16866,8 @@ function makeRemote(Base) {
|
|
|
16106
16866
|
const [promise, abortFunc] = callAjax({
|
|
16107
16867
|
src,
|
|
16108
16868
|
withCredentials: this.options.withCredentials,
|
|
16109
|
-
headers: this.options.headers
|
|
16869
|
+
headers: this.options.headers,
|
|
16870
|
+
request: this.options.request
|
|
16110
16871
|
});
|
|
16111
16872
|
promise.then((response) => {
|
|
16112
16873
|
tile.src = response;
|
|
@@ -16197,10 +16958,10 @@ class TileAdapter extends BaseAdapter {
|
|
|
16197
16958
|
tileLayerOptions.subdomains = opt.subdomains;
|
|
16198
16959
|
}
|
|
16199
16960
|
let layer;
|
|
16200
|
-
|
|
16961
|
+
const request = getLayerRequestOptions(opt);
|
|
16962
|
+
if (request) {
|
|
16201
16963
|
layer = new TileLayer(url, __spreadProps$2(__spreadValues$3({}, tileLayerOptions), {
|
|
16202
|
-
|
|
16203
|
-
withCredentials: opt.withCredentials,
|
|
16964
|
+
request,
|
|
16204
16965
|
setViewDelay: opt.setViewDelay
|
|
16205
16966
|
}));
|
|
16206
16967
|
} else {
|
|
@@ -16305,10 +17066,10 @@ class WmsAdapter extends BaseAdapter {
|
|
|
16305
17066
|
transparent: true
|
|
16306
17067
|
}, options.nativeOptions);
|
|
16307
17068
|
let layer;
|
|
16308
|
-
|
|
17069
|
+
const request = getLayerRequestOptions(opt);
|
|
17070
|
+
if (request) {
|
|
16309
17071
|
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16310
|
-
|
|
16311
|
-
withCredentials: opt.withCredentials
|
|
17072
|
+
request
|
|
16312
17073
|
}));
|
|
16313
17074
|
} else {
|
|
16314
17075
|
layer = new leafletSrcExports.TileLayer.WMS(url, layerOptions);
|
|
@@ -16351,6 +17112,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
16351
17112
|
__publicField(this, "emitter", new EventEmitter());
|
|
16352
17113
|
__publicField(this, "map");
|
|
16353
17114
|
__publicField(this, "_resizeObserver");
|
|
17115
|
+
__publicField(this, "_controlContainer");
|
|
16354
17116
|
__publicField(this, "_unselectCb", []);
|
|
16355
17117
|
__publicField(this, "_universalEvents", [
|
|
16356
17118
|
"move",
|
|
@@ -16389,6 +17151,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
16389
17151
|
this._updateMinZoomForBounds(minZoom);
|
|
16390
17152
|
this._watchSizeChangeToUpdateMinZoom();
|
|
16391
17153
|
const defPane = this.map.createPane("order-0");
|
|
17154
|
+
this._controlContainer = new LeafletControlContainer(this.map);
|
|
16392
17155
|
this.map._addUnselectCb = (def) => {
|
|
16393
17156
|
this._addUnselectCb(def);
|
|
16394
17157
|
};
|
|
@@ -16401,12 +17164,19 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
16401
17164
|
if (this.map) {
|
|
16402
17165
|
this.map.remove();
|
|
16403
17166
|
}
|
|
17167
|
+
if (this._controlContainer) {
|
|
17168
|
+
this._controlContainer.detach();
|
|
17169
|
+
this._controlContainer = void 0;
|
|
17170
|
+
}
|
|
16404
17171
|
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16405
17172
|
}
|
|
16406
17173
|
getContainer() {
|
|
16407
17174
|
return this.map && this.map.getContainer();
|
|
16408
17175
|
}
|
|
16409
17176
|
getControlContainer() {
|
|
17177
|
+
if (this._controlContainer) {
|
|
17178
|
+
return this._controlContainer.getContainer();
|
|
17179
|
+
}
|
|
16410
17180
|
const controlContainer = this.map && this.map._controlContainer;
|
|
16411
17181
|
if (controlContainer) {
|
|
16412
17182
|
return controlContainer;
|
|
@@ -16520,16 +17290,17 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
16520
17290
|
createButtonControl(options) {
|
|
16521
17291
|
return createButtonControl(options, this);
|
|
16522
17292
|
}
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
17293
|
+
createToggleControl(options) {
|
|
17294
|
+
return createToggleControl(options, this);
|
|
17295
|
+
}
|
|
17296
|
+
addControl(control, position, options) {
|
|
17297
|
+
if (this._controlContainer) {
|
|
17298
|
+
return this._controlContainer.addControl(control, position, options);
|
|
16528
17299
|
}
|
|
16529
17300
|
}
|
|
16530
17301
|
removeControl(control) {
|
|
16531
|
-
if (this.
|
|
16532
|
-
this.
|
|
17302
|
+
if (this._controlContainer) {
|
|
17303
|
+
this._controlContainer.removeControl(control);
|
|
16533
17304
|
}
|
|
16534
17305
|
}
|
|
16535
17306
|
removeLayer(layer) {
|