tg-blog 1.0.10 → 1.0.11-alpha2
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/dist/{leaflet-src.esm-12ebbbc8.js → leaflet-src.esm-114b2dcb.js} +1371 -1
- package/dist/leaflet-src.esm-114b2dcb.js.map +1 -0
- package/dist/leaflet-src.esm-28c838de.cjs +1 -0
- package/dist/leaflet-src.esm-28c838de.cjs.map +1 -0
- package/dist/marker-icon-2x-b9d2094a.js +1 -0
- package/dist/marker-icon-2x-b9d2094a.js.map +1 -0
- package/dist/marker-icon-2x-c96d03d7.cjs +1 -0
- package/dist/marker-icon-2x-c96d03d7.cjs.map +1 -0
- package/dist/marker-icon-b2ca459f.js +1 -0
- package/dist/marker-icon-b2ca459f.js.map +1 -0
- package/dist/marker-icon-ea2516b7.cjs +1 -0
- package/dist/marker-icon-ea2516b7.cjs.map +1 -0
- package/dist/marker-shadow-8f64c412.cjs +1 -0
- package/dist/marker-shadow-8f64c412.cjs.map +1 -0
- package/dist/marker-shadow-eea80fe0.js +1 -0
- package/dist/marker-shadow-eea80fe0.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/tg-blog.cjs.js +108 -1
- package/dist/tg-blog.cjs.js.map +1 -0
- package/dist/tg-blog.es.js +17861 -13
- package/dist/tg-blog.es.js.map +1 -0
- package/dist/tg-blog.umd.js +38 -37
- package/dist/tg-blog.umd.js.map +1 -0
- package/dist/types/logic/models.d.ts +2 -2
- package/dist/types/views/index.d.ts +4 -1
- package/package.json +3 -3
- package/src/logic/models.ts +3 -2
- package/src/views/index.ts +5 -1
- package/dist/Location-9ef41720.cjs +0 -4
- package/dist/Location-c0fc6088.js +0 -5559
- package/dist/Poll-ad88c4c3.js +0 -55
- package/dist/Poll-e4f8d306.cjs +0 -1
- package/dist/index-458da32d.js +0 -10661
- package/dist/index-b840d5eb.cjs +0 -104
|
@@ -174,6 +174,13 @@ function un(t) {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
var D = {
|
|
177
|
+
/* @method on(type: String, fn: Function, context?: Object): this
|
|
178
|
+
* Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).
|
|
179
|
+
*
|
|
180
|
+
* @alternative
|
|
181
|
+
* @method on(eventMap: Object): this
|
|
182
|
+
* Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
|
|
183
|
+
*/
|
|
177
184
|
on: function(t, e, i) {
|
|
178
185
|
if (typeof t == "object")
|
|
179
186
|
for (var n in t)
|
|
@@ -185,6 +192,17 @@ var D = {
|
|
|
185
192
|
}
|
|
186
193
|
return this;
|
|
187
194
|
},
|
|
195
|
+
/* @method off(type: String, fn?: Function, context?: Object): this
|
|
196
|
+
* Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.
|
|
197
|
+
*
|
|
198
|
+
* @alternative
|
|
199
|
+
* @method off(eventMap: Object): this
|
|
200
|
+
* Removes a set of type/listener pairs.
|
|
201
|
+
*
|
|
202
|
+
* @alternative
|
|
203
|
+
* @method off: this
|
|
204
|
+
* Removes all listeners to all events on the object. This includes implicitly attached events.
|
|
205
|
+
*/
|
|
188
206
|
off: function(t, e, i) {
|
|
189
207
|
if (!arguments.length)
|
|
190
208
|
delete this._events;
|
|
@@ -198,6 +216,7 @@ var D = {
|
|
|
198
216
|
}
|
|
199
217
|
return this;
|
|
200
218
|
},
|
|
219
|
+
// attach listener (without syntactic sugar now)
|
|
201
220
|
_on: function(t, e, i, n) {
|
|
202
221
|
if (typeof e != "function") {
|
|
203
222
|
console.warn("wrong listener type: " + typeof e);
|
|
@@ -230,6 +249,10 @@ var D = {
|
|
|
230
249
|
}
|
|
231
250
|
}
|
|
232
251
|
},
|
|
252
|
+
// @method fire(type: String, data?: Object, propagate?: Boolean): this
|
|
253
|
+
// Fires an event of the specified type. You can optionally provide a data
|
|
254
|
+
// object — the first argument of the listener function will contain its
|
|
255
|
+
// properties. The event can optionally be propagated to event parents.
|
|
233
256
|
fire: function(t, e, i) {
|
|
234
257
|
if (!this.listens(t, i))
|
|
235
258
|
return this;
|
|
@@ -251,6 +274,10 @@ var D = {
|
|
|
251
274
|
}
|
|
252
275
|
return i && this._propagateEvent(n), this;
|
|
253
276
|
},
|
|
277
|
+
// @method listens(type: String, propagate?: Boolean): Boolean
|
|
278
|
+
// @method listens(type: String, fn: Function, context?: Object, propagate?: Boolean): Boolean
|
|
279
|
+
// Returns `true` if a particular event type has any listeners attached to it.
|
|
280
|
+
// The verification can optionally be propagated, it will return `true` if parents have the listener attached to it.
|
|
254
281
|
listens: function(t, e, i, n) {
|
|
255
282
|
typeof t != "string" && console.warn('"string" type argument expected');
|
|
256
283
|
var o = e;
|
|
@@ -265,6 +292,7 @@ var D = {
|
|
|
265
292
|
}
|
|
266
293
|
return !1;
|
|
267
294
|
},
|
|
295
|
+
// returns the index (number) or false
|
|
268
296
|
_listens: function(t, e, i) {
|
|
269
297
|
if (!this._events)
|
|
270
298
|
return !1;
|
|
@@ -277,6 +305,8 @@ var D = {
|
|
|
277
305
|
return o;
|
|
278
306
|
return !1;
|
|
279
307
|
},
|
|
308
|
+
// @method once(…): this
|
|
309
|
+
// Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.
|
|
280
310
|
once: function(t, e, i) {
|
|
281
311
|
if (typeof t == "object")
|
|
282
312
|
for (var n in t)
|
|
@@ -288,9 +318,13 @@ var D = {
|
|
|
288
318
|
}
|
|
289
319
|
return this;
|
|
290
320
|
},
|
|
321
|
+
// @method addEventParent(obj: Evented): this
|
|
322
|
+
// Adds an event parent - an `Evented` that will receive propagated events
|
|
291
323
|
addEventParent: function(t) {
|
|
292
324
|
return this._eventParents = this._eventParents || {}, this._eventParents[x(t)] = t, this;
|
|
293
325
|
},
|
|
326
|
+
// @method removeEventParent(obj: Evented): this
|
|
327
|
+
// Removes an event parent, so it will stop receiving propagated events
|
|
294
328
|
removeEventParent: function(t) {
|
|
295
329
|
return this._eventParents && delete this._eventParents[x(t)], this;
|
|
296
330
|
},
|
|
@@ -315,74 +349,108 @@ var je = Math.trunc || function(t) {
|
|
|
315
349
|
return t > 0 ? Math.floor(t) : Math.ceil(t);
|
|
316
350
|
};
|
|
317
351
|
m.prototype = {
|
|
352
|
+
// @method clone(): Point
|
|
353
|
+
// Returns a copy of the current point.
|
|
318
354
|
clone: function() {
|
|
319
355
|
return new m(this.x, this.y);
|
|
320
356
|
},
|
|
357
|
+
// @method add(otherPoint: Point): Point
|
|
358
|
+
// Returns the result of addition of the current and the given points.
|
|
321
359
|
add: function(t) {
|
|
322
360
|
return this.clone()._add(d(t));
|
|
323
361
|
},
|
|
324
362
|
_add: function(t) {
|
|
325
363
|
return this.x += t.x, this.y += t.y, this;
|
|
326
364
|
},
|
|
365
|
+
// @method subtract(otherPoint: Point): Point
|
|
366
|
+
// Returns the result of subtraction of the given point from the current.
|
|
327
367
|
subtract: function(t) {
|
|
328
368
|
return this.clone()._subtract(d(t));
|
|
329
369
|
},
|
|
330
370
|
_subtract: function(t) {
|
|
331
371
|
return this.x -= t.x, this.y -= t.y, this;
|
|
332
372
|
},
|
|
373
|
+
// @method divideBy(num: Number): Point
|
|
374
|
+
// Returns the result of division of the current point by the given number.
|
|
333
375
|
divideBy: function(t) {
|
|
334
376
|
return this.clone()._divideBy(t);
|
|
335
377
|
},
|
|
336
378
|
_divideBy: function(t) {
|
|
337
379
|
return this.x /= t, this.y /= t, this;
|
|
338
380
|
},
|
|
381
|
+
// @method multiplyBy(num: Number): Point
|
|
382
|
+
// Returns the result of multiplication of the current point by the given number.
|
|
339
383
|
multiplyBy: function(t) {
|
|
340
384
|
return this.clone()._multiplyBy(t);
|
|
341
385
|
},
|
|
342
386
|
_multiplyBy: function(t) {
|
|
343
387
|
return this.x *= t, this.y *= t, this;
|
|
344
388
|
},
|
|
389
|
+
// @method scaleBy(scale: Point): Point
|
|
390
|
+
// Multiply each coordinate of the current point by each coordinate of
|
|
391
|
+
// `scale`. In linear algebra terms, multiply the point by the
|
|
392
|
+
// [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)
|
|
393
|
+
// defined by `scale`.
|
|
345
394
|
scaleBy: function(t) {
|
|
346
395
|
return new m(this.x * t.x, this.y * t.y);
|
|
347
396
|
},
|
|
397
|
+
// @method unscaleBy(scale: Point): Point
|
|
398
|
+
// Inverse of `scaleBy`. Divide each coordinate of the current point by
|
|
399
|
+
// each coordinate of `scale`.
|
|
348
400
|
unscaleBy: function(t) {
|
|
349
401
|
return new m(this.x / t.x, this.y / t.y);
|
|
350
402
|
},
|
|
403
|
+
// @method round(): Point
|
|
404
|
+
// Returns a copy of the current point with rounded coordinates.
|
|
351
405
|
round: function() {
|
|
352
406
|
return this.clone()._round();
|
|
353
407
|
},
|
|
354
408
|
_round: function() {
|
|
355
409
|
return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
|
|
356
410
|
},
|
|
411
|
+
// @method floor(): Point
|
|
412
|
+
// Returns a copy of the current point with floored coordinates (rounded down).
|
|
357
413
|
floor: function() {
|
|
358
414
|
return this.clone()._floor();
|
|
359
415
|
},
|
|
360
416
|
_floor: function() {
|
|
361
417
|
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this;
|
|
362
418
|
},
|
|
419
|
+
// @method ceil(): Point
|
|
420
|
+
// Returns a copy of the current point with ceiled coordinates (rounded up).
|
|
363
421
|
ceil: function() {
|
|
364
422
|
return this.clone()._ceil();
|
|
365
423
|
},
|
|
366
424
|
_ceil: function() {
|
|
367
425
|
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this;
|
|
368
426
|
},
|
|
427
|
+
// @method trunc(): Point
|
|
428
|
+
// Returns a copy of the current point with truncated coordinates (rounded towards zero).
|
|
369
429
|
trunc: function() {
|
|
370
430
|
return this.clone()._trunc();
|
|
371
431
|
},
|
|
372
432
|
_trunc: function() {
|
|
373
433
|
return this.x = je(this.x), this.y = je(this.y), this;
|
|
374
434
|
},
|
|
435
|
+
// @method distanceTo(otherPoint: Point): Number
|
|
436
|
+
// Returns the cartesian distance between the current and the given points.
|
|
375
437
|
distanceTo: function(t) {
|
|
376
438
|
t = d(t);
|
|
377
439
|
var e = t.x - this.x, i = t.y - this.y;
|
|
378
440
|
return Math.sqrt(e * e + i * i);
|
|
379
441
|
},
|
|
442
|
+
// @method equals(otherPoint: Point): Boolean
|
|
443
|
+
// Returns `true` if the given point has the same coordinates.
|
|
380
444
|
equals: function(t) {
|
|
381
445
|
return t = d(t), t.x === this.x && t.y === this.y;
|
|
382
446
|
},
|
|
447
|
+
// @method contains(otherPoint: Point): Boolean
|
|
448
|
+
// Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
|
|
383
449
|
contains: function(t) {
|
|
384
450
|
return t = d(t), Math.abs(t.x) <= Math.abs(this.x) && Math.abs(t.y) <= Math.abs(this.y);
|
|
385
451
|
},
|
|
452
|
+
// @method toString(): String
|
|
453
|
+
// Returns a string representation of the point for debugging purposes.
|
|
386
454
|
toString: function() {
|
|
387
455
|
return "Point(" + V(this.x) + ", " + V(this.y) + ")";
|
|
388
456
|
}
|
|
@@ -396,6 +464,11 @@ function S(t, e) {
|
|
|
396
464
|
this.extend(i[n]);
|
|
397
465
|
}
|
|
398
466
|
S.prototype = {
|
|
467
|
+
// @method extend(point: Point): this
|
|
468
|
+
// Extends the bounds to contain the given point.
|
|
469
|
+
// @alternative
|
|
470
|
+
// @method extend(otherBounds: Bounds): this
|
|
471
|
+
// Extend the bounds to contain the given bounds
|
|
399
472
|
extend: function(t) {
|
|
400
473
|
var e, i;
|
|
401
474
|
if (!t)
|
|
@@ -406,6 +479,8 @@ S.prototype = {
|
|
|
406
479
|
return this;
|
|
407
480
|
return !this.min && !this.max ? (this.min = e.clone(), this.max = i.clone()) : (this.min.x = Math.min(e.x, this.min.x), this.max.x = Math.max(i.x, this.max.x), this.min.y = Math.min(e.y, this.min.y), this.max.y = Math.max(i.y, this.max.y)), this;
|
|
408
481
|
},
|
|
482
|
+
// @method getCenter(round?: Boolean): Point
|
|
483
|
+
// Returns the center point of the bounds.
|
|
409
484
|
getCenter: function(t) {
|
|
410
485
|
return d(
|
|
411
486
|
(this.min.x + this.max.x) / 2,
|
|
@@ -413,38 +488,65 @@ S.prototype = {
|
|
|
413
488
|
t
|
|
414
489
|
);
|
|
415
490
|
},
|
|
491
|
+
// @method getBottomLeft(): Point
|
|
492
|
+
// Returns the bottom-left point of the bounds.
|
|
416
493
|
getBottomLeft: function() {
|
|
417
494
|
return d(this.min.x, this.max.y);
|
|
418
495
|
},
|
|
496
|
+
// @method getTopRight(): Point
|
|
497
|
+
// Returns the top-right point of the bounds.
|
|
419
498
|
getTopRight: function() {
|
|
420
499
|
return d(this.max.x, this.min.y);
|
|
421
500
|
},
|
|
501
|
+
// @method getTopLeft(): Point
|
|
502
|
+
// Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).
|
|
422
503
|
getTopLeft: function() {
|
|
423
504
|
return this.min;
|
|
424
505
|
},
|
|
506
|
+
// @method getBottomRight(): Point
|
|
507
|
+
// Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).
|
|
425
508
|
getBottomRight: function() {
|
|
426
509
|
return this.max;
|
|
427
510
|
},
|
|
511
|
+
// @method getSize(): Point
|
|
512
|
+
// Returns the size of the given bounds
|
|
428
513
|
getSize: function() {
|
|
429
514
|
return this.max.subtract(this.min);
|
|
430
515
|
},
|
|
516
|
+
// @method contains(otherBounds: Bounds): Boolean
|
|
517
|
+
// Returns `true` if the rectangle contains the given one.
|
|
518
|
+
// @alternative
|
|
519
|
+
// @method contains(point: Point): Boolean
|
|
520
|
+
// Returns `true` if the rectangle contains the given point.
|
|
431
521
|
contains: function(t) {
|
|
432
522
|
var e, i;
|
|
433
523
|
return typeof t[0] == "number" || t instanceof m ? t = d(t) : t = N(t), t instanceof S ? (e = t.min, i = t.max) : e = i = t, e.x >= this.min.x && i.x <= this.max.x && e.y >= this.min.y && i.y <= this.max.y;
|
|
434
524
|
},
|
|
525
|
+
// @method intersects(otherBounds: Bounds): Boolean
|
|
526
|
+
// Returns `true` if the rectangle intersects the given bounds. Two bounds
|
|
527
|
+
// intersect if they have at least one point in common.
|
|
435
528
|
intersects: function(t) {
|
|
436
529
|
t = N(t);
|
|
437
530
|
var e = this.min, i = this.max, n = t.min, o = t.max, s = o.x >= e.x && n.x <= i.x, r = o.y >= e.y && n.y <= i.y;
|
|
438
531
|
return s && r;
|
|
439
532
|
},
|
|
533
|
+
// @method overlaps(otherBounds: Bounds): Boolean
|
|
534
|
+
// Returns `true` if the rectangle overlaps the given bounds. Two bounds
|
|
535
|
+
// overlap if their intersection is an area.
|
|
440
536
|
overlaps: function(t) {
|
|
441
537
|
t = N(t);
|
|
442
538
|
var e = this.min, i = this.max, n = t.min, o = t.max, s = o.x > e.x && n.x < i.x, r = o.y > e.y && n.y < i.y;
|
|
443
539
|
return s && r;
|
|
444
540
|
},
|
|
541
|
+
// @method isValid(): Boolean
|
|
542
|
+
// Returns `true` if the bounds are properly initialized.
|
|
445
543
|
isValid: function() {
|
|
446
544
|
return !!(this.min && this.max);
|
|
447
545
|
},
|
|
546
|
+
// @method pad(bufferRatio: Number): Bounds
|
|
547
|
+
// Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
|
|
548
|
+
// For example, a ratio of 0.5 extends the bounds by 50% in each direction.
|
|
549
|
+
// Negative values will retract the bounds.
|
|
448
550
|
pad: function(t) {
|
|
449
551
|
var e = this.min, i = this.max, n = Math.abs(e.x - i.x) * t, o = Math.abs(e.y - i.y) * t;
|
|
450
552
|
return N(
|
|
@@ -452,6 +554,8 @@ S.prototype = {
|
|
|
452
554
|
d(i.x + n, i.y + o)
|
|
453
555
|
);
|
|
454
556
|
},
|
|
557
|
+
// @method equals(otherBounds: Bounds): Boolean
|
|
558
|
+
// Returns `true` if the rectangle is equivalent to the given bounds.
|
|
455
559
|
equals: function(t) {
|
|
456
560
|
return t ? (t = N(t), this.min.equals(t.getTopLeft()) && this.max.equals(t.getBottomRight())) : !1;
|
|
457
561
|
}
|
|
@@ -465,6 +569,11 @@ function R(t, e) {
|
|
|
465
569
|
this.extend(i[n]);
|
|
466
570
|
}
|
|
467
571
|
R.prototype = {
|
|
572
|
+
// @method extend(latlng: LatLng): this
|
|
573
|
+
// Extend the bounds to contain the given point
|
|
574
|
+
// @alternative
|
|
575
|
+
// @method extend(otherBounds: LatLngBounds): this
|
|
576
|
+
// Extend the bounds to contain the given bounds
|
|
468
577
|
extend: function(t) {
|
|
469
578
|
var e = this._southWest, i = this._northEast, n, o;
|
|
470
579
|
if (t instanceof w)
|
|
@@ -476,6 +585,10 @@ R.prototype = {
|
|
|
476
585
|
return t ? this.extend(b(t) || I(t)) : this;
|
|
477
586
|
return !e && !i ? (this._southWest = new w(n.lat, n.lng), this._northEast = new w(o.lat, o.lng)) : (e.lat = Math.min(n.lat, e.lat), e.lng = Math.min(n.lng, e.lng), i.lat = Math.max(o.lat, i.lat), i.lng = Math.max(o.lng, i.lng)), this;
|
|
478
587
|
},
|
|
588
|
+
// @method pad(bufferRatio: Number): LatLngBounds
|
|
589
|
+
// Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
|
|
590
|
+
// For example, a ratio of 0.5 extends the bounds by 50% in each direction.
|
|
591
|
+
// Negative values will retract the bounds.
|
|
479
592
|
pad: function(t) {
|
|
480
593
|
var e = this._southWest, i = this._northEast, n = Math.abs(e.lat - i.lat) * t, o = Math.abs(e.lng - i.lng) * t;
|
|
481
594
|
return new R(
|
|
@@ -483,57 +596,90 @@ R.prototype = {
|
|
|
483
596
|
new w(i.lat + n, i.lng + o)
|
|
484
597
|
);
|
|
485
598
|
},
|
|
599
|
+
// @method getCenter(): LatLng
|
|
600
|
+
// Returns the center point of the bounds.
|
|
486
601
|
getCenter: function() {
|
|
487
602
|
return new w(
|
|
488
603
|
(this._southWest.lat + this._northEast.lat) / 2,
|
|
489
604
|
(this._southWest.lng + this._northEast.lng) / 2
|
|
490
605
|
);
|
|
491
606
|
},
|
|
607
|
+
// @method getSouthWest(): LatLng
|
|
608
|
+
// Returns the south-west point of the bounds.
|
|
492
609
|
getSouthWest: function() {
|
|
493
610
|
return this._southWest;
|
|
494
611
|
},
|
|
612
|
+
// @method getNorthEast(): LatLng
|
|
613
|
+
// Returns the north-east point of the bounds.
|
|
495
614
|
getNorthEast: function() {
|
|
496
615
|
return this._northEast;
|
|
497
616
|
},
|
|
617
|
+
// @method getNorthWest(): LatLng
|
|
618
|
+
// Returns the north-west point of the bounds.
|
|
498
619
|
getNorthWest: function() {
|
|
499
620
|
return new w(this.getNorth(), this.getWest());
|
|
500
621
|
},
|
|
622
|
+
// @method getSouthEast(): LatLng
|
|
623
|
+
// Returns the south-east point of the bounds.
|
|
501
624
|
getSouthEast: function() {
|
|
502
625
|
return new w(this.getSouth(), this.getEast());
|
|
503
626
|
},
|
|
627
|
+
// @method getWest(): Number
|
|
628
|
+
// Returns the west longitude of the bounds
|
|
504
629
|
getWest: function() {
|
|
505
630
|
return this._southWest.lng;
|
|
506
631
|
},
|
|
632
|
+
// @method getSouth(): Number
|
|
633
|
+
// Returns the south latitude of the bounds
|
|
507
634
|
getSouth: function() {
|
|
508
635
|
return this._southWest.lat;
|
|
509
636
|
},
|
|
637
|
+
// @method getEast(): Number
|
|
638
|
+
// Returns the east longitude of the bounds
|
|
510
639
|
getEast: function() {
|
|
511
640
|
return this._northEast.lng;
|
|
512
641
|
},
|
|
642
|
+
// @method getNorth(): Number
|
|
643
|
+
// Returns the north latitude of the bounds
|
|
513
644
|
getNorth: function() {
|
|
514
645
|
return this._northEast.lat;
|
|
515
646
|
},
|
|
647
|
+
// @method contains(otherBounds: LatLngBounds): Boolean
|
|
648
|
+
// Returns `true` if the rectangle contains the given one.
|
|
649
|
+
// @alternative
|
|
650
|
+
// @method contains (latlng: LatLng): Boolean
|
|
651
|
+
// Returns `true` if the rectangle contains the given point.
|
|
516
652
|
contains: function(t) {
|
|
517
653
|
typeof t[0] == "number" || t instanceof w || "lat" in t ? t = b(t) : t = I(t);
|
|
518
654
|
var e = this._southWest, i = this._northEast, n, o;
|
|
519
655
|
return t instanceof R ? (n = t.getSouthWest(), o = t.getNorthEast()) : n = o = t, n.lat >= e.lat && o.lat <= i.lat && n.lng >= e.lng && o.lng <= i.lng;
|
|
520
656
|
},
|
|
657
|
+
// @method intersects(otherBounds: LatLngBounds): Boolean
|
|
658
|
+
// Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
|
|
521
659
|
intersects: function(t) {
|
|
522
660
|
t = I(t);
|
|
523
661
|
var e = this._southWest, i = this._northEast, n = t.getSouthWest(), o = t.getNorthEast(), s = o.lat >= e.lat && n.lat <= i.lat, r = o.lng >= e.lng && n.lng <= i.lng;
|
|
524
662
|
return s && r;
|
|
525
663
|
},
|
|
664
|
+
// @method overlaps(otherBounds: LatLngBounds): Boolean
|
|
665
|
+
// Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
|
|
526
666
|
overlaps: function(t) {
|
|
527
667
|
t = I(t);
|
|
528
668
|
var e = this._southWest, i = this._northEast, n = t.getSouthWest(), o = t.getNorthEast(), s = o.lat > e.lat && n.lat < i.lat, r = o.lng > e.lng && n.lng < i.lng;
|
|
529
669
|
return s && r;
|
|
530
670
|
},
|
|
671
|
+
// @method toBBoxString(): String
|
|
672
|
+
// Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
|
|
531
673
|
toBBoxString: function() {
|
|
532
674
|
return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(",");
|
|
533
675
|
},
|
|
676
|
+
// @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean
|
|
677
|
+
// Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number.
|
|
534
678
|
equals: function(t, e) {
|
|
535
679
|
return t ? (t = I(t), this._southWest.equals(t.getSouthWest(), e) && this._northEast.equals(t.getNorthEast(), e)) : !1;
|
|
536
680
|
},
|
|
681
|
+
// @method isValid(): Boolean
|
|
682
|
+
// Returns `true` if the bounds are properly initialized.
|
|
537
683
|
isValid: function() {
|
|
538
684
|
return !!(this._southWest && this._northEast);
|
|
539
685
|
}
|
|
@@ -547,6 +693,8 @@ function w(t, e, i) {
|
|
|
547
693
|
this.lat = +t, this.lng = +e, i !== void 0 && (this.alt = +i);
|
|
548
694
|
}
|
|
549
695
|
w.prototype = {
|
|
696
|
+
// @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean
|
|
697
|
+
// Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number.
|
|
550
698
|
equals: function(t, e) {
|
|
551
699
|
if (!t)
|
|
552
700
|
return !1;
|
|
@@ -557,15 +705,23 @@ w.prototype = {
|
|
|
557
705
|
);
|
|
558
706
|
return i <= (e === void 0 ? 1e-9 : e);
|
|
559
707
|
},
|
|
708
|
+
// @method toString(): String
|
|
709
|
+
// Returns a string representation of the point (for debugging purposes).
|
|
560
710
|
toString: function(t) {
|
|
561
711
|
return "LatLng(" + V(this.lat, t) + ", " + V(this.lng, t) + ")";
|
|
562
712
|
},
|
|
713
|
+
// @method distanceTo(otherLatLng: LatLng): Number
|
|
714
|
+
// Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).
|
|
563
715
|
distanceTo: function(t) {
|
|
564
716
|
return it.distance(this, b(t));
|
|
565
717
|
},
|
|
718
|
+
// @method wrap(): LatLng
|
|
719
|
+
// Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.
|
|
566
720
|
wrap: function() {
|
|
567
721
|
return it.wrapLatLng(this);
|
|
568
722
|
},
|
|
723
|
+
// @method toBounds(sizeInMeters: Number): LatLngBounds
|
|
724
|
+
// Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.
|
|
569
725
|
toBounds: function(t) {
|
|
570
726
|
var e = 180 * t / 40075017, i = e / Math.cos(Math.PI / 180 * this.lat);
|
|
571
727
|
return I(
|
|
@@ -581,37 +737,80 @@ function b(t, e, i) {
|
|
|
581
737
|
return t instanceof w ? t : q(t) && typeof t[0] != "object" ? t.length === 3 ? new w(t[0], t[1], t[2]) : t.length === 2 ? new w(t[0], t[1]) : null : t == null ? t : typeof t == "object" && "lat" in t ? new w(t.lat, "lng" in t ? t.lng : t.lon, t.alt) : e === void 0 ? null : new w(t, e, i);
|
|
582
738
|
}
|
|
583
739
|
var ot = {
|
|
740
|
+
// @method latLngToPoint(latlng: LatLng, zoom: Number): Point
|
|
741
|
+
// Projects geographical coordinates into pixel coordinates for a given zoom.
|
|
584
742
|
latLngToPoint: function(t, e) {
|
|
585
743
|
var i = this.projection.project(t), n = this.scale(e);
|
|
586
744
|
return this.transformation._transform(i, n);
|
|
587
745
|
},
|
|
746
|
+
// @method pointToLatLng(point: Point, zoom: Number): LatLng
|
|
747
|
+
// The inverse of `latLngToPoint`. Projects pixel coordinates on a given
|
|
748
|
+
// zoom into geographical coordinates.
|
|
588
749
|
pointToLatLng: function(t, e) {
|
|
589
750
|
var i = this.scale(e), n = this.transformation.untransform(t, i);
|
|
590
751
|
return this.projection.unproject(n);
|
|
591
752
|
},
|
|
753
|
+
// @method project(latlng: LatLng): Point
|
|
754
|
+
// Projects geographical coordinates into coordinates in units accepted for
|
|
755
|
+
// this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
|
|
592
756
|
project: function(t) {
|
|
593
757
|
return this.projection.project(t);
|
|
594
758
|
},
|
|
759
|
+
// @method unproject(point: Point): LatLng
|
|
760
|
+
// Given a projected coordinate returns the corresponding LatLng.
|
|
761
|
+
// The inverse of `project`.
|
|
595
762
|
unproject: function(t) {
|
|
596
763
|
return this.projection.unproject(t);
|
|
597
764
|
},
|
|
765
|
+
// @method scale(zoom: Number): Number
|
|
766
|
+
// Returns the scale used when transforming projected coordinates into
|
|
767
|
+
// pixel coordinates for a particular zoom. For example, it returns
|
|
768
|
+
// `256 * 2^zoom` for Mercator-based CRS.
|
|
598
769
|
scale: function(t) {
|
|
599
770
|
return 256 * Math.pow(2, t);
|
|
600
771
|
},
|
|
772
|
+
// @method zoom(scale: Number): Number
|
|
773
|
+
// Inverse of `scale()`, returns the zoom level corresponding to a scale
|
|
774
|
+
// factor of `scale`.
|
|
601
775
|
zoom: function(t) {
|
|
602
776
|
return Math.log(t / 256) / Math.LN2;
|
|
603
777
|
},
|
|
778
|
+
// @method getProjectedBounds(zoom: Number): Bounds
|
|
779
|
+
// Returns the projection's bounds scaled and transformed for the provided `zoom`.
|
|
604
780
|
getProjectedBounds: function(t) {
|
|
605
781
|
if (this.infinite)
|
|
606
782
|
return null;
|
|
607
783
|
var e = this.projection.bounds, i = this.scale(t), n = this.transformation.transform(e.min, i), o = this.transformation.transform(e.max, i);
|
|
608
784
|
return new S(n, o);
|
|
609
785
|
},
|
|
786
|
+
// @method distance(latlng1: LatLng, latlng2: LatLng): Number
|
|
787
|
+
// Returns the distance between two geographical coordinates.
|
|
788
|
+
// @property code: String
|
|
789
|
+
// Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)
|
|
790
|
+
//
|
|
791
|
+
// @property wrapLng: Number[]
|
|
792
|
+
// An array of two numbers defining whether the longitude (horizontal) coordinate
|
|
793
|
+
// axis wraps around a given range and how. Defaults to `[-180, 180]` in most
|
|
794
|
+
// geographical CRSs. If `undefined`, the longitude axis does not wrap around.
|
|
795
|
+
//
|
|
796
|
+
// @property wrapLat: Number[]
|
|
797
|
+
// Like `wrapLng`, but for the latitude (vertical) axis.
|
|
798
|
+
// wrapLng: [min, max],
|
|
799
|
+
// wrapLat: [min, max],
|
|
800
|
+
// @property infinite: Boolean
|
|
801
|
+
// If true, the coordinate space will be unbounded (infinite in both axes)
|
|
610
802
|
infinite: !1,
|
|
803
|
+
// @method wrapLatLng(latlng: LatLng): LatLng
|
|
804
|
+
// Returns a `LatLng` where lat and lng has been wrapped according to the
|
|
805
|
+
// CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.
|
|
611
806
|
wrapLatLng: function(t) {
|
|
612
807
|
var e = this.wrapLng ? bt(t.lng, this.wrapLng, !0) : t.lng, i = this.wrapLat ? bt(t.lat, this.wrapLat, !0) : t.lat, n = t.alt;
|
|
613
808
|
return new w(i, e, n);
|
|
614
809
|
},
|
|
810
|
+
// @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds
|
|
811
|
+
// Returns a `LatLngBounds` with the same size as the given one, ensuring
|
|
812
|
+
// that its center is within the CRS's bounds.
|
|
813
|
+
// Only accepts actual `L.LatLngBounds` instances, not arrays.
|
|
615
814
|
wrapLatLngBounds: function(t) {
|
|
616
815
|
var e = t.getCenter(), i = this.wrapLatLng(e), n = e.lat - i.lat, o = e.lng - i.lng;
|
|
617
816
|
if (n === 0 && o === 0)
|
|
@@ -621,7 +820,11 @@ var ot = {
|
|
|
621
820
|
}
|
|
622
821
|
}, it = P({}, ot, {
|
|
623
822
|
wrapLng: [-180, 180],
|
|
823
|
+
// Mean Earth Radius, as recommended for use by
|
|
824
|
+
// the International Union of Geodesy and Geophysics,
|
|
825
|
+
// see https://rosettacode.org/wiki/Haversine_formula
|
|
624
826
|
R: 6371e3,
|
|
827
|
+
// distance between two geographical points using spherical law of cosines approximation
|
|
625
828
|
distance: function(t, e) {
|
|
626
829
|
var i = Math.PI / 180, n = t.lat * i, o = e.lat * i, s = Math.sin((e.lat - t.lat) * i / 2), r = Math.sin((e.lng - t.lng) * i / 2), a = s * s + Math.cos(n) * Math.cos(o) * r * r, h = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
627
830
|
return this.R * h;
|
|
@@ -656,12 +859,19 @@ function ui(t, e, i, n) {
|
|
|
656
859
|
this._a = t, this._b = e, this._c = i, this._d = n;
|
|
657
860
|
}
|
|
658
861
|
ui.prototype = {
|
|
862
|
+
// @method transform(point: Point, scale?: Number): Point
|
|
863
|
+
// Returns a transformed point, optionally multiplied by the given scale.
|
|
864
|
+
// Only accepts actual `L.Point` instances, not arrays.
|
|
659
865
|
transform: function(t, e) {
|
|
660
866
|
return this._transform(t.clone(), e);
|
|
661
867
|
},
|
|
868
|
+
// destructive transform (faster)
|
|
662
869
|
_transform: function(t, e) {
|
|
663
870
|
return e = e || 1, t.x = e * (this._a * t.x + this._b), t.y = e * (this._c * t.y + this._d), t;
|
|
664
871
|
},
|
|
872
|
+
// @method untransform(point: Point, scale?: Number): Point
|
|
873
|
+
// Returns the reverse transformation of the given point, optionally divided
|
|
874
|
+
// by the given scale. Only accepts actual `L.Point` instances, not arrays.
|
|
665
875
|
untransform: function(t, e) {
|
|
666
876
|
return e = e || 1, new m(
|
|
667
877
|
(t.x / e - this._b) / this._a,
|
|
@@ -1101,7 +1311,16 @@ function Ei(t, e) {
|
|
|
1101
1311
|
}
|
|
1102
1312
|
var Hn = c.linux && c.chrome ? window.devicePixelRatio : c.mac ? window.devicePixelRatio * 3 : window.devicePixelRatio > 0 ? 2 * window.devicePixelRatio : 1;
|
|
1103
1313
|
function Oi(t) {
|
|
1104
|
-
return c.edge ? t.wheelDeltaY / 2 : t.deltaY && t.deltaMode === 0 ? -t.deltaY / Hn : t.deltaY && t.deltaMode === 1 ? -t.deltaY * 20 : t.deltaY && t.deltaMode === 2 ? -t.deltaY * 60 : t.deltaX || t.deltaZ ? 0 :
|
|
1314
|
+
return c.edge ? t.wheelDeltaY / 2 : t.deltaY && t.deltaMode === 0 ? -t.deltaY / Hn : t.deltaY && t.deltaMode === 1 ? -t.deltaY * 20 : t.deltaY && t.deltaMode === 2 ? -t.deltaY * 60 : t.deltaX || t.deltaZ ? 0 : (
|
|
1315
|
+
// Skip horizontal/depth wheel events
|
|
1316
|
+
t.wheelDelta ? (t.wheelDeltaY || t.wheelDelta) / 2 : t.detail && Math.abs(t.detail) < 32765 ? -t.detail * 20 : (
|
|
1317
|
+
// Legacy Moz lines
|
|
1318
|
+
t.detail ? t.detail / -32765 * 60 : (
|
|
1319
|
+
// Legacy Moz pages
|
|
1320
|
+
0
|
|
1321
|
+
)
|
|
1322
|
+
)
|
|
1323
|
+
);
|
|
1105
1324
|
}
|
|
1106
1325
|
function Ze(t, e) {
|
|
1107
1326
|
var i = e.relatedTarget;
|
|
@@ -1131,9 +1350,16 @@ var mo = {
|
|
|
1131
1350
|
addListener: _,
|
|
1132
1351
|
removeListener: T
|
|
1133
1352
|
}, Fn = jt.extend({
|
|
1353
|
+
// @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number)
|
|
1354
|
+
// Run an animation of a given element to a new position, optionally setting
|
|
1355
|
+
// duration in seconds (`0.25` by default) and easing linearity factor (3rd
|
|
1356
|
+
// argument of the [cubic bezier curve](https://cubic-bezier.com/#0,0,.5,1),
|
|
1357
|
+
// `0.5` by default).
|
|
1134
1358
|
run: function(t, e, i, n) {
|
|
1135
1359
|
this.stop(), this._el = t, this._inProgress = !0, this._duration = i || 0.25, this._easeOutPower = 1 / Math.max(n || 0.5, 0.2), this._startPos = ft(t), this._offset = e.subtract(this._startPos), this._startTime = +new Date(), this.fire("start"), this._animate();
|
|
1136
1360
|
},
|
|
1361
|
+
// @method stop()
|
|
1362
|
+
// Stops the animation (if currently running).
|
|
1137
1363
|
stop: function() {
|
|
1138
1364
|
this._inProgress && (this._step(!0), this._complete());
|
|
1139
1365
|
},
|
|
@@ -1156,26 +1382,88 @@ var mo = {
|
|
|
1156
1382
|
}
|
|
1157
1383
|
}), g = jt.extend({
|
|
1158
1384
|
options: {
|
|
1385
|
+
// @section Map State Options
|
|
1386
|
+
// @option crs: CRS = L.CRS.EPSG3857
|
|
1387
|
+
// The [Coordinate Reference System](#crs) to use. Don't change this if you're not
|
|
1388
|
+
// sure what it means.
|
|
1159
1389
|
crs: ve,
|
|
1390
|
+
// @option center: LatLng = undefined
|
|
1391
|
+
// Initial geographic center of the map
|
|
1160
1392
|
center: void 0,
|
|
1393
|
+
// @option zoom: Number = undefined
|
|
1394
|
+
// Initial map zoom level
|
|
1161
1395
|
zoom: void 0,
|
|
1396
|
+
// @option minZoom: Number = *
|
|
1397
|
+
// Minimum zoom level of the map.
|
|
1398
|
+
// If not specified and at least one `GridLayer` or `TileLayer` is in the map,
|
|
1399
|
+
// the lowest of their `minZoom` options will be used instead.
|
|
1162
1400
|
minZoom: void 0,
|
|
1401
|
+
// @option maxZoom: Number = *
|
|
1402
|
+
// Maximum zoom level of the map.
|
|
1403
|
+
// If not specified and at least one `GridLayer` or `TileLayer` is in the map,
|
|
1404
|
+
// the highest of their `maxZoom` options will be used instead.
|
|
1163
1405
|
maxZoom: void 0,
|
|
1406
|
+
// @option layers: Layer[] = []
|
|
1407
|
+
// Array of layers that will be added to the map initially
|
|
1164
1408
|
layers: [],
|
|
1409
|
+
// @option maxBounds: LatLngBounds = null
|
|
1410
|
+
// When this option is set, the map restricts the view to the given
|
|
1411
|
+
// geographical bounds, bouncing the user back if the user tries to pan
|
|
1412
|
+
// outside the view. To set the restriction dynamically, use
|
|
1413
|
+
// [`setMaxBounds`](#map-setmaxbounds) method.
|
|
1165
1414
|
maxBounds: void 0,
|
|
1415
|
+
// @option renderer: Renderer = *
|
|
1416
|
+
// The default method for drawing vector layers on the map. `L.SVG`
|
|
1417
|
+
// or `L.Canvas` by default depending on browser support.
|
|
1166
1418
|
renderer: void 0,
|
|
1419
|
+
// @section Animation Options
|
|
1420
|
+
// @option zoomAnimation: Boolean = true
|
|
1421
|
+
// Whether the map zoom animation is enabled. By default it's enabled
|
|
1422
|
+
// in all browsers that support CSS3 Transitions except Android.
|
|
1167
1423
|
zoomAnimation: !0,
|
|
1424
|
+
// @option zoomAnimationThreshold: Number = 4
|
|
1425
|
+
// Won't animate zoom if the zoom difference exceeds this value.
|
|
1168
1426
|
zoomAnimationThreshold: 4,
|
|
1427
|
+
// @option fadeAnimation: Boolean = true
|
|
1428
|
+
// Whether the tile fade animation is enabled. By default it's enabled
|
|
1429
|
+
// in all browsers that support CSS3 Transitions except Android.
|
|
1169
1430
|
fadeAnimation: !0,
|
|
1431
|
+
// @option markerZoomAnimation: Boolean = true
|
|
1432
|
+
// Whether markers animate their zoom with the zoom animation, if disabled
|
|
1433
|
+
// they will disappear for the length of the animation. By default it's
|
|
1434
|
+
// enabled in all browsers that support CSS3 Transitions except Android.
|
|
1170
1435
|
markerZoomAnimation: !0,
|
|
1436
|
+
// @option transform3DLimit: Number = 2^23
|
|
1437
|
+
// Defines the maximum size of a CSS translation transform. The default
|
|
1438
|
+
// value should not be changed unless a web browser positions layers in
|
|
1439
|
+
// the wrong place after doing a large `panBy`.
|
|
1171
1440
|
transform3DLimit: 8388608,
|
|
1441
|
+
// Precision limit of a 32-bit float
|
|
1442
|
+
// @section Interaction Options
|
|
1443
|
+
// @option zoomSnap: Number = 1
|
|
1444
|
+
// Forces the map's zoom level to always be a multiple of this, particularly
|
|
1445
|
+
// right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.
|
|
1446
|
+
// By default, the zoom level snaps to the nearest integer; lower values
|
|
1447
|
+
// (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`
|
|
1448
|
+
// means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.
|
|
1172
1449
|
zoomSnap: 1,
|
|
1450
|
+
// @option zoomDelta: Number = 1
|
|
1451
|
+
// Controls how much the map's zoom level will change after a
|
|
1452
|
+
// [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`
|
|
1453
|
+
// or `-` on the keyboard, or using the [zoom controls](#control-zoom).
|
|
1454
|
+
// Values smaller than `1` (e.g. `0.5`) allow for greater granularity.
|
|
1173
1455
|
zoomDelta: 1,
|
|
1456
|
+
// @option trackResize: Boolean = true
|
|
1457
|
+
// Whether the map automatically handles browser window resize to update itself.
|
|
1174
1458
|
trackResize: !0
|
|
1175
1459
|
},
|
|
1176
1460
|
initialize: function(t, e) {
|
|
1177
1461
|
e = z(this, e), this._handlers = [], this._layers = {}, this._zoomBoundLayers = {}, this._sizeChanged = !0, this._initContainer(t), this._initLayout(), this._onResize = M(this._onResize, this), this._initEvents(), e.maxBounds && this.setMaxBounds(e.maxBounds), e.zoom !== void 0 && (this._zoom = this._limitZoom(e.zoom)), e.center && e.zoom !== void 0 && this.setView(b(e.center), e.zoom, { reset: !0 }), this.callInitHooks(), this._zoomAnimated = wt && c.any3d && !c.mobileOpera && this.options.zoomAnimation, this._zoomAnimated && (this._createAnimProxy(), _(this._proxy, zi, this._catchTransitionEnd, this)), this._addLayers(this.options.layers);
|
|
1178
1462
|
},
|
|
1463
|
+
// @section Methods for modifying map state
|
|
1464
|
+
// @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this
|
|
1465
|
+
// Sets the view of the map (geographical center and zoom) with the given
|
|
1466
|
+
// animation options.
|
|
1179
1467
|
setView: function(t, e, i) {
|
|
1180
1468
|
if (e = e === void 0 ? this._zoom : this._limitZoom(e), t = this._limitCenter(b(t), e, this.options.maxBounds), i = i || {}, this._stop(), this._loaded && !i.reset && i !== !0) {
|
|
1181
1469
|
i.animate !== void 0 && (i.zoom = P({ animate: i.animate }, i.zoom), i.pan = P({ animate: i.animate, duration: i.duration }, i.pan));
|
|
@@ -1185,15 +1473,27 @@ var mo = {
|
|
|
1185
1473
|
}
|
|
1186
1474
|
return this._resetView(t, e, i.pan && i.pan.noMoveStart), this;
|
|
1187
1475
|
},
|
|
1476
|
+
// @method setZoom(zoom: Number, options?: Zoom/pan options): this
|
|
1477
|
+
// Sets the zoom of the map.
|
|
1188
1478
|
setZoom: function(t, e) {
|
|
1189
1479
|
return this._loaded ? this.setView(this.getCenter(), t, { zoom: e }) : (this._zoom = t, this);
|
|
1190
1480
|
},
|
|
1481
|
+
// @method zoomIn(delta?: Number, options?: Zoom options): this
|
|
1482
|
+
// Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
|
|
1191
1483
|
zoomIn: function(t, e) {
|
|
1192
1484
|
return t = t || (c.any3d ? this.options.zoomDelta : 1), this.setZoom(this._zoom + t, e);
|
|
1193
1485
|
},
|
|
1486
|
+
// @method zoomOut(delta?: Number, options?: Zoom options): this
|
|
1487
|
+
// Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
|
|
1194
1488
|
zoomOut: function(t, e) {
|
|
1195
1489
|
return t = t || (c.any3d ? this.options.zoomDelta : 1), this.setZoom(this._zoom - t, e);
|
|
1196
1490
|
},
|
|
1491
|
+
// @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this
|
|
1492
|
+
// Zooms the map while keeping a specified geographical point on the map
|
|
1493
|
+
// stationary (e.g. used internally for scroll zoom and double-click zoom).
|
|
1494
|
+
// @alternative
|
|
1495
|
+
// @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this
|
|
1496
|
+
// Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
|
|
1197
1497
|
setZoomAround: function(t, e, i) {
|
|
1198
1498
|
var n = this.getZoomScale(e), o = this.getSize().divideBy(2), s = t instanceof m ? t : this.latLngToContainerPoint(t), r = s.subtract(o).multiplyBy(1 - 1 / n), a = this.containerPointToLatLng(o.add(r));
|
|
1199
1499
|
return this.setView(a, e, { zoom: i });
|
|
@@ -1212,18 +1512,28 @@ var mo = {
|
|
|
1212
1512
|
zoom: o
|
|
1213
1513
|
};
|
|
1214
1514
|
},
|
|
1515
|
+
// @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this
|
|
1516
|
+
// Sets a map view that contains the given geographical bounds with the
|
|
1517
|
+
// maximum zoom level possible.
|
|
1215
1518
|
fitBounds: function(t, e) {
|
|
1216
1519
|
if (t = I(t), !t.isValid())
|
|
1217
1520
|
throw new Error("Bounds are not valid.");
|
|
1218
1521
|
var i = this._getBoundsCenterZoom(t, e);
|
|
1219
1522
|
return this.setView(i.center, i.zoom, e);
|
|
1220
1523
|
},
|
|
1524
|
+
// @method fitWorld(options?: fitBounds options): this
|
|
1525
|
+
// Sets a map view that mostly contains the whole world with the maximum
|
|
1526
|
+
// zoom level possible.
|
|
1221
1527
|
fitWorld: function(t) {
|
|
1222
1528
|
return this.fitBounds([[-90, -180], [90, 180]], t);
|
|
1223
1529
|
},
|
|
1530
|
+
// @method panTo(latlng: LatLng, options?: Pan options): this
|
|
1531
|
+
// Pans the map to a given center.
|
|
1224
1532
|
panTo: function(t, e) {
|
|
1225
1533
|
return this.setView(t, this._zoom, { pan: e });
|
|
1226
1534
|
},
|
|
1535
|
+
// @method panBy(offset: Point, options?: Pan options): this
|
|
1536
|
+
// Pans the map by a given number of pixels (animated).
|
|
1227
1537
|
panBy: function(t, e) {
|
|
1228
1538
|
if (t = d(t).round(), e = e || {}, !t.x && !t.y)
|
|
1229
1539
|
return this.fire("moveend");
|
|
@@ -1240,6 +1550,9 @@ var mo = {
|
|
|
1240
1550
|
this._rawPanBy(t), this.fire("move").fire("moveend");
|
|
1241
1551
|
return this;
|
|
1242
1552
|
},
|
|
1553
|
+
// @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this
|
|
1554
|
+
// Sets the view of the map (geographical center and zoom) performing a smooth
|
|
1555
|
+
// pan-zoom animation.
|
|
1243
1556
|
flyTo: function(t, e, i) {
|
|
1244
1557
|
if (i = i || {}, i.animate === !1 || !c.any3d)
|
|
1245
1558
|
return this.setView(t, e, i);
|
|
@@ -1281,26 +1594,42 @@ var mo = {
|
|
|
1281
1594
|
}
|
|
1282
1595
|
return this._moveStart(!0, i.noMoveStart), qe.call(this), this;
|
|
1283
1596
|
},
|
|
1597
|
+
// @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this
|
|
1598
|
+
// Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),
|
|
1599
|
+
// but takes a bounds parameter like [`fitBounds`](#map-fitbounds).
|
|
1284
1600
|
flyToBounds: function(t, e) {
|
|
1285
1601
|
var i = this._getBoundsCenterZoom(t, e);
|
|
1286
1602
|
return this.flyTo(i.center, i.zoom, e);
|
|
1287
1603
|
},
|
|
1604
|
+
// @method setMaxBounds(bounds: LatLngBounds): this
|
|
1605
|
+
// Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).
|
|
1288
1606
|
setMaxBounds: function(t) {
|
|
1289
1607
|
return t = I(t), this.listens("moveend", this._panInsideMaxBounds) && this.off("moveend", this._panInsideMaxBounds), t.isValid() ? (this.options.maxBounds = t, this._loaded && this._panInsideMaxBounds(), this.on("moveend", this._panInsideMaxBounds)) : (this.options.maxBounds = null, this);
|
|
1290
1608
|
},
|
|
1609
|
+
// @method setMinZoom(zoom: Number): this
|
|
1610
|
+
// Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).
|
|
1291
1611
|
setMinZoom: function(t) {
|
|
1292
1612
|
var e = this.options.minZoom;
|
|
1293
1613
|
return this.options.minZoom = t, this._loaded && e !== t && (this.fire("zoomlevelschange"), this.getZoom() < this.options.minZoom) ? this.setZoom(t) : this;
|
|
1294
1614
|
},
|
|
1615
|
+
// @method setMaxZoom(zoom: Number): this
|
|
1616
|
+
// Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).
|
|
1295
1617
|
setMaxZoom: function(t) {
|
|
1296
1618
|
var e = this.options.maxZoom;
|
|
1297
1619
|
return this.options.maxZoom = t, this._loaded && e !== t && (this.fire("zoomlevelschange"), this.getZoom() > this.options.maxZoom) ? this.setZoom(t) : this;
|
|
1298
1620
|
},
|
|
1621
|
+
// @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this
|
|
1622
|
+
// Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
|
|
1299
1623
|
panInsideBounds: function(t, e) {
|
|
1300
1624
|
this._enforcingBounds = !0;
|
|
1301
1625
|
var i = this.getCenter(), n = this._limitCenter(i, this._zoom, I(t));
|
|
1302
1626
|
return i.equals(n) || this.panTo(n, e), this._enforcingBounds = !1, this;
|
|
1303
1627
|
},
|
|
1628
|
+
// @method panInside(latlng: LatLng, options?: padding options): this
|
|
1629
|
+
// Pans the map the minimum amount to make the `latlng` visible. Use
|
|
1630
|
+
// padding options to fit the display to more restricted bounds.
|
|
1631
|
+
// If `latlng` is already within the (optionally padded) display bounds,
|
|
1632
|
+
// the map will not be panned.
|
|
1304
1633
|
panInside: function(t, e) {
|
|
1305
1634
|
e = e || {};
|
|
1306
1635
|
var i = d(e.paddingTopLeft || e.padding || [0, 0]), n = d(e.paddingBottomRight || e.padding || [0, 0]), o = this.project(this.getCenter()), s = this.project(t), r = this.getPixelBounds(), a = N([r.min.add(i), r.max.subtract(n)]), h = a.getSize();
|
|
@@ -1311,6 +1640,18 @@ var mo = {
|
|
|
1311
1640
|
}
|
|
1312
1641
|
return this;
|
|
1313
1642
|
},
|
|
1643
|
+
// @method invalidateSize(options: Zoom/pan options): this
|
|
1644
|
+
// Checks if the map container size changed and updates the map if so —
|
|
1645
|
+
// call it after you've changed the map size dynamically, also animating
|
|
1646
|
+
// pan by default. If `options.pan` is `false`, panning will not occur.
|
|
1647
|
+
// If `options.debounceMoveend` is `true`, it will delay `moveend` event so
|
|
1648
|
+
// that it doesn't happen often even if the method is called many
|
|
1649
|
+
// times in a row.
|
|
1650
|
+
// @alternative
|
|
1651
|
+
// @method invalidateSize(animate: Boolean): this
|
|
1652
|
+
// Checks if the map container size changed and updates the map if so —
|
|
1653
|
+
// call it after you've changed the map size dynamically, also animating
|
|
1654
|
+
// pan by default.
|
|
1314
1655
|
invalidateSize: function(t) {
|
|
1315
1656
|
if (!this._loaded)
|
|
1316
1657
|
return this;
|
|
@@ -1326,13 +1667,29 @@ var mo = {
|
|
|
1326
1667
|
newSize: i
|
|
1327
1668
|
}));
|
|
1328
1669
|
},
|
|
1670
|
+
// @section Methods for modifying map state
|
|
1671
|
+
// @method stop(): this
|
|
1672
|
+
// Stops the currently running `panTo` or `flyTo` animation, if any.
|
|
1329
1673
|
stop: function() {
|
|
1330
1674
|
return this.setZoom(this._limitZoom(this._zoom)), this.options.zoomSnap || this.fire("viewreset"), this._stop();
|
|
1331
1675
|
},
|
|
1676
|
+
// @section Geolocation methods
|
|
1677
|
+
// @method locate(options?: Locate options): this
|
|
1678
|
+
// Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)
|
|
1679
|
+
// event with location data on success or a [`locationerror`](#map-locationerror) event on failure,
|
|
1680
|
+
// and optionally sets the map view to the user's location with respect to
|
|
1681
|
+
// detection accuracy (or to the world view if geolocation failed).
|
|
1682
|
+
// Note that, if your page doesn't use HTTPS, this method will fail in
|
|
1683
|
+
// modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))
|
|
1684
|
+
// See `Locate options` for more details.
|
|
1332
1685
|
locate: function(t) {
|
|
1333
1686
|
if (t = this._locateOptions = P({
|
|
1334
1687
|
timeout: 1e4,
|
|
1335
1688
|
watch: !1
|
|
1689
|
+
// setView: false
|
|
1690
|
+
// maxZoom: <Number>
|
|
1691
|
+
// maximumAge: 0
|
|
1692
|
+
// enableHighAccuracy: false
|
|
1336
1693
|
}, t), !("geolocation" in navigator))
|
|
1337
1694
|
return this._handleGeolocationError({
|
|
1338
1695
|
code: 0,
|
|
@@ -1341,6 +1698,10 @@ var mo = {
|
|
|
1341
1698
|
var e = M(this._handleGeolocationResponse, this), i = M(this._handleGeolocationError, this);
|
|
1342
1699
|
return t.watch ? this._locationWatchId = navigator.geolocation.watchPosition(e, i, t) : navigator.geolocation.getCurrentPosition(e, i, t), this;
|
|
1343
1700
|
},
|
|
1701
|
+
// @method stopLocate(): this
|
|
1702
|
+
// Stops watching location previously initiated by `map.locate({watch: true})`
|
|
1703
|
+
// and aborts resetting the map view if map.locate was called with
|
|
1704
|
+
// `{setView: true}`.
|
|
1344
1705
|
stopLocate: function() {
|
|
1345
1706
|
return navigator.geolocation && navigator.geolocation.clearWatch && navigator.geolocation.clearWatch(this._locationWatchId), this._locateOptions && (this._locateOptions.setView = !1), this;
|
|
1346
1707
|
},
|
|
@@ -1370,12 +1731,18 @@ var mo = {
|
|
|
1370
1731
|
this.fire("locationfound", a);
|
|
1371
1732
|
}
|
|
1372
1733
|
},
|
|
1734
|
+
// TODO Appropriate docs section?
|
|
1735
|
+
// @section Other Methods
|
|
1736
|
+
// @method addHandler(name: String, HandlerClass: Function): this
|
|
1737
|
+
// Adds a new `Handler` to the map, given its name and constructor function.
|
|
1373
1738
|
addHandler: function(t, e) {
|
|
1374
1739
|
if (!e)
|
|
1375
1740
|
return this;
|
|
1376
1741
|
var i = this[t] = new e(this);
|
|
1377
1742
|
return this._handlers.push(i), this.options[t] && i.enable(), this;
|
|
1378
1743
|
},
|
|
1744
|
+
// @method remove(): this
|
|
1745
|
+
// Destroys the map and clears all related event listeners.
|
|
1379
1746
|
remove: function() {
|
|
1380
1747
|
if (this._initEvents(!0), this.options.maxBounds && this.off("moveend", this._panInsideMaxBounds), this._containerId !== this._container._leaflet_id)
|
|
1381
1748
|
throw new Error("Map container is being reused by another instance");
|
|
@@ -1392,111 +1759,212 @@ var mo = {
|
|
|
1392
1759
|
C(this._panes[t]);
|
|
1393
1760
|
return this._layers = [], this._panes = [], delete this._mapPane, delete this._renderer, this;
|
|
1394
1761
|
},
|
|
1762
|
+
// @section Other Methods
|
|
1763
|
+
// @method createPane(name: String, container?: HTMLElement): HTMLElement
|
|
1764
|
+
// Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,
|
|
1765
|
+
// then returns it. The pane is created as a child of `container`, or
|
|
1766
|
+
// as a child of the main map pane if not set.
|
|
1395
1767
|
createPane: function(t, e) {
|
|
1396
1768
|
var i = "leaflet-pane" + (t ? " leaflet-" + t.replace("Pane", "") + "-pane" : ""), n = y("div", i, e || this._mapPane);
|
|
1397
1769
|
return t && (this._panes[t] = n), n;
|
|
1398
1770
|
},
|
|
1771
|
+
// @section Methods for Getting Map State
|
|
1772
|
+
// @method getCenter(): LatLng
|
|
1773
|
+
// Returns the geographical center of the map view
|
|
1399
1774
|
getCenter: function() {
|
|
1400
1775
|
return this._checkIfLoaded(), this._lastCenter && !this._moved() ? this._lastCenter.clone() : this.layerPointToLatLng(this._getCenterLayerPoint());
|
|
1401
1776
|
},
|
|
1777
|
+
// @method getZoom(): Number
|
|
1778
|
+
// Returns the current zoom level of the map view
|
|
1402
1779
|
getZoom: function() {
|
|
1403
1780
|
return this._zoom;
|
|
1404
1781
|
},
|
|
1782
|
+
// @method getBounds(): LatLngBounds
|
|
1783
|
+
// Returns the geographical bounds visible in the current map view
|
|
1405
1784
|
getBounds: function() {
|
|
1406
1785
|
var t = this.getPixelBounds(), e = this.unproject(t.getBottomLeft()), i = this.unproject(t.getTopRight());
|
|
1407
1786
|
return new R(e, i);
|
|
1408
1787
|
},
|
|
1788
|
+
// @method getMinZoom(): Number
|
|
1789
|
+
// Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default.
|
|
1409
1790
|
getMinZoom: function() {
|
|
1410
1791
|
return this.options.minZoom === void 0 ? this._layersMinZoom || 0 : this.options.minZoom;
|
|
1411
1792
|
},
|
|
1793
|
+
// @method getMaxZoom(): Number
|
|
1794
|
+
// Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).
|
|
1412
1795
|
getMaxZoom: function() {
|
|
1413
1796
|
return this.options.maxZoom === void 0 ? this._layersMaxZoom === void 0 ? 1 / 0 : this._layersMaxZoom : this.options.maxZoom;
|
|
1414
1797
|
},
|
|
1798
|
+
// @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number
|
|
1799
|
+
// Returns the maximum zoom level on which the given bounds fit to the map
|
|
1800
|
+
// view in its entirety. If `inside` (optional) is set to `true`, the method
|
|
1801
|
+
// instead returns the minimum zoom level on which the map view fits into
|
|
1802
|
+
// the given bounds in its entirety.
|
|
1415
1803
|
getBoundsZoom: function(t, e, i) {
|
|
1416
1804
|
t = I(t), i = d(i || [0, 0]);
|
|
1417
1805
|
var n = this.getZoom() || 0, o = this.getMinZoom(), s = this.getMaxZoom(), r = t.getNorthWest(), a = t.getSouthEast(), h = this.getSize().subtract(i), u = N(this.project(a, n), this.project(r, n)).getSize(), l = c.any3d ? this.options.zoomSnap : 1, f = h.x / u.x, v = h.y / u.y, H = e ? Math.max(f, v) : Math.min(f, v);
|
|
1418
1806
|
return n = this.getScaleZoom(H, n), l && (n = Math.round(n / (l / 100)) * (l / 100), n = e ? Math.ceil(n / l) * l : Math.floor(n / l) * l), Math.max(o, Math.min(s, n));
|
|
1419
1807
|
},
|
|
1808
|
+
// @method getSize(): Point
|
|
1809
|
+
// Returns the current size of the map container (in pixels).
|
|
1420
1810
|
getSize: function() {
|
|
1421
1811
|
return (!this._size || this._sizeChanged) && (this._size = new m(
|
|
1422
1812
|
this._container.clientWidth || 0,
|
|
1423
1813
|
this._container.clientHeight || 0
|
|
1424
1814
|
), this._sizeChanged = !1), this._size.clone();
|
|
1425
1815
|
},
|
|
1816
|
+
// @method getPixelBounds(): Bounds
|
|
1817
|
+
// Returns the bounds of the current map view in projected pixel
|
|
1818
|
+
// coordinates (sometimes useful in layer and overlay implementations).
|
|
1426
1819
|
getPixelBounds: function(t, e) {
|
|
1427
1820
|
var i = this._getTopLeftPoint(t, e);
|
|
1428
1821
|
return new S(i, i.add(this.getSize()));
|
|
1429
1822
|
},
|
|
1823
|
+
// TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to
|
|
1824
|
+
// the map pane? "left point of the map layer" can be confusing, specially
|
|
1825
|
+
// since there can be negative offsets.
|
|
1826
|
+
// @method getPixelOrigin(): Point
|
|
1827
|
+
// Returns the projected pixel coordinates of the top left point of
|
|
1828
|
+
// the map layer (useful in custom layer and overlay implementations).
|
|
1430
1829
|
getPixelOrigin: function() {
|
|
1431
1830
|
return this._checkIfLoaded(), this._pixelOrigin;
|
|
1432
1831
|
},
|
|
1832
|
+
// @method getPixelWorldBounds(zoom?: Number): Bounds
|
|
1833
|
+
// Returns the world's bounds in pixel coordinates for zoom level `zoom`.
|
|
1834
|
+
// If `zoom` is omitted, the map's current zoom level is used.
|
|
1433
1835
|
getPixelWorldBounds: function(t) {
|
|
1434
1836
|
return this.options.crs.getProjectedBounds(t === void 0 ? this.getZoom() : t);
|
|
1435
1837
|
},
|
|
1838
|
+
// @section Other Methods
|
|
1839
|
+
// @method getPane(pane: String|HTMLElement): HTMLElement
|
|
1840
|
+
// Returns a [map pane](#map-pane), given its name or its HTML element (its identity).
|
|
1436
1841
|
getPane: function(t) {
|
|
1437
1842
|
return typeof t == "string" ? this._panes[t] : t;
|
|
1438
1843
|
},
|
|
1844
|
+
// @method getPanes(): Object
|
|
1845
|
+
// Returns a plain object containing the names of all [panes](#map-pane) as keys and
|
|
1846
|
+
// the panes as values.
|
|
1439
1847
|
getPanes: function() {
|
|
1440
1848
|
return this._panes;
|
|
1441
1849
|
},
|
|
1850
|
+
// @method getContainer: HTMLElement
|
|
1851
|
+
// Returns the HTML element that contains the map.
|
|
1442
1852
|
getContainer: function() {
|
|
1443
1853
|
return this._container;
|
|
1444
1854
|
},
|
|
1855
|
+
// @section Conversion Methods
|
|
1856
|
+
// @method getZoomScale(toZoom: Number, fromZoom: Number): Number
|
|
1857
|
+
// Returns the scale factor to be applied to a map transition from zoom level
|
|
1858
|
+
// `fromZoom` to `toZoom`. Used internally to help with zoom animations.
|
|
1445
1859
|
getZoomScale: function(t, e) {
|
|
1446
1860
|
var i = this.options.crs;
|
|
1447
1861
|
return e = e === void 0 ? this._zoom : e, i.scale(t) / i.scale(e);
|
|
1448
1862
|
},
|
|
1863
|
+
// @method getScaleZoom(scale: Number, fromZoom: Number): Number
|
|
1864
|
+
// Returns the zoom level that the map would end up at, if it is at `fromZoom`
|
|
1865
|
+
// level and everything is scaled by a factor of `scale`. Inverse of
|
|
1866
|
+
// [`getZoomScale`](#map-getZoomScale).
|
|
1449
1867
|
getScaleZoom: function(t, e) {
|
|
1450
1868
|
var i = this.options.crs;
|
|
1451
1869
|
e = e === void 0 ? this._zoom : e;
|
|
1452
1870
|
var n = i.zoom(t * i.scale(e));
|
|
1453
1871
|
return isNaN(n) ? 1 / 0 : n;
|
|
1454
1872
|
},
|
|
1873
|
+
// @method project(latlng: LatLng, zoom: Number): Point
|
|
1874
|
+
// Projects a geographical coordinate `LatLng` according to the projection
|
|
1875
|
+
// of the map's CRS, then scales it according to `zoom` and the CRS's
|
|
1876
|
+
// `Transformation`. The result is pixel coordinate relative to
|
|
1877
|
+
// the CRS origin.
|
|
1455
1878
|
project: function(t, e) {
|
|
1456
1879
|
return e = e === void 0 ? this._zoom : e, this.options.crs.latLngToPoint(b(t), e);
|
|
1457
1880
|
},
|
|
1881
|
+
// @method unproject(point: Point, zoom: Number): LatLng
|
|
1882
|
+
// Inverse of [`project`](#map-project).
|
|
1458
1883
|
unproject: function(t, e) {
|
|
1459
1884
|
return e = e === void 0 ? this._zoom : e, this.options.crs.pointToLatLng(d(t), e);
|
|
1460
1885
|
},
|
|
1886
|
+
// @method layerPointToLatLng(point: Point): LatLng
|
|
1887
|
+
// Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
|
|
1888
|
+
// returns the corresponding geographical coordinate (for the current zoom level).
|
|
1461
1889
|
layerPointToLatLng: function(t) {
|
|
1462
1890
|
var e = d(t).add(this.getPixelOrigin());
|
|
1463
1891
|
return this.unproject(e);
|
|
1464
1892
|
},
|
|
1893
|
+
// @method latLngToLayerPoint(latlng: LatLng): Point
|
|
1894
|
+
// Given a geographical coordinate, returns the corresponding pixel coordinate
|
|
1895
|
+
// relative to the [origin pixel](#map-getpixelorigin).
|
|
1465
1896
|
latLngToLayerPoint: function(t) {
|
|
1466
1897
|
var e = this.project(b(t))._round();
|
|
1467
1898
|
return e._subtract(this.getPixelOrigin());
|
|
1468
1899
|
},
|
|
1900
|
+
// @method wrapLatLng(latlng: LatLng): LatLng
|
|
1901
|
+
// Returns a `LatLng` where `lat` and `lng` has been wrapped according to the
|
|
1902
|
+
// map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the
|
|
1903
|
+
// CRS's bounds.
|
|
1904
|
+
// By default this means longitude is wrapped around the dateline so its
|
|
1905
|
+
// value is between -180 and +180 degrees.
|
|
1469
1906
|
wrapLatLng: function(t) {
|
|
1470
1907
|
return this.options.crs.wrapLatLng(b(t));
|
|
1471
1908
|
},
|
|
1909
|
+
// @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds
|
|
1910
|
+
// Returns a `LatLngBounds` with the same size as the given one, ensuring that
|
|
1911
|
+
// its center is within the CRS's bounds.
|
|
1912
|
+
// By default this means the center longitude is wrapped around the dateline so its
|
|
1913
|
+
// value is between -180 and +180 degrees, and the majority of the bounds
|
|
1914
|
+
// overlaps the CRS's bounds.
|
|
1472
1915
|
wrapLatLngBounds: function(t) {
|
|
1473
1916
|
return this.options.crs.wrapLatLngBounds(I(t));
|
|
1474
1917
|
},
|
|
1918
|
+
// @method distance(latlng1: LatLng, latlng2: LatLng): Number
|
|
1919
|
+
// Returns the distance between two geographical coordinates according to
|
|
1920
|
+
// the map's CRS. By default this measures distance in meters.
|
|
1475
1921
|
distance: function(t, e) {
|
|
1476
1922
|
return this.options.crs.distance(b(t), b(e));
|
|
1477
1923
|
},
|
|
1924
|
+
// @method containerPointToLayerPoint(point: Point): Point
|
|
1925
|
+
// Given a pixel coordinate relative to the map container, returns the corresponding
|
|
1926
|
+
// pixel coordinate relative to the [origin pixel](#map-getpixelorigin).
|
|
1478
1927
|
containerPointToLayerPoint: function(t) {
|
|
1479
1928
|
return d(t).subtract(this._getMapPanePos());
|
|
1480
1929
|
},
|
|
1930
|
+
// @method layerPointToContainerPoint(point: Point): Point
|
|
1931
|
+
// Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
|
|
1932
|
+
// returns the corresponding pixel coordinate relative to the map container.
|
|
1481
1933
|
layerPointToContainerPoint: function(t) {
|
|
1482
1934
|
return d(t).add(this._getMapPanePos());
|
|
1483
1935
|
},
|
|
1936
|
+
// @method containerPointToLatLng(point: Point): LatLng
|
|
1937
|
+
// Given a pixel coordinate relative to the map container, returns
|
|
1938
|
+
// the corresponding geographical coordinate (for the current zoom level).
|
|
1484
1939
|
containerPointToLatLng: function(t) {
|
|
1485
1940
|
var e = this.containerPointToLayerPoint(d(t));
|
|
1486
1941
|
return this.layerPointToLatLng(e);
|
|
1487
1942
|
},
|
|
1943
|
+
// @method latLngToContainerPoint(latlng: LatLng): Point
|
|
1944
|
+
// Given a geographical coordinate, returns the corresponding pixel coordinate
|
|
1945
|
+
// relative to the map container.
|
|
1488
1946
|
latLngToContainerPoint: function(t) {
|
|
1489
1947
|
return this.layerPointToContainerPoint(this.latLngToLayerPoint(b(t)));
|
|
1490
1948
|
},
|
|
1949
|
+
// @method mouseEventToContainerPoint(ev: MouseEvent): Point
|
|
1950
|
+
// Given a MouseEvent object, returns the pixel coordinate relative to the
|
|
1951
|
+
// map container where the event took place.
|
|
1491
1952
|
mouseEventToContainerPoint: function(t) {
|
|
1492
1953
|
return Ei(t, this._container);
|
|
1493
1954
|
},
|
|
1955
|
+
// @method mouseEventToLayerPoint(ev: MouseEvent): Point
|
|
1956
|
+
// Given a MouseEvent object, returns the pixel coordinate relative to
|
|
1957
|
+
// the [origin pixel](#map-getpixelorigin) where the event took place.
|
|
1494
1958
|
mouseEventToLayerPoint: function(t) {
|
|
1495
1959
|
return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t));
|
|
1496
1960
|
},
|
|
1961
|
+
// @method mouseEventToLatLng(ev: MouseEvent): LatLng
|
|
1962
|
+
// Given a MouseEvent object, returns geographical coordinate where the
|
|
1963
|
+
// event took place.
|
|
1497
1964
|
mouseEventToLatLng: function(t) {
|
|
1498
1965
|
return this.layerPointToLatLng(this.mouseEventToLayerPoint(t));
|
|
1499
1966
|
},
|
|
1967
|
+
// map initialization methods
|
|
1500
1968
|
_initContainer: function(t) {
|
|
1501
1969
|
var e = this._container = Si(t);
|
|
1502
1970
|
if (e) {
|
|
@@ -1516,6 +1984,8 @@ var mo = {
|
|
|
1516
1984
|
var t = this._panes = {};
|
|
1517
1985
|
this._paneRenderers = {}, this._mapPane = this.createPane("mapPane", this._container), O(this._mapPane, new m(0, 0)), this.createPane("tilePane"), this.createPane("overlayPane"), this.createPane("shadowPane"), this.createPane("markerPane"), this.createPane("tooltipPane"), this.createPane("popupPane"), this.options.markerZoomAnimation || (p(t.markerPane, "leaflet-zoom-hide"), p(t.shadowPane, "leaflet-zoom-hide"));
|
|
1518
1986
|
},
|
|
1987
|
+
// private methods that modify map state
|
|
1988
|
+
// @section Map state change events
|
|
1519
1989
|
_resetView: function(t, e, i) {
|
|
1520
1990
|
O(this._mapPane, new m(0, 0));
|
|
1521
1991
|
var n = !this._loaded;
|
|
@@ -1550,6 +2020,8 @@ var mo = {
|
|
|
1550
2020
|
if (!this._loaded)
|
|
1551
2021
|
throw new Error("Set map center and zoom first.");
|
|
1552
2022
|
},
|
|
2023
|
+
// DOM event handling
|
|
2024
|
+
// @section Interaction events
|
|
1553
2025
|
_initEvents: function(t) {
|
|
1554
2026
|
this._targets = {}, this._targets[x(this._container)] = this;
|
|
1555
2027
|
var e = t ? T : _;
|
|
@@ -1629,9 +2101,15 @@ var mo = {
|
|
|
1629
2101
|
for (var t = 0, e = this._handlers.length; t < e; t++)
|
|
1630
2102
|
this._handlers[t].disable();
|
|
1631
2103
|
},
|
|
2104
|
+
// @section Other Methods
|
|
2105
|
+
// @method whenReady(fn: Function, context?: Object): this
|
|
2106
|
+
// Runs the given function `fn` when the map gets initialized with
|
|
2107
|
+
// a view (center and zoom) and at least one layer, or immediately
|
|
2108
|
+
// if it's already initialized, optionally passing a function context.
|
|
1632
2109
|
whenReady: function(t, e) {
|
|
1633
2110
|
return this._loaded ? t.call(e || this, { target: this }) : this.on("load", t, e), this;
|
|
1634
2111
|
},
|
|
2112
|
+
// private methods for getting map state
|
|
1635
2113
|
_getMapPanePos: function() {
|
|
1636
2114
|
return ft(this._mapPane) || new m(0, 0);
|
|
1637
2115
|
},
|
|
@@ -1660,24 +2138,29 @@ var mo = {
|
|
|
1660
2138
|
this.project(t.getNorthEast(), e)._subtract(n)
|
|
1661
2139
|
]);
|
|
1662
2140
|
},
|
|
2141
|
+
// layer point of the current center
|
|
1663
2142
|
_getCenterLayerPoint: function() {
|
|
1664
2143
|
return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
|
|
1665
2144
|
},
|
|
2145
|
+
// offset of the specified place to the current center in pixels
|
|
1666
2146
|
_getCenterOffset: function(t) {
|
|
1667
2147
|
return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint());
|
|
1668
2148
|
},
|
|
2149
|
+
// adjust center for view to get inside bounds
|
|
1669
2150
|
_limitCenter: function(t, e, i) {
|
|
1670
2151
|
if (!i)
|
|
1671
2152
|
return t;
|
|
1672
2153
|
var n = this.project(t, e), o = this.getSize().divideBy(2), s = new S(n.subtract(o), n.add(o)), r = this._getBoundsOffset(s, i, e);
|
|
1673
2154
|
return Math.abs(r.x) <= 1 && Math.abs(r.y) <= 1 ? t : this.unproject(n.add(r), e);
|
|
1674
2155
|
},
|
|
2156
|
+
// adjust offset for view to get inside bounds
|
|
1675
2157
|
_limitOffset: function(t, e) {
|
|
1676
2158
|
if (!e)
|
|
1677
2159
|
return t;
|
|
1678
2160
|
var i = this.getPixelBounds(), n = new S(i.min.add(t), i.max.add(t));
|
|
1679
2161
|
return t.add(this._getBoundsOffset(n, e));
|
|
1680
2162
|
},
|
|
2163
|
+
// returns offset needed for pxBounds to get inside maxBounds at a specified zoom
|
|
1681
2164
|
_getBoundsOffset: function(t, e, i) {
|
|
1682
2165
|
var n = N(
|
|
1683
2166
|
this.project(e.getNorthEast(), i),
|
|
@@ -1747,27 +2230,46 @@ function po(t, e) {
|
|
|
1747
2230
|
return new g(t, e);
|
|
1748
2231
|
}
|
|
1749
2232
|
var K = nt.extend({
|
|
2233
|
+
// @section
|
|
2234
|
+
// @aka Control Options
|
|
1750
2235
|
options: {
|
|
2236
|
+
// @option position: String = 'topright'
|
|
2237
|
+
// The position of the control (one of the map corners). Possible values are `'topleft'`,
|
|
2238
|
+
// `'topright'`, `'bottomleft'` or `'bottomright'`
|
|
1751
2239
|
position: "topright"
|
|
1752
2240
|
},
|
|
1753
2241
|
initialize: function(t) {
|
|
1754
2242
|
z(this, t);
|
|
1755
2243
|
},
|
|
2244
|
+
/* @section
|
|
2245
|
+
* Classes extending L.Control will inherit the following methods:
|
|
2246
|
+
*
|
|
2247
|
+
* @method getPosition: string
|
|
2248
|
+
* Returns the position of the control.
|
|
2249
|
+
*/
|
|
1756
2250
|
getPosition: function() {
|
|
1757
2251
|
return this.options.position;
|
|
1758
2252
|
},
|
|
2253
|
+
// @method setPosition(position: string): this
|
|
2254
|
+
// Sets the position of the control.
|
|
1759
2255
|
setPosition: function(t) {
|
|
1760
2256
|
var e = this._map;
|
|
1761
2257
|
return e && e.removeControl(this), this.options.position = t, e && e.addControl(this), this;
|
|
1762
2258
|
},
|
|
2259
|
+
// @method getContainer: HTMLElement
|
|
2260
|
+
// Returns the HTMLElement that contains the control.
|
|
1763
2261
|
getContainer: function() {
|
|
1764
2262
|
return this._container;
|
|
1765
2263
|
},
|
|
2264
|
+
// @method addTo(map: Map): this
|
|
2265
|
+
// Adds the control to the given map.
|
|
1766
2266
|
addTo: function(t) {
|
|
1767
2267
|
this.remove(), this._map = t;
|
|
1768
2268
|
var e = this._container = this.onAdd(t), i = this.getPosition(), n = t._controlCorners[i];
|
|
1769
2269
|
return p(e, "leaflet-control"), i.indexOf("bottom") !== -1 ? n.insertBefore(e, n.firstChild) : n.appendChild(e), this._map.on("unload", this.remove, this), this;
|
|
1770
2270
|
},
|
|
2271
|
+
// @method remove: this
|
|
2272
|
+
// Removes the control from the map it is currently active on.
|
|
1771
2273
|
remove: function() {
|
|
1772
2274
|
return this._map ? (C(this._container), this.onRemove && this.onRemove(this._map), this._map.off("unload", this.remove, this), this._map = null, this) : this;
|
|
1773
2275
|
},
|
|
@@ -1778,9 +2280,13 @@ var K = nt.extend({
|
|
|
1778
2280
|
return new K(t);
|
|
1779
2281
|
};
|
|
1780
2282
|
g.include({
|
|
2283
|
+
// @method addControl(control: Control): this
|
|
2284
|
+
// Adds the given control to the map
|
|
1781
2285
|
addControl: function(t) {
|
|
1782
2286
|
return t.addTo(this), this;
|
|
1783
2287
|
},
|
|
2288
|
+
// @method removeControl(control: Control): this
|
|
2289
|
+
// Removes the given control from the map
|
|
1784
2290
|
removeControl: function(t) {
|
|
1785
2291
|
return t.remove(), this;
|
|
1786
2292
|
},
|
|
@@ -1799,12 +2305,29 @@ g.include({
|
|
|
1799
2305
|
}
|
|
1800
2306
|
});
|
|
1801
2307
|
var Ii = K.extend({
|
|
2308
|
+
// @section
|
|
2309
|
+
// @aka Control.Layers options
|
|
1802
2310
|
options: {
|
|
2311
|
+
// @option collapsed: Boolean = true
|
|
2312
|
+
// If `true`, the control will be collapsed into an icon and expanded on mouse hover, touch, or keyboard activation.
|
|
1803
2313
|
collapsed: !0,
|
|
1804
2314
|
position: "topright",
|
|
2315
|
+
// @option autoZIndex: Boolean = true
|
|
2316
|
+
// If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
|
|
1805
2317
|
autoZIndex: !0,
|
|
2318
|
+
// @option hideSingleBase: Boolean = false
|
|
2319
|
+
// If `true`, the base layers in the control will be hidden when there is only one.
|
|
1806
2320
|
hideSingleBase: !1,
|
|
2321
|
+
// @option sortLayers: Boolean = false
|
|
2322
|
+
// Whether to sort the layers. When `false`, layers will keep the order
|
|
2323
|
+
// in which they were added to the control.
|
|
1807
2324
|
sortLayers: !1,
|
|
2325
|
+
// @option sortFunction: Function = *
|
|
2326
|
+
// A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
|
|
2327
|
+
// that will be used for sorting the layers, when `sortLayers` is `true`.
|
|
2328
|
+
// The function receives both the `L.Layer` instances and their names, as in
|
|
2329
|
+
// `sortFunction(layerA, layerB, nameA, nameB)`.
|
|
2330
|
+
// By default, it sorts layers alphabetically by their name.
|
|
1808
2331
|
sortFunction: function(t, e, i, n) {
|
|
1809
2332
|
return i < n ? -1 : n < i ? 1 : 0;
|
|
1810
2333
|
}
|
|
@@ -1830,22 +2353,32 @@ var Ii = K.extend({
|
|
|
1830
2353
|
for (var t = 0; t < this._layers.length; t++)
|
|
1831
2354
|
this._layers[t].layer.off("add remove", this._onLayerChange, this);
|
|
1832
2355
|
},
|
|
2356
|
+
// @method addBaseLayer(layer: Layer, name: String): this
|
|
2357
|
+
// Adds a base layer (radio button entry) with the given name to the control.
|
|
1833
2358
|
addBaseLayer: function(t, e) {
|
|
1834
2359
|
return this._addLayer(t, e), this._map ? this._update() : this;
|
|
1835
2360
|
},
|
|
2361
|
+
// @method addOverlay(layer: Layer, name: String): this
|
|
2362
|
+
// Adds an overlay (checkbox entry) with the given name to the control.
|
|
1836
2363
|
addOverlay: function(t, e) {
|
|
1837
2364
|
return this._addLayer(t, e, !0), this._map ? this._update() : this;
|
|
1838
2365
|
},
|
|
2366
|
+
// @method removeLayer(layer: Layer): this
|
|
2367
|
+
// Remove the given layer from the control.
|
|
1839
2368
|
removeLayer: function(t) {
|
|
1840
2369
|
t.off("add remove", this._onLayerChange, this);
|
|
1841
2370
|
var e = this._getLayer(x(t));
|
|
1842
2371
|
return e && this._layers.splice(this._layers.indexOf(e), 1), this._map ? this._update() : this;
|
|
1843
2372
|
},
|
|
2373
|
+
// @method expand(): this
|
|
2374
|
+
// Expand the control container if collapsed.
|
|
1844
2375
|
expand: function() {
|
|
1845
2376
|
p(this._container, "leaflet-control-layers-expanded"), this._section.style.height = null;
|
|
1846
2377
|
var t = this._map.getSize().y - (this._container.offsetTop + 50);
|
|
1847
2378
|
return t < this._section.clientHeight ? (p(this._section, "leaflet-control-layers-scrollbar"), this._section.style.height = t + "px") : Z(this._section, "leaflet-control-layers-scrollbar"), this._checkDisabledLayers(), this;
|
|
1848
2379
|
},
|
|
2380
|
+
// @method collapse(): this
|
|
2381
|
+
// Collapse the control container if expanded.
|
|
1849
2382
|
collapse: function() {
|
|
1850
2383
|
return Z(this._container, "leaflet-control-layers-expanded"), this;
|
|
1851
2384
|
},
|
|
@@ -1862,6 +2395,7 @@ var Ii = K.extend({
|
|
|
1862
2395
|
keydown: function(s) {
|
|
1863
2396
|
s.keyCode === 13 && this._expandSafely();
|
|
1864
2397
|
},
|
|
2398
|
+
// Certain screen readers intercept the key event and instead send a click event
|
|
1865
2399
|
click: function(s) {
|
|
1866
2400
|
A(s), this._expandSafely();
|
|
1867
2401
|
}
|
|
@@ -1895,6 +2429,7 @@ var Ii = K.extend({
|
|
|
1895
2429
|
var e = this._getLayer(x(t.target)), i = e.overlay ? t.type === "add" ? "overlayadd" : "overlayremove" : t.type === "add" ? "baselayerchange" : null;
|
|
1896
2430
|
i && this._map.fire(i, e);
|
|
1897
2431
|
},
|
|
2432
|
+
// IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see https://stackoverflow.com/a/119079)
|
|
1898
2433
|
_createRadioElement: function(t, e) {
|
|
1899
2434
|
var i = '<input type="radio" class="leaflet-control-layers-selector" name="' + t + '"' + (e ? ' checked="checked"' : "") + "/>", n = document.createElement("div");
|
|
1900
2435
|
return n.innerHTML = i, n.firstChild;
|
|
@@ -1936,11 +2471,21 @@ var Ii = K.extend({
|
|
|
1936
2471
|
}), Wn = function(t, e, i) {
|
|
1937
2472
|
return new Ii(t, e, i);
|
|
1938
2473
|
}, Ee = K.extend({
|
|
2474
|
+
// @section
|
|
2475
|
+
// @aka Control.Zoom options
|
|
1939
2476
|
options: {
|
|
1940
2477
|
position: "topleft",
|
|
2478
|
+
// @option zoomInText: String = '<span aria-hidden="true">+</span>'
|
|
2479
|
+
// The text set on the 'zoom in' button.
|
|
1941
2480
|
zoomInText: '<span aria-hidden="true">+</span>',
|
|
2481
|
+
// @option zoomInTitle: String = 'Zoom in'
|
|
2482
|
+
// The title set on the 'zoom in' button.
|
|
1942
2483
|
zoomInTitle: "Zoom in",
|
|
2484
|
+
// @option zoomOutText: String = '<span aria-hidden="true">−</span>'
|
|
2485
|
+
// The text set on the 'zoom out' button.
|
|
1943
2486
|
zoomOutText: '<span aria-hidden="true">−</span>',
|
|
2487
|
+
// @option zoomOutTitle: String = 'Zoom out'
|
|
2488
|
+
// The title set on the 'zoom out' button.
|
|
1944
2489
|
zoomOutTitle: "Zoom out"
|
|
1945
2490
|
},
|
|
1946
2491
|
onAdd: function(t) {
|
|
@@ -1992,11 +2537,21 @@ g.addInitHook(function() {
|
|
|
1992
2537
|
var Un = function(t) {
|
|
1993
2538
|
return new Ee(t);
|
|
1994
2539
|
}, Ai = K.extend({
|
|
2540
|
+
// @section
|
|
2541
|
+
// @aka Control.Scale options
|
|
1995
2542
|
options: {
|
|
1996
2543
|
position: "bottomleft",
|
|
2544
|
+
// @option maxWidth: Number = 100
|
|
2545
|
+
// Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
|
|
1997
2546
|
maxWidth: 100,
|
|
2547
|
+
// @option metric: Boolean = True
|
|
2548
|
+
// Whether to show the metric scale line (m/km).
|
|
1998
2549
|
metric: !0,
|
|
2550
|
+
// @option imperial: Boolean = True
|
|
2551
|
+
// Whether to show the imperial scale line (mi/ft).
|
|
1999
2552
|
imperial: !0
|
|
2553
|
+
// @option updateWhenIdle: Boolean = false
|
|
2554
|
+
// If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)).
|
|
2000
2555
|
},
|
|
2001
2556
|
onAdd: function(t) {
|
|
2002
2557
|
var e = "leaflet-control-scale", i = y("div", e), n = this.options;
|
|
@@ -2036,8 +2591,12 @@ var Un = function(t) {
|
|
|
2036
2591
|
}), qn = function(t) {
|
|
2037
2592
|
return new Ai(t);
|
|
2038
2593
|
}, Vn = '<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>', Oe = K.extend({
|
|
2594
|
+
// @section
|
|
2595
|
+
// @aka Control.Attribution options
|
|
2039
2596
|
options: {
|
|
2040
2597
|
position: "bottomright",
|
|
2598
|
+
// @option prefix: String|false = 'Leaflet'
|
|
2599
|
+
// The HTML text shown before the attributions. Pass `false` to disable.
|
|
2041
2600
|
prefix: '<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">' + (c.inlineSvg ? Vn + " " : "") + "Leaflet</a>"
|
|
2042
2601
|
},
|
|
2043
2602
|
initialize: function(t) {
|
|
@@ -2057,12 +2616,18 @@ var Un = function(t) {
|
|
|
2057
2616
|
this.removeAttribution(t.layer.getAttribution());
|
|
2058
2617
|
}, this));
|
|
2059
2618
|
},
|
|
2619
|
+
// @method setPrefix(prefix: String|false): this
|
|
2620
|
+
// The HTML text shown before the attributions. Pass `false` to disable.
|
|
2060
2621
|
setPrefix: function(t) {
|
|
2061
2622
|
return this.options.prefix = t, this._update(), this;
|
|
2062
2623
|
},
|
|
2624
|
+
// @method addAttribution(text: String): this
|
|
2625
|
+
// Adds an attribution text (e.g. `'© OpenStreetMap contributors'`).
|
|
2063
2626
|
addAttribution: function(t) {
|
|
2064
2627
|
return t ? (this._attributions[t] || (this._attributions[t] = 0), this._attributions[t]++, this._update(), this) : this;
|
|
2065
2628
|
},
|
|
2629
|
+
// @method removeAttribution(text: String): this
|
|
2630
|
+
// Removes an attribution text.
|
|
2066
2631
|
removeAttribution: function(t) {
|
|
2067
2632
|
return t ? (this._attributions[t] && (this._attributions[t]--, this._update()), this) : this;
|
|
2068
2633
|
},
|
|
@@ -2097,29 +2662,52 @@ var J = nt.extend({
|
|
|
2097
2662
|
initialize: function(t) {
|
|
2098
2663
|
this._map = t;
|
|
2099
2664
|
},
|
|
2665
|
+
// @method enable(): this
|
|
2666
|
+
// Enables the handler
|
|
2100
2667
|
enable: function() {
|
|
2101
2668
|
return this._enabled ? this : (this._enabled = !0, this.addHooks(), this);
|
|
2102
2669
|
},
|
|
2670
|
+
// @method disable(): this
|
|
2671
|
+
// Disables the handler
|
|
2103
2672
|
disable: function() {
|
|
2104
2673
|
return this._enabled ? (this._enabled = !1, this.removeHooks(), this) : this;
|
|
2105
2674
|
},
|
|
2675
|
+
// @method enabled(): Boolean
|
|
2676
|
+
// Returns `true` if the handler is enabled
|
|
2106
2677
|
enabled: function() {
|
|
2107
2678
|
return !!this._enabled;
|
|
2108
2679
|
}
|
|
2680
|
+
// @section Extension methods
|
|
2681
|
+
// Classes inheriting from `Handler` must implement the two following methods:
|
|
2682
|
+
// @method addHooks()
|
|
2683
|
+
// Called when the handler is enabled, should add event hooks.
|
|
2684
|
+
// @method removeHooks()
|
|
2685
|
+
// Called when the handler is disabled, should remove the event hooks added previously.
|
|
2109
2686
|
});
|
|
2110
2687
|
J.addTo = function(t, e) {
|
|
2111
2688
|
return t.addHandler(e, this), this;
|
|
2112
2689
|
};
|
|
2113
2690
|
var vo = { Events: D }, Qe = c.touch ? "touchstart mousedown" : "mousedown", at = jt.extend({
|
|
2114
2691
|
options: {
|
|
2692
|
+
// @section
|
|
2693
|
+
// @aka Draggable options
|
|
2694
|
+
// @option clickTolerance: Number = 3
|
|
2695
|
+
// The max number of pixels a user can shift the mouse pointer during a click
|
|
2696
|
+
// for it to be considered a valid click (as opposed to a mouse drag).
|
|
2115
2697
|
clickTolerance: 3
|
|
2116
2698
|
},
|
|
2699
|
+
// @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)
|
|
2700
|
+
// Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).
|
|
2117
2701
|
initialize: function(t, e, i, n) {
|
|
2118
2702
|
z(this, n), this._element = t, this._dragStartTarget = e || t, this._preventOutline = i;
|
|
2119
2703
|
},
|
|
2704
|
+
// @method enable()
|
|
2705
|
+
// Enables the dragging ability
|
|
2120
2706
|
enable: function() {
|
|
2121
2707
|
this._enabled || (_(this._dragStartTarget, Qe, this._onDown, this), this._enabled = !0);
|
|
2122
2708
|
},
|
|
2709
|
+
// @method disable()
|
|
2710
|
+
// Disables the dragging ability
|
|
2123
2711
|
disable: function() {
|
|
2124
2712
|
this._enabled && (at._dragging === this && this.finishDrag(!0), T(this._dragStartTarget, Qe, this._onDown, this), this._enabled = !1, this._moved = !1);
|
|
2125
2713
|
},
|
|
@@ -2350,20 +2938,41 @@ ot.EPSG900913 = ln;
|
|
|
2350
2938
|
ot.EPSG4326 = Ui;
|
|
2351
2939
|
ot.Simple = $n;
|
|
2352
2940
|
var Y = jt.extend({
|
|
2941
|
+
// Classes extending `L.Layer` will inherit the following options:
|
|
2353
2942
|
options: {
|
|
2943
|
+
// @option pane: String = 'overlayPane'
|
|
2944
|
+
// By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default.
|
|
2354
2945
|
pane: "overlayPane",
|
|
2946
|
+
// @option attribution: String = null
|
|
2947
|
+
// String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
|
|
2355
2948
|
attribution: null,
|
|
2356
2949
|
bubblingMouseEvents: !0
|
|
2357
2950
|
},
|
|
2951
|
+
/* @section
|
|
2952
|
+
* Classes extending `L.Layer` will inherit the following methods:
|
|
2953
|
+
*
|
|
2954
|
+
* @method addTo(map: Map|LayerGroup): this
|
|
2955
|
+
* Adds the layer to the given map or layer group.
|
|
2956
|
+
*/
|
|
2358
2957
|
addTo: function(t) {
|
|
2359
2958
|
return t.addLayer(this), this;
|
|
2360
2959
|
},
|
|
2960
|
+
// @method remove: this
|
|
2961
|
+
// Removes the layer from the map it is currently active on.
|
|
2361
2962
|
remove: function() {
|
|
2362
2963
|
return this.removeFrom(this._map || this._mapToAdd);
|
|
2363
2964
|
},
|
|
2965
|
+
// @method removeFrom(map: Map): this
|
|
2966
|
+
// Removes the layer from the given map
|
|
2967
|
+
//
|
|
2968
|
+
// @alternative
|
|
2969
|
+
// @method removeFrom(group: LayerGroup): this
|
|
2970
|
+
// Removes the layer from the given `LayerGroup`
|
|
2364
2971
|
removeFrom: function(t) {
|
|
2365
2972
|
return t && t.removeLayer(this), this;
|
|
2366
2973
|
},
|
|
2974
|
+
// @method getPane(name? : String): HTMLElement
|
|
2975
|
+
// Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer.
|
|
2367
2976
|
getPane: function(t) {
|
|
2368
2977
|
return this._map.getPane(t ? this.options[t] || t : this.options.pane);
|
|
2369
2978
|
},
|
|
@@ -2373,6 +2982,8 @@ var Y = jt.extend({
|
|
|
2373
2982
|
removeInteractiveTarget: function(t) {
|
|
2374
2983
|
return delete this._map._targets[x(t)], this;
|
|
2375
2984
|
},
|
|
2985
|
+
// @method getAttribution: String
|
|
2986
|
+
// Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).
|
|
2376
2987
|
getAttribution: function() {
|
|
2377
2988
|
return this.options.attribution;
|
|
2378
2989
|
},
|
|
@@ -2390,19 +3001,33 @@ var Y = jt.extend({
|
|
|
2390
3001
|
}
|
|
2391
3002
|
});
|
|
2392
3003
|
g.include({
|
|
3004
|
+
// @method addLayer(layer: Layer): this
|
|
3005
|
+
// Adds the given layer to the map
|
|
2393
3006
|
addLayer: function(t) {
|
|
2394
3007
|
if (!t._layerAdd)
|
|
2395
3008
|
throw new Error("The provided object is not a Layer.");
|
|
2396
3009
|
var e = x(t);
|
|
2397
3010
|
return this._layers[e] ? this : (this._layers[e] = t, t._mapToAdd = this, t.beforeAdd && t.beforeAdd(this), this.whenReady(t._layerAdd, t), this);
|
|
2398
3011
|
},
|
|
3012
|
+
// @method removeLayer(layer: Layer): this
|
|
3013
|
+
// Removes the given layer from the map.
|
|
2399
3014
|
removeLayer: function(t) {
|
|
2400
3015
|
var e = x(t);
|
|
2401
3016
|
return this._layers[e] ? (this._loaded && t.onRemove(this), delete this._layers[e], this._loaded && (this.fire("layerremove", { layer: t }), t.fire("remove")), t._map = t._mapToAdd = null, this) : this;
|
|
2402
3017
|
},
|
|
3018
|
+
// @method hasLayer(layer: Layer): Boolean
|
|
3019
|
+
// Returns `true` if the given layer is currently added to the map
|
|
2403
3020
|
hasLayer: function(t) {
|
|
2404
3021
|
return x(t) in this._layers;
|
|
2405
3022
|
},
|
|
3023
|
+
/* @method eachLayer(fn: Function, context?: Object): this
|
|
3024
|
+
* Iterates over the layers of the map, optionally specifying context of the iterator function.
|
|
3025
|
+
* ```
|
|
3026
|
+
* map.eachLayer(function(layer){
|
|
3027
|
+
* layer.bindPopup('Hello');
|
|
3028
|
+
* });
|
|
3029
|
+
* ```
|
|
3030
|
+
*/
|
|
2406
3031
|
eachLayer: function(t, e) {
|
|
2407
3032
|
for (var i in this._layers)
|
|
2408
3033
|
t.call(e, this._layers[i]);
|
|
@@ -2437,21 +3062,39 @@ var Pt = Y.extend({
|
|
|
2437
3062
|
for (i = 0, n = t.length; i < n; i++)
|
|
2438
3063
|
this.addLayer(t[i]);
|
|
2439
3064
|
},
|
|
3065
|
+
// @method addLayer(layer: Layer): this
|
|
3066
|
+
// Adds the given layer to the group.
|
|
2440
3067
|
addLayer: function(t) {
|
|
2441
3068
|
var e = this.getLayerId(t);
|
|
2442
3069
|
return this._layers[e] = t, this._map && this._map.addLayer(t), this;
|
|
2443
3070
|
},
|
|
3071
|
+
// @method removeLayer(layer: Layer): this
|
|
3072
|
+
// Removes the given layer from the group.
|
|
3073
|
+
// @alternative
|
|
3074
|
+
// @method removeLayer(id: Number): this
|
|
3075
|
+
// Removes the layer with the given internal ID from the group.
|
|
2444
3076
|
removeLayer: function(t) {
|
|
2445
3077
|
var e = t in this._layers ? t : this.getLayerId(t);
|
|
2446
3078
|
return this._map && this._layers[e] && this._map.removeLayer(this._layers[e]), delete this._layers[e], this;
|
|
2447
3079
|
},
|
|
3080
|
+
// @method hasLayer(layer: Layer): Boolean
|
|
3081
|
+
// Returns `true` if the given layer is currently added to the group.
|
|
3082
|
+
// @alternative
|
|
3083
|
+
// @method hasLayer(id: Number): Boolean
|
|
3084
|
+
// Returns `true` if the given internal ID is currently added to the group.
|
|
2448
3085
|
hasLayer: function(t) {
|
|
2449
3086
|
var e = typeof t == "number" ? t : this.getLayerId(t);
|
|
2450
3087
|
return e in this._layers;
|
|
2451
3088
|
},
|
|
3089
|
+
// @method clearLayers(): this
|
|
3090
|
+
// Removes all the layers from the group.
|
|
2452
3091
|
clearLayers: function() {
|
|
2453
3092
|
return this.eachLayer(this.removeLayer, this);
|
|
2454
3093
|
},
|
|
3094
|
+
// @method invoke(methodName: String, …): this
|
|
3095
|
+
// Calls `methodName` on every layer contained in this group, passing any
|
|
3096
|
+
// additional parameters. Has no effect if the layers contained do not
|
|
3097
|
+
// implement `methodName`.
|
|
2455
3098
|
invoke: function(t) {
|
|
2456
3099
|
var e = Array.prototype.slice.call(arguments, 1), i, n;
|
|
2457
3100
|
for (i in this._layers)
|
|
@@ -2464,21 +3107,36 @@ var Pt = Y.extend({
|
|
|
2464
3107
|
onRemove: function(t) {
|
|
2465
3108
|
this.eachLayer(t.removeLayer, t);
|
|
2466
3109
|
},
|
|
3110
|
+
// @method eachLayer(fn: Function, context?: Object): this
|
|
3111
|
+
// Iterates over the layers of the group, optionally specifying context of the iterator function.
|
|
3112
|
+
// ```js
|
|
3113
|
+
// group.eachLayer(function (layer) {
|
|
3114
|
+
// layer.bindPopup('Hello');
|
|
3115
|
+
// });
|
|
3116
|
+
// ```
|
|
2467
3117
|
eachLayer: function(t, e) {
|
|
2468
3118
|
for (var i in this._layers)
|
|
2469
3119
|
t.call(e, this._layers[i]);
|
|
2470
3120
|
return this;
|
|
2471
3121
|
},
|
|
3122
|
+
// @method getLayer(id: Number): Layer
|
|
3123
|
+
// Returns the layer with the given internal ID.
|
|
2472
3124
|
getLayer: function(t) {
|
|
2473
3125
|
return this._layers[t];
|
|
2474
3126
|
},
|
|
3127
|
+
// @method getLayers(): Layer[]
|
|
3128
|
+
// Returns an array of all the layers added to the group.
|
|
2475
3129
|
getLayers: function() {
|
|
2476
3130
|
var t = [];
|
|
2477
3131
|
return this.eachLayer(t.push, t), t;
|
|
2478
3132
|
},
|
|
3133
|
+
// @method setZIndex(zIndex: Number): this
|
|
3134
|
+
// Calls `setZIndex` on every layer contained in this group, passing the z-index.
|
|
2479
3135
|
setZIndex: function(t) {
|
|
2480
3136
|
return this.invoke("setZIndex", t);
|
|
2481
3137
|
},
|
|
3138
|
+
// @method getLayerId(layer: Layer): Number
|
|
3139
|
+
// Returns the internal ID for a layer
|
|
2482
3140
|
getLayerId: function(t) {
|
|
2483
3141
|
return x(t);
|
|
2484
3142
|
}
|
|
@@ -2491,15 +3149,23 @@ var Pt = Y.extend({
|
|
|
2491
3149
|
removeLayer: function(t) {
|
|
2492
3150
|
return this.hasLayer(t) ? (t in this._layers && (t = this._layers[t]), t.removeEventParent(this), Pt.prototype.removeLayer.call(this, t), this.fire("layerremove", { layer: t })) : this;
|
|
2493
3151
|
},
|
|
3152
|
+
// @method setStyle(style: Path options): this
|
|
3153
|
+
// Sets the given path options to each layer of the group that has a `setStyle` method.
|
|
2494
3154
|
setStyle: function(t) {
|
|
2495
3155
|
return this.invoke("setStyle", t);
|
|
2496
3156
|
},
|
|
3157
|
+
// @method bringToFront(): this
|
|
3158
|
+
// Brings the layer group to the top of all other layers
|
|
2497
3159
|
bringToFront: function() {
|
|
2498
3160
|
return this.invoke("bringToFront");
|
|
2499
3161
|
},
|
|
3162
|
+
// @method bringToBack(): this
|
|
3163
|
+
// Brings the layer group to the back of all other layers
|
|
2500
3164
|
bringToBack: function() {
|
|
2501
3165
|
return this.invoke("bringToBack");
|
|
2502
3166
|
},
|
|
3167
|
+
// @method getBounds(): LatLngBounds
|
|
3168
|
+
// Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
|
|
2503
3169
|
getBounds: function() {
|
|
2504
3170
|
var t = new R();
|
|
2505
3171
|
for (var e in this._layers) {
|
|
@@ -2511,17 +3177,65 @@ var Pt = Y.extend({
|
|
|
2511
3177
|
}), Po = function(t, e) {
|
|
2512
3178
|
return new et(t, e);
|
|
2513
3179
|
}, St = nt.extend({
|
|
3180
|
+
/* @section
|
|
3181
|
+
* @aka Icon options
|
|
3182
|
+
*
|
|
3183
|
+
* @option iconUrl: String = null
|
|
3184
|
+
* **(required)** The URL to the icon image (absolute or relative to your script path).
|
|
3185
|
+
*
|
|
3186
|
+
* @option iconRetinaUrl: String = null
|
|
3187
|
+
* The URL to a retina sized version of the icon image (absolute or relative to your
|
|
3188
|
+
* script path). Used for Retina screen devices.
|
|
3189
|
+
*
|
|
3190
|
+
* @option iconSize: Point = null
|
|
3191
|
+
* Size of the icon image in pixels.
|
|
3192
|
+
*
|
|
3193
|
+
* @option iconAnchor: Point = null
|
|
3194
|
+
* The coordinates of the "tip" of the icon (relative to its top left corner). The icon
|
|
3195
|
+
* will be aligned so that this point is at the marker's geographical location. Centered
|
|
3196
|
+
* by default if size is specified, also can be set in CSS with negative margins.
|
|
3197
|
+
*
|
|
3198
|
+
* @option popupAnchor: Point = [0, 0]
|
|
3199
|
+
* The coordinates of the point from which popups will "open", relative to the icon anchor.
|
|
3200
|
+
*
|
|
3201
|
+
* @option tooltipAnchor: Point = [0, 0]
|
|
3202
|
+
* The coordinates of the point from which tooltips will "open", relative to the icon anchor.
|
|
3203
|
+
*
|
|
3204
|
+
* @option shadowUrl: String = null
|
|
3205
|
+
* The URL to the icon shadow image. If not specified, no shadow image will be created.
|
|
3206
|
+
*
|
|
3207
|
+
* @option shadowRetinaUrl: String = null
|
|
3208
|
+
*
|
|
3209
|
+
* @option shadowSize: Point = null
|
|
3210
|
+
* Size of the shadow image in pixels.
|
|
3211
|
+
*
|
|
3212
|
+
* @option shadowAnchor: Point = null
|
|
3213
|
+
* The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
|
|
3214
|
+
* as iconAnchor if not specified).
|
|
3215
|
+
*
|
|
3216
|
+
* @option className: String = ''
|
|
3217
|
+
* A custom class name to assign to both icon and shadow images. Empty by default.
|
|
3218
|
+
*/
|
|
2514
3219
|
options: {
|
|
2515
3220
|
popupAnchor: [0, 0],
|
|
2516
3221
|
tooltipAnchor: [0, 0],
|
|
3222
|
+
// @option crossOrigin: Boolean|String = false
|
|
3223
|
+
// Whether the crossOrigin attribute will be added to the tiles.
|
|
3224
|
+
// If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
|
|
3225
|
+
// Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.
|
|
2517
3226
|
crossOrigin: !1
|
|
2518
3227
|
},
|
|
2519
3228
|
initialize: function(t) {
|
|
2520
3229
|
z(this, t);
|
|
2521
3230
|
},
|
|
3231
|
+
// @method createIcon(oldIcon?: HTMLElement): HTMLElement
|
|
3232
|
+
// Called internally when the icon has to be shown, returns a `<img>` HTML element
|
|
3233
|
+
// styled according to the options.
|
|
2522
3234
|
createIcon: function(t) {
|
|
2523
3235
|
return this._createIcon("icon", t);
|
|
2524
3236
|
},
|
|
3237
|
+
// @method createShadow(oldIcon?: HTMLElement): HTMLElement
|
|
3238
|
+
// As `createIcon`, but for the shadow beneath it.
|
|
2525
3239
|
createShadow: function(t) {
|
|
2526
3240
|
return this._createIcon("shadow", t);
|
|
2527
3241
|
},
|
|
@@ -2630,25 +3344,73 @@ var Lt = St.extend({
|
|
|
2630
3344
|
W(this._panRequest), delete this._oldLatLng, this._marker.fire("moveend").fire("dragend", t);
|
|
2631
3345
|
}
|
|
2632
3346
|
}), Ae = Y.extend({
|
|
3347
|
+
// @section
|
|
3348
|
+
// @aka Marker options
|
|
2633
3349
|
options: {
|
|
3350
|
+
// @option icon: Icon = *
|
|
3351
|
+
// Icon instance to use for rendering the marker.
|
|
3352
|
+
// See [Icon documentation](#L.Icon) for details on how to customize the marker icon.
|
|
3353
|
+
// If not specified, a common instance of `L.Icon.Default` is used.
|
|
2634
3354
|
icon: new Lt(),
|
|
3355
|
+
// Option inherited from "Interactive layer" abstract class
|
|
2635
3356
|
interactive: !0,
|
|
3357
|
+
// @option keyboard: Boolean = true
|
|
3358
|
+
// Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
|
|
2636
3359
|
keyboard: !0,
|
|
3360
|
+
// @option title: String = ''
|
|
3361
|
+
// Text for the browser tooltip that appear on marker hover (no tooltip by default).
|
|
3362
|
+
// [Useful for accessibility](https://leafletjs.com/examples/accessibility/#markers-must-be-labelled).
|
|
2637
3363
|
title: "",
|
|
3364
|
+
// @option alt: String = 'Marker'
|
|
3365
|
+
// Text for the `alt` attribute of the icon image.
|
|
3366
|
+
// [Useful for accessibility](https://leafletjs.com/examples/accessibility/#markers-must-be-labelled).
|
|
2638
3367
|
alt: "Marker",
|
|
3368
|
+
// @option zIndexOffset: Number = 0
|
|
3369
|
+
// By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively).
|
|
2639
3370
|
zIndexOffset: 0,
|
|
3371
|
+
// @option opacity: Number = 1.0
|
|
3372
|
+
// The opacity of the marker.
|
|
2640
3373
|
opacity: 1,
|
|
3374
|
+
// @option riseOnHover: Boolean = false
|
|
3375
|
+
// If `true`, the marker will get on top of others when you hover the mouse over it.
|
|
2641
3376
|
riseOnHover: !1,
|
|
3377
|
+
// @option riseOffset: Number = 250
|
|
3378
|
+
// The z-index offset used for the `riseOnHover` feature.
|
|
2642
3379
|
riseOffset: 250,
|
|
3380
|
+
// @option pane: String = 'markerPane'
|
|
3381
|
+
// `Map pane` where the markers icon will be added.
|
|
2643
3382
|
pane: "markerPane",
|
|
3383
|
+
// @option shadowPane: String = 'shadowPane'
|
|
3384
|
+
// `Map pane` where the markers shadow will be added.
|
|
2644
3385
|
shadowPane: "shadowPane",
|
|
3386
|
+
// @option bubblingMouseEvents: Boolean = false
|
|
3387
|
+
// When `true`, a mouse event on this marker will trigger the same event on the map
|
|
3388
|
+
// (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
|
|
2645
3389
|
bubblingMouseEvents: !1,
|
|
3390
|
+
// @option autoPanOnFocus: Boolean = true
|
|
3391
|
+
// When `true`, the map will pan whenever the marker is focused (via
|
|
3392
|
+
// e.g. pressing `tab` on the keyboard) to ensure the marker is
|
|
3393
|
+
// visible within the map's bounds
|
|
2646
3394
|
autoPanOnFocus: !0,
|
|
3395
|
+
// @section Draggable marker options
|
|
3396
|
+
// @option draggable: Boolean = false
|
|
3397
|
+
// Whether the marker is draggable with mouse/touch or not.
|
|
2647
3398
|
draggable: !1,
|
|
3399
|
+
// @option autoPan: Boolean = false
|
|
3400
|
+
// Whether to pan the map when dragging this marker near its edge or not.
|
|
2648
3401
|
autoPan: !1,
|
|
3402
|
+
// @option autoPanPadding: Point = Point(50, 50)
|
|
3403
|
+
// Distance (in pixels to the left/right and to the top/bottom) of the
|
|
3404
|
+
// map edge to start panning the map.
|
|
2649
3405
|
autoPanPadding: [50, 50],
|
|
3406
|
+
// @option autoPanSpeed: Number = 10
|
|
3407
|
+
// Number of pixels the map should pan by.
|
|
2650
3408
|
autoPanSpeed: 10
|
|
2651
3409
|
},
|
|
3410
|
+
/* @section
|
|
3411
|
+
*
|
|
3412
|
+
* In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods:
|
|
3413
|
+
*/
|
|
2652
3414
|
initialize: function(t, e) {
|
|
2653
3415
|
z(this, e), this._latlng = b(t);
|
|
2654
3416
|
},
|
|
@@ -2664,19 +3426,29 @@ var Lt = St.extend({
|
|
|
2664
3426
|
viewreset: this.update
|
|
2665
3427
|
};
|
|
2666
3428
|
},
|
|
3429
|
+
// @method getLatLng: LatLng
|
|
3430
|
+
// Returns the current geographical position of the marker.
|
|
2667
3431
|
getLatLng: function() {
|
|
2668
3432
|
return this._latlng;
|
|
2669
3433
|
},
|
|
3434
|
+
// @method setLatLng(latlng: LatLng): this
|
|
3435
|
+
// Changes the marker position to the given point.
|
|
2670
3436
|
setLatLng: function(t) {
|
|
2671
3437
|
var e = this._latlng;
|
|
2672
3438
|
return this._latlng = b(t), this.update(), this.fire("move", { oldLatLng: e, latlng: this._latlng });
|
|
2673
3439
|
},
|
|
3440
|
+
// @method setZIndexOffset(offset: Number): this
|
|
3441
|
+
// Changes the [zIndex offset](#marker-zindexoffset) of the marker.
|
|
2674
3442
|
setZIndexOffset: function(t) {
|
|
2675
3443
|
return this.options.zIndexOffset = t, this.update();
|
|
2676
3444
|
},
|
|
3445
|
+
// @method getIcon: Icon
|
|
3446
|
+
// Returns the current icon used by the marker
|
|
2677
3447
|
getIcon: function() {
|
|
2678
3448
|
return this.options.icon;
|
|
2679
3449
|
},
|
|
3450
|
+
// @method setIcon(icon: Icon): this
|
|
3451
|
+
// Changes the marker icon.
|
|
2680
3452
|
setIcon: function(t) {
|
|
2681
3453
|
return this.options.icon = t, this._map && (this._initIcon(), this.update()), this._popup && this.bindPopup(this._popup, this._popup.options), this;
|
|
2682
3454
|
},
|
|
@@ -2724,6 +3496,8 @@ var Lt = St.extend({
|
|
|
2724
3496
|
this.dragging && (t = this.dragging.enabled(), this.dragging.disable()), this.dragging = new ei(this), t && this.dragging.enable();
|
|
2725
3497
|
}
|
|
2726
3498
|
},
|
|
3499
|
+
// @method setOpacity(opacity: Number): this
|
|
3500
|
+
// Changes the opacity of the marker.
|
|
2727
3501
|
setOpacity: function(t) {
|
|
2728
3502
|
return this.options.opacity = t, this._map && this._updateOpacity(), this;
|
|
2729
3503
|
},
|
|
@@ -2758,20 +3532,51 @@ function To(t, e) {
|
|
|
2758
3532
|
return new Ae(t, e);
|
|
2759
3533
|
}
|
|
2760
3534
|
var _t = Y.extend({
|
|
3535
|
+
// @section
|
|
3536
|
+
// @aka Path options
|
|
2761
3537
|
options: {
|
|
3538
|
+
// @option stroke: Boolean = true
|
|
3539
|
+
// Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles.
|
|
2762
3540
|
stroke: !0,
|
|
3541
|
+
// @option color: String = '#3388ff'
|
|
3542
|
+
// Stroke color
|
|
2763
3543
|
color: "#3388ff",
|
|
3544
|
+
// @option weight: Number = 3
|
|
3545
|
+
// Stroke width in pixels
|
|
2764
3546
|
weight: 3,
|
|
3547
|
+
// @option opacity: Number = 1.0
|
|
3548
|
+
// Stroke opacity
|
|
2765
3549
|
opacity: 1,
|
|
3550
|
+
// @option lineCap: String= 'round'
|
|
3551
|
+
// A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.
|
|
2766
3552
|
lineCap: "round",
|
|
3553
|
+
// @option lineJoin: String = 'round'
|
|
3554
|
+
// A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.
|
|
2767
3555
|
lineJoin: "round",
|
|
3556
|
+
// @option dashArray: String = null
|
|
3557
|
+
// A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
|
|
2768
3558
|
dashArray: null,
|
|
3559
|
+
// @option dashOffset: String = null
|
|
3560
|
+
// A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
|
|
2769
3561
|
dashOffset: null,
|
|
3562
|
+
// @option fill: Boolean = depends
|
|
3563
|
+
// Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles.
|
|
2770
3564
|
fill: !1,
|
|
3565
|
+
// @option fillColor: String = *
|
|
3566
|
+
// Fill color. Defaults to the value of the [`color`](#path-color) option
|
|
2771
3567
|
fillColor: null,
|
|
3568
|
+
// @option fillOpacity: Number = 0.2
|
|
3569
|
+
// Fill opacity.
|
|
2772
3570
|
fillOpacity: 0.2,
|
|
3571
|
+
// @option fillRule: String = 'evenodd'
|
|
3572
|
+
// A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.
|
|
2773
3573
|
fillRule: "evenodd",
|
|
3574
|
+
// className: '',
|
|
3575
|
+
// Option inherited from "Interactive layer" abstract class
|
|
2774
3576
|
interactive: !0,
|
|
3577
|
+
// @option bubblingMouseEvents: Boolean = true
|
|
3578
|
+
// When `true`, a mouse event on this path will trigger the same event on the map
|
|
3579
|
+
// (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
|
|
2775
3580
|
bubblingMouseEvents: !0
|
|
2776
3581
|
},
|
|
2777
3582
|
beforeAdd: function(t) {
|
|
@@ -2783,15 +3588,23 @@ var _t = Y.extend({
|
|
|
2783
3588
|
onRemove: function() {
|
|
2784
3589
|
this._renderer._removePath(this);
|
|
2785
3590
|
},
|
|
3591
|
+
// @method redraw(): this
|
|
3592
|
+
// Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
|
|
2786
3593
|
redraw: function() {
|
|
2787
3594
|
return this._map && this._renderer._updatePath(this), this;
|
|
2788
3595
|
},
|
|
3596
|
+
// @method setStyle(style: Path options): this
|
|
3597
|
+
// Changes the appearance of a Path based on the options in the `Path options` object.
|
|
2789
3598
|
setStyle: function(t) {
|
|
2790
3599
|
return z(this, t), this._renderer && (this._renderer._updateStyle(this), this.options.stroke && t && Object.prototype.hasOwnProperty.call(t, "weight") && this._updateBounds()), this;
|
|
2791
3600
|
},
|
|
3601
|
+
// @method bringToFront(): this
|
|
3602
|
+
// Brings the layer to the top of all path layers.
|
|
2792
3603
|
bringToFront: function() {
|
|
2793
3604
|
return this._renderer && this._renderer._bringToFront(this), this;
|
|
2794
3605
|
},
|
|
3606
|
+
// @method bringToBack(): this
|
|
3607
|
+
// Brings the layer to the bottom of all path layers.
|
|
2795
3608
|
bringToBack: function() {
|
|
2796
3609
|
return this._renderer && this._renderer._bringToBack(this), this;
|
|
2797
3610
|
},
|
|
@@ -2805,23 +3618,35 @@ var _t = Y.extend({
|
|
|
2805
3618
|
return (this.options.stroke ? this.options.weight / 2 : 0) + (this._renderer.options.tolerance || 0);
|
|
2806
3619
|
}
|
|
2807
3620
|
}), Be = _t.extend({
|
|
3621
|
+
// @section
|
|
3622
|
+
// @aka CircleMarker options
|
|
2808
3623
|
options: {
|
|
2809
3624
|
fill: !0,
|
|
3625
|
+
// @option radius: Number = 10
|
|
3626
|
+
// Radius of the circle marker, in pixels
|
|
2810
3627
|
radius: 10
|
|
2811
3628
|
},
|
|
2812
3629
|
initialize: function(t, e) {
|
|
2813
3630
|
z(this, e), this._latlng = b(t), this._radius = this.options.radius;
|
|
2814
3631
|
},
|
|
3632
|
+
// @method setLatLng(latLng: LatLng): this
|
|
3633
|
+
// Sets the position of a circle marker to a new location.
|
|
2815
3634
|
setLatLng: function(t) {
|
|
2816
3635
|
var e = this._latlng;
|
|
2817
3636
|
return this._latlng = b(t), this.redraw(), this.fire("move", { oldLatLng: e, latlng: this._latlng });
|
|
2818
3637
|
},
|
|
3638
|
+
// @method getLatLng(): LatLng
|
|
3639
|
+
// Returns the current geographical position of the circle marker
|
|
2819
3640
|
getLatLng: function() {
|
|
2820
3641
|
return this._latlng;
|
|
2821
3642
|
},
|
|
3643
|
+
// @method setRadius(radius: Number): this
|
|
3644
|
+
// Sets the radius of a circle marker. Units are in pixels.
|
|
2822
3645
|
setRadius: function(t) {
|
|
2823
3646
|
return this.options.radius = this._radius = t, this.redraw();
|
|
2824
3647
|
},
|
|
3648
|
+
// @method getRadius(): Number
|
|
3649
|
+
// Returns the current radius of the circle
|
|
2825
3650
|
getRadius: function() {
|
|
2826
3651
|
return this._radius;
|
|
2827
3652
|
},
|
|
@@ -2845,6 +3670,7 @@ var _t = Y.extend({
|
|
|
2845
3670
|
_empty: function() {
|
|
2846
3671
|
return this._radius && !this._renderer._bounds.intersects(this._pxBounds);
|
|
2847
3672
|
},
|
|
3673
|
+
// Needed by the `Canvas` renderer for interactivity
|
|
2848
3674
|
_containsPoint: function(t) {
|
|
2849
3675
|
return t.distanceTo(this._point) <= this._radius + this._clickTolerance();
|
|
2850
3676
|
}
|
|
@@ -2858,12 +3684,18 @@ var qi = Be.extend({
|
|
|
2858
3684
|
throw new Error("Circle radius cannot be NaN");
|
|
2859
3685
|
this._mRadius = this.options.radius;
|
|
2860
3686
|
},
|
|
3687
|
+
// @method setRadius(radius: Number): this
|
|
3688
|
+
// Sets the radius of a circle. Units are in meters.
|
|
2861
3689
|
setRadius: function(t) {
|
|
2862
3690
|
return this._mRadius = t, this.redraw();
|
|
2863
3691
|
},
|
|
3692
|
+
// @method getRadius(): Number
|
|
3693
|
+
// Returns the current radius of a circle. Units are in meters.
|
|
2864
3694
|
getRadius: function() {
|
|
2865
3695
|
return this._mRadius;
|
|
2866
3696
|
},
|
|
3697
|
+
// @method getBounds(): LatLngBounds
|
|
3698
|
+
// Returns the `LatLngBounds` of the path.
|
|
2867
3699
|
getBounds: function() {
|
|
2868
3700
|
var t = [this._radius, this._radiusY || this._radius];
|
|
2869
3701
|
return new R(
|
|
@@ -2888,22 +3720,37 @@ function Mo(t, e, i) {
|
|
|
2888
3720
|
return new qi(t, e, i);
|
|
2889
3721
|
}
|
|
2890
3722
|
var tt = _t.extend({
|
|
3723
|
+
// @section
|
|
3724
|
+
// @aka Polyline options
|
|
2891
3725
|
options: {
|
|
3726
|
+
// @option smoothFactor: Number = 1.0
|
|
3727
|
+
// How much to simplify the polyline on each zoom level. More means
|
|
3728
|
+
// better performance and smoother look, and less means more accurate representation.
|
|
2892
3729
|
smoothFactor: 1,
|
|
3730
|
+
// @option noClip: Boolean = false
|
|
3731
|
+
// Disable polyline clipping.
|
|
2893
3732
|
noClip: !1
|
|
2894
3733
|
},
|
|
2895
3734
|
initialize: function(t, e) {
|
|
2896
3735
|
z(this, e), this._setLatLngs(t);
|
|
2897
3736
|
},
|
|
3737
|
+
// @method getLatLngs(): LatLng[]
|
|
3738
|
+
// Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
|
|
2898
3739
|
getLatLngs: function() {
|
|
2899
3740
|
return this._latlngs;
|
|
2900
3741
|
},
|
|
3742
|
+
// @method setLatLngs(latlngs: LatLng[]): this
|
|
3743
|
+
// Replaces all the points in the polyline with the given array of geographical points.
|
|
2901
3744
|
setLatLngs: function(t) {
|
|
2902
3745
|
return this._setLatLngs(t), this.redraw();
|
|
2903
3746
|
},
|
|
3747
|
+
// @method isEmpty(): Boolean
|
|
3748
|
+
// Returns `true` if the Polyline has no LatLngs.
|
|
2904
3749
|
isEmpty: function() {
|
|
2905
3750
|
return !this._latlngs.length;
|
|
2906
3751
|
},
|
|
3752
|
+
// @method closestLayerPoint(p: Point): Point
|
|
3753
|
+
// Returns the point closest to `p` on the Polyline.
|
|
2907
3754
|
closestLayerPoint: function(t) {
|
|
2908
3755
|
for (var e = 1 / 0, i = null, n = Ot, o, s, r = 0, a = this._parts.length; r < a; r++)
|
|
2909
3756
|
for (var h = this._parts[r], u = 1, l = h.length; u < l; u++) {
|
|
@@ -2913,14 +3760,22 @@ var tt = _t.extend({
|
|
|
2913
3760
|
}
|
|
2914
3761
|
return i && (i.distance = Math.sqrt(e)), i;
|
|
2915
3762
|
},
|
|
3763
|
+
// @method getCenter(): LatLng
|
|
3764
|
+
// Returns the center ([centroid](https://en.wikipedia.org/wiki/Centroid)) of the polyline.
|
|
2916
3765
|
getCenter: function() {
|
|
2917
3766
|
if (!this._map)
|
|
2918
3767
|
throw new Error("Must add layer to map before using getCenter()");
|
|
2919
3768
|
return Hi(this._defaultShape(), this._map.options.crs);
|
|
2920
3769
|
},
|
|
3770
|
+
// @method getBounds(): LatLngBounds
|
|
3771
|
+
// Returns the `LatLngBounds` of the path.
|
|
2921
3772
|
getBounds: function() {
|
|
2922
3773
|
return this._bounds;
|
|
2923
3774
|
},
|
|
3775
|
+
// @method addLatLng(latlng: LatLng, latlngs?: LatLng[]): this
|
|
3776
|
+
// Adds a given point to the polyline. By default, adds to the first ring of
|
|
3777
|
+
// the polyline in case of a multi-polyline, but can be overridden by passing
|
|
3778
|
+
// a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).
|
|
2924
3779
|
addLatLng: function(t, e) {
|
|
2925
3780
|
return e = e || this._defaultShape(), t = b(t), e.push(t), this._bounds.extend(t), this.redraw();
|
|
2926
3781
|
},
|
|
@@ -2930,6 +3785,7 @@ var tt = _t.extend({
|
|
|
2930
3785
|
_defaultShape: function() {
|
|
2931
3786
|
return U(this._latlngs) ? this._latlngs : this._latlngs[0];
|
|
2932
3787
|
},
|
|
3788
|
+
// recursively convert latlngs input into actual LatLng instances; calculate bounds along the way
|
|
2933
3789
|
_convertLatLngs: function(t) {
|
|
2934
3790
|
for (var e = [], i = U(t), n = 0, o = t.length; n < o; n++)
|
|
2935
3791
|
i ? (e[n] = b(t[n]), this._bounds.extend(e[n])) : e[n] = this._convertLatLngs(t[n]);
|
|
@@ -2946,6 +3802,7 @@ var tt = _t.extend({
|
|
|
2946
3802
|
this._rawPxBounds.max.add(e)
|
|
2947
3803
|
]));
|
|
2948
3804
|
},
|
|
3805
|
+
// recursively turns latlngs into a set of rings with projected coordinates
|
|
2949
3806
|
_projectLatlngs: function(t, e, i) {
|
|
2950
3807
|
var n = t[0] instanceof w, o = t.length, s, r;
|
|
2951
3808
|
if (n) {
|
|
@@ -2956,6 +3813,7 @@ var tt = _t.extend({
|
|
|
2956
3813
|
for (s = 0; s < o; s++)
|
|
2957
3814
|
this._projectLatlngs(t[s], e, i);
|
|
2958
3815
|
},
|
|
3816
|
+
// clip polyline by renderer bounds so that we have less to render for performance
|
|
2959
3817
|
_clipPoints: function() {
|
|
2960
3818
|
var t = this._renderer._bounds;
|
|
2961
3819
|
if (this._parts = [], !(!this._pxBounds || !this._pxBounds.intersects(t))) {
|
|
@@ -2969,6 +3827,7 @@ var tt = _t.extend({
|
|
|
2969
3827
|
a = Ri(h[n], h[n + 1], t, n, !0), a && (e[o] = e[o] || [], e[o].push(a[0]), (a[1] !== h[n + 1] || n === r - 2) && (e[o].push(a[1]), o++));
|
|
2970
3828
|
}
|
|
2971
3829
|
},
|
|
3830
|
+
// simplify each clipped part of the polyline for performance
|
|
2972
3831
|
_simplifyPoints: function() {
|
|
2973
3832
|
for (var t = this._parts, e = this.options.smoothFactor, i = 0, n = t.length; i < n; i++)
|
|
2974
3833
|
t[i] = Bi(t[i], e);
|
|
@@ -2979,6 +3838,7 @@ var tt = _t.extend({
|
|
|
2979
3838
|
_updatePath: function() {
|
|
2980
3839
|
this._renderer._updatePoly(this);
|
|
2981
3840
|
},
|
|
3841
|
+
// Needed by the `Canvas` renderer for interactivity
|
|
2982
3842
|
_containsPoint: function(t, e) {
|
|
2983
3843
|
var i, n, o, s, r, a, h = this._clickTolerance();
|
|
2984
3844
|
if (!this._pxBounds || !this._pxBounds.contains(t))
|
|
@@ -3001,6 +3861,8 @@ var kt = tt.extend({
|
|
|
3001
3861
|
isEmpty: function() {
|
|
3002
3862
|
return !this._latlngs.length || !this._latlngs[0].length;
|
|
3003
3863
|
},
|
|
3864
|
+
// @method getCenter(): LatLng
|
|
3865
|
+
// Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the Polygon.
|
|
3004
3866
|
getCenter: function() {
|
|
3005
3867
|
if (!this._map)
|
|
3006
3868
|
throw new Error("Must add layer to map before using getCenter()");
|
|
@@ -3030,6 +3892,7 @@ var kt = tt.extend({
|
|
|
3030
3892
|
_updatePath: function() {
|
|
3031
3893
|
this._renderer._updatePoly(this, !0);
|
|
3032
3894
|
},
|
|
3895
|
+
// Needed by the `Canvas` renderer for interactivity
|
|
3033
3896
|
_containsPoint: function(t) {
|
|
3034
3897
|
var e = !1, i, n, o, s, r, a, h, u;
|
|
3035
3898
|
if (!this._pxBounds || !this._pxBounds.contains(t))
|
|
@@ -3044,9 +3907,60 @@ function zo(t, e) {
|
|
|
3044
3907
|
return new kt(t, e);
|
|
3045
3908
|
}
|
|
3046
3909
|
var st = et.extend({
|
|
3910
|
+
/* @section
|
|
3911
|
+
* @aka GeoJSON options
|
|
3912
|
+
*
|
|
3913
|
+
* @option pointToLayer: Function = *
|
|
3914
|
+
* A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally
|
|
3915
|
+
* called when data is added, passing the GeoJSON point feature and its `LatLng`.
|
|
3916
|
+
* The default is to spawn a default `Marker`:
|
|
3917
|
+
* ```js
|
|
3918
|
+
* function(geoJsonPoint, latlng) {
|
|
3919
|
+
* return L.marker(latlng);
|
|
3920
|
+
* }
|
|
3921
|
+
* ```
|
|
3922
|
+
*
|
|
3923
|
+
* @option style: Function = *
|
|
3924
|
+
* A `Function` defining the `Path options` for styling GeoJSON lines and polygons,
|
|
3925
|
+
* called internally when data is added.
|
|
3926
|
+
* The default value is to not override any defaults:
|
|
3927
|
+
* ```js
|
|
3928
|
+
* function (geoJsonFeature) {
|
|
3929
|
+
* return {}
|
|
3930
|
+
* }
|
|
3931
|
+
* ```
|
|
3932
|
+
*
|
|
3933
|
+
* @option onEachFeature: Function = *
|
|
3934
|
+
* A `Function` that will be called once for each created `Feature`, after it has
|
|
3935
|
+
* been created and styled. Useful for attaching events and popups to features.
|
|
3936
|
+
* The default is to do nothing with the newly created layers:
|
|
3937
|
+
* ```js
|
|
3938
|
+
* function (feature, layer) {}
|
|
3939
|
+
* ```
|
|
3940
|
+
*
|
|
3941
|
+
* @option filter: Function = *
|
|
3942
|
+
* A `Function` that will be used to decide whether to include a feature or not.
|
|
3943
|
+
* The default is to include all features:
|
|
3944
|
+
* ```js
|
|
3945
|
+
* function (geoJsonFeature) {
|
|
3946
|
+
* return true;
|
|
3947
|
+
* }
|
|
3948
|
+
* ```
|
|
3949
|
+
* Note: dynamically changing the `filter` option will have effect only on newly
|
|
3950
|
+
* added data. It will _not_ re-evaluate already included features.
|
|
3951
|
+
*
|
|
3952
|
+
* @option coordsToLatLng: Function = *
|
|
3953
|
+
* A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s.
|
|
3954
|
+
* The default is the `coordsToLatLng` static method.
|
|
3955
|
+
*
|
|
3956
|
+
* @option markersInheritOptions: Boolean = false
|
|
3957
|
+
* Whether default Markers for "Point" type Features inherit from group options.
|
|
3958
|
+
*/
|
|
3047
3959
|
initialize: function(t, e) {
|
|
3048
3960
|
z(this, e), this._layers = {}, t && this.addData(t);
|
|
3049
3961
|
},
|
|
3962
|
+
// @method addData( <GeoJSON> data ): this
|
|
3963
|
+
// Adds a GeoJSON object to the layer.
|
|
3050
3964
|
addData: function(t) {
|
|
3051
3965
|
var e = q(t) ? t : t.features, i, n, o;
|
|
3052
3966
|
if (e) {
|
|
@@ -3060,9 +3974,14 @@ var st = et.extend({
|
|
|
3060
3974
|
var r = Vt(t, s);
|
|
3061
3975
|
return r ? (r.feature = te(t), r.defaultOptions = r.options, this.resetStyle(r), s.onEachFeature && s.onEachFeature(t, r), this.addLayer(r)) : this;
|
|
3062
3976
|
},
|
|
3977
|
+
// @method resetStyle( <Path> layer? ): this
|
|
3978
|
+
// Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
|
|
3979
|
+
// If `layer` is omitted, the style of all features in the current layer is reset.
|
|
3063
3980
|
resetStyle: function(t) {
|
|
3064
3981
|
return t === void 0 ? this.eachLayer(this.resetStyle, this) : (t.options = P({}, t.defaultOptions), this._setLayerStyle(t, this.options.style), this);
|
|
3065
3982
|
},
|
|
3983
|
+
// @method setStyle( <Function> style ): this
|
|
3984
|
+
// Changes styles of GeoJSON vector layers with the given style function.
|
|
3066
3985
|
setStyle: function(t) {
|
|
3067
3986
|
return this.eachLayer(function(e) {
|
|
3068
3987
|
this._setLayerStyle(e, t);
|
|
@@ -3177,6 +4096,9 @@ Pt.include({
|
|
|
3177
4096
|
coordinates: e
|
|
3178
4097
|
});
|
|
3179
4098
|
},
|
|
4099
|
+
// @method toGeoJSON(precision?: Number|false): Object
|
|
4100
|
+
// Coordinates values are rounded with [`formatNum`](#util-formatnum) function with given `precision`.
|
|
4101
|
+
// Returns a [`GeoJSON`](https://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`).
|
|
3180
4102
|
toGeoJSON: function(t) {
|
|
3181
4103
|
var e = this.feature && this.feature.geometry && this.feature.geometry.type;
|
|
3182
4104
|
if (e === "MultiPoint")
|
|
@@ -3205,13 +4127,31 @@ function Qn(t, e) {
|
|
|
3205
4127
|
return new st(t, e);
|
|
3206
4128
|
}
|
|
3207
4129
|
var So = Qn, He = Y.extend({
|
|
4130
|
+
// @section
|
|
4131
|
+
// @aka ImageOverlay options
|
|
3208
4132
|
options: {
|
|
4133
|
+
// @option opacity: Number = 1.0
|
|
4134
|
+
// The opacity of the image overlay.
|
|
3209
4135
|
opacity: 1,
|
|
4136
|
+
// @option alt: String = ''
|
|
4137
|
+
// Text for the `alt` attribute of the image (useful for accessibility).
|
|
3210
4138
|
alt: "",
|
|
4139
|
+
// @option interactive: Boolean = false
|
|
4140
|
+
// If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered.
|
|
3211
4141
|
interactive: !1,
|
|
4142
|
+
// @option crossOrigin: Boolean|String = false
|
|
4143
|
+
// Whether the crossOrigin attribute will be added to the image.
|
|
4144
|
+
// If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
|
|
4145
|
+
// Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.
|
|
3212
4146
|
crossOrigin: !1,
|
|
4147
|
+
// @option errorOverlayUrl: String = ''
|
|
4148
|
+
// URL to the overlay image to show in place of the overlay that failed to load.
|
|
3213
4149
|
errorOverlayUrl: "",
|
|
4150
|
+
// @option zIndex: Number = 1
|
|
4151
|
+
// The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer.
|
|
3214
4152
|
zIndex: 1,
|
|
4153
|
+
// @option className: String = ''
|
|
4154
|
+
// A custom class name to assign to the image. Empty by default.
|
|
3215
4155
|
className: ""
|
|
3216
4156
|
},
|
|
3217
4157
|
initialize: function(t, e, i) {
|
|
@@ -3223,21 +4163,31 @@ var So = Qn, He = Y.extend({
|
|
|
3223
4163
|
onRemove: function() {
|
|
3224
4164
|
C(this._image), this.options.interactive && this.removeInteractiveTarget(this._image);
|
|
3225
4165
|
},
|
|
4166
|
+
// @method setOpacity(opacity: Number): this
|
|
4167
|
+
// Sets the opacity of the overlay.
|
|
3226
4168
|
setOpacity: function(t) {
|
|
3227
4169
|
return this.options.opacity = t, this._image && this._updateOpacity(), this;
|
|
3228
4170
|
},
|
|
3229
4171
|
setStyle: function(t) {
|
|
3230
4172
|
return t.opacity && this.setOpacity(t.opacity), this;
|
|
3231
4173
|
},
|
|
4174
|
+
// @method bringToFront(): this
|
|
4175
|
+
// Brings the layer to the top of all overlays.
|
|
3232
4176
|
bringToFront: function() {
|
|
3233
4177
|
return this._map && vt(this._image), this;
|
|
3234
4178
|
},
|
|
4179
|
+
// @method bringToBack(): this
|
|
4180
|
+
// Brings the layer to the bottom of all overlays.
|
|
3235
4181
|
bringToBack: function() {
|
|
3236
4182
|
return this._map && gt(this._image), this;
|
|
3237
4183
|
},
|
|
4184
|
+
// @method setUrl(url: String): this
|
|
4185
|
+
// Changes the URL of the image.
|
|
3238
4186
|
setUrl: function(t) {
|
|
3239
4187
|
return this._url = t, this._image && (this._image.src = t), this;
|
|
3240
4188
|
},
|
|
4189
|
+
// @method setBounds(bounds: LatLngBounds): this
|
|
4190
|
+
// Update the bounds that this ImageOverlay covers
|
|
3241
4191
|
setBounds: function(t) {
|
|
3242
4192
|
return this._bounds = I(t), this._map && this._reset(), this;
|
|
3243
4193
|
},
|
|
@@ -3248,12 +4198,19 @@ var So = Qn, He = Y.extend({
|
|
|
3248
4198
|
};
|
|
3249
4199
|
return this._zoomAnimated && (t.zoomanim = this._animateZoom), t;
|
|
3250
4200
|
},
|
|
4201
|
+
// @method setZIndex(value: Number): this
|
|
4202
|
+
// Changes the [zIndex](#imageoverlay-zindex) of the image overlay.
|
|
3251
4203
|
setZIndex: function(t) {
|
|
3252
4204
|
return this.options.zIndex = t, this._updateZIndex(), this;
|
|
3253
4205
|
},
|
|
4206
|
+
// @method getBounds(): LatLngBounds
|
|
4207
|
+
// Get the bounds that this ImageOverlay covers
|
|
3254
4208
|
getBounds: function() {
|
|
3255
4209
|
return this._bounds;
|
|
3256
4210
|
},
|
|
4211
|
+
// @method getElement(): HTMLElement
|
|
4212
|
+
// Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement)
|
|
4213
|
+
// used by this overlay.
|
|
3257
4214
|
getElement: function() {
|
|
3258
4215
|
return this._image;
|
|
3259
4216
|
},
|
|
@@ -3287,17 +4244,33 @@ var So = Qn, He = Y.extend({
|
|
|
3287
4244
|
var t = this.options.errorOverlayUrl;
|
|
3288
4245
|
t && this._url !== t && (this._url = t, this._image.src = t);
|
|
3289
4246
|
},
|
|
4247
|
+
// @method getCenter(): LatLng
|
|
4248
|
+
// Returns the center of the ImageOverlay.
|
|
3290
4249
|
getCenter: function() {
|
|
3291
4250
|
return this._bounds.getCenter();
|
|
3292
4251
|
}
|
|
3293
4252
|
}), ko = function(t, e, i) {
|
|
3294
4253
|
return new He(t, e, i);
|
|
3295
4254
|
}, to = He.extend({
|
|
4255
|
+
// @section
|
|
4256
|
+
// @aka VideoOverlay options
|
|
3296
4257
|
options: {
|
|
4258
|
+
// @option autoplay: Boolean = true
|
|
4259
|
+
// Whether the video starts playing automatically when loaded.
|
|
4260
|
+
// On some browsers autoplay will only work with `muted: true`
|
|
3297
4261
|
autoplay: !0,
|
|
4262
|
+
// @option loop: Boolean = true
|
|
4263
|
+
// Whether the video will loop back to the beginning when played.
|
|
3298
4264
|
loop: !0,
|
|
4265
|
+
// @option keepAspectRatio: Boolean = true
|
|
4266
|
+
// Whether the video will save aspect ratio after the projection.
|
|
4267
|
+
// Relevant for supported browsers. See [browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit)
|
|
3299
4268
|
keepAspectRatio: !0,
|
|
4269
|
+
// @option muted: Boolean = false
|
|
4270
|
+
// Whether the video starts on mute when loaded.
|
|
3300
4271
|
muted: !1,
|
|
4272
|
+
// @option playsInline: Boolean = true
|
|
4273
|
+
// Mobile browsers will play the video right where it is instead of open it up in fullscreen mode.
|
|
3301
4274
|
playsInline: !0
|
|
3302
4275
|
},
|
|
3303
4276
|
_initImage: function() {
|
|
@@ -3314,6 +4287,9 @@ var So = Qn, He = Y.extend({
|
|
|
3314
4287
|
r.src = this._url[s], e.appendChild(r);
|
|
3315
4288
|
}
|
|
3316
4289
|
}
|
|
4290
|
+
// @method getElement(): HTMLVideoElement
|
|
4291
|
+
// Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement)
|
|
4292
|
+
// used by this overlay.
|
|
3317
4293
|
});
|
|
3318
4294
|
function Zo(t, e, i) {
|
|
3319
4295
|
return new to(t, e, i);
|
|
@@ -3323,27 +4299,54 @@ var eo = He.extend({
|
|
|
3323
4299
|
var t = this._image = this._url;
|
|
3324
4300
|
p(t, "leaflet-image-layer"), this._zoomAnimated && p(t, "leaflet-zoom-animated"), this.options.className && p(t, this.options.className), t.onselectstart = k, t.onmousemove = k;
|
|
3325
4301
|
}
|
|
4302
|
+
// @method getElement(): SVGElement
|
|
4303
|
+
// Returns the instance of [`SVGElement`](https://developer.mozilla.org/docs/Web/API/SVGElement)
|
|
4304
|
+
// used by this overlay.
|
|
3326
4305
|
});
|
|
3327
4306
|
function Eo(t, e, i) {
|
|
3328
4307
|
return new eo(t, e, i);
|
|
3329
4308
|
}
|
|
3330
4309
|
var X = Y.extend({
|
|
4310
|
+
// @section
|
|
4311
|
+
// @aka DivOverlay options
|
|
3331
4312
|
options: {
|
|
4313
|
+
// @option interactive: Boolean = false
|
|
4314
|
+
// If true, the popup/tooltip will listen to the mouse events.
|
|
3332
4315
|
interactive: !1,
|
|
4316
|
+
// @option offset: Point = Point(0, 0)
|
|
4317
|
+
// The offset of the overlay position.
|
|
3333
4318
|
offset: [0, 0],
|
|
4319
|
+
// @option className: String = ''
|
|
4320
|
+
// A custom CSS class name to assign to the overlay.
|
|
3334
4321
|
className: "",
|
|
4322
|
+
// @option pane: String = undefined
|
|
4323
|
+
// `Map pane` where the overlay will be added.
|
|
3335
4324
|
pane: void 0,
|
|
4325
|
+
// @option content: String|HTMLElement|Function = ''
|
|
4326
|
+
// Sets the HTML content of the overlay while initializing. If a function is passed the source layer will be
|
|
4327
|
+
// passed to the function. The function should return a `String` or `HTMLElement` to be used in the overlay.
|
|
3336
4328
|
content: ""
|
|
3337
4329
|
},
|
|
3338
4330
|
initialize: function(t, e) {
|
|
3339
4331
|
t && (t instanceof w || q(t)) ? (this._latlng = b(t), z(this, e)) : (z(this, t), this._source = e), this.options.content && (this._content = this.options.content);
|
|
3340
4332
|
},
|
|
4333
|
+
// @method openOn(map: Map): this
|
|
4334
|
+
// Adds the overlay to the map.
|
|
4335
|
+
// Alternative to `map.openPopup(popup)`/`.openTooltip(tooltip)`.
|
|
3341
4336
|
openOn: function(t) {
|
|
3342
4337
|
return t = arguments.length ? t : this._source._map, t.hasLayer(this) || t.addLayer(this), this;
|
|
3343
4338
|
},
|
|
4339
|
+
// @method close(): this
|
|
4340
|
+
// Closes the overlay.
|
|
4341
|
+
// Alternative to `map.closePopup(popup)`/`.closeTooltip(tooltip)`
|
|
4342
|
+
// and `layer.closePopup()`/`.closeTooltip()`.
|
|
3344
4343
|
close: function() {
|
|
3345
4344
|
return this._map && this._map.removeLayer(this), this;
|
|
3346
4345
|
},
|
|
4346
|
+
// @method toggle(layer?: Layer): this
|
|
4347
|
+
// Opens or closes the overlay bound to layer depending on its current state.
|
|
4348
|
+
// Argument may be omitted only for overlay bound to layer.
|
|
4349
|
+
// Alternative to `layer.togglePopup()`/`.toggleTooltip()`.
|
|
3347
4350
|
toggle: function(t) {
|
|
3348
4351
|
return this._map ? this.close() : (arguments.length ? this._source = t : t = this._source, this._prepareOpen(), this.openOn(t._map)), this;
|
|
3349
4352
|
},
|
|
@@ -3353,21 +4356,35 @@ var X = Y.extend({
|
|
|
3353
4356
|
onRemove: function(t) {
|
|
3354
4357
|
t._fadeAnimated ? (F(this._container, 0), this._removeTimeout = setTimeout(M(C, void 0, this._container), 200)) : C(this._container), this.options.interactive && (Z(this._container, "leaflet-interactive"), this.removeInteractiveTarget(this._container));
|
|
3355
4358
|
},
|
|
4359
|
+
// @namespace DivOverlay
|
|
4360
|
+
// @method getLatLng: LatLng
|
|
4361
|
+
// Returns the geographical point of the overlay.
|
|
3356
4362
|
getLatLng: function() {
|
|
3357
4363
|
return this._latlng;
|
|
3358
4364
|
},
|
|
4365
|
+
// @method setLatLng(latlng: LatLng): this
|
|
4366
|
+
// Sets the geographical point where the overlay will open.
|
|
3359
4367
|
setLatLng: function(t) {
|
|
3360
4368
|
return this._latlng = b(t), this._map && (this._updatePosition(), this._adjustPan()), this;
|
|
3361
4369
|
},
|
|
4370
|
+
// @method getContent: String|HTMLElement
|
|
4371
|
+
// Returns the content of the overlay.
|
|
3362
4372
|
getContent: function() {
|
|
3363
4373
|
return this._content;
|
|
3364
4374
|
},
|
|
4375
|
+
// @method setContent(htmlContent: String|HTMLElement|Function): this
|
|
4376
|
+
// Sets the HTML content of the overlay. If a function is passed the source layer will be passed to the function.
|
|
4377
|
+
// The function should return a `String` or `HTMLElement` to be used in the overlay.
|
|
3365
4378
|
setContent: function(t) {
|
|
3366
4379
|
return this._content = t, this.update(), this;
|
|
3367
4380
|
},
|
|
4381
|
+
// @method getElement: String|HTMLElement
|
|
4382
|
+
// Returns the HTML container of the overlay.
|
|
3368
4383
|
getElement: function() {
|
|
3369
4384
|
return this._container;
|
|
3370
4385
|
},
|
|
4386
|
+
// @method update: null
|
|
4387
|
+
// Updates the overlay content, layout and position. Useful for updating the overlay after something inside changed, e.g. image loaded.
|
|
3371
4388
|
update: function() {
|
|
3372
4389
|
this._map && (this._container.style.visibility = "hidden", this._updateContent(), this._updateLayout(), this._updatePosition(), this._container.style.visibility = "", this._adjustPan());
|
|
3373
4390
|
},
|
|
@@ -3378,15 +4395,22 @@ var X = Y.extend({
|
|
|
3378
4395
|
};
|
|
3379
4396
|
return this._zoomAnimated && (t.zoomanim = this._animateZoom), t;
|
|
3380
4397
|
},
|
|
4398
|
+
// @method isOpen: Boolean
|
|
4399
|
+
// Returns `true` when the overlay is visible on the map.
|
|
3381
4400
|
isOpen: function() {
|
|
3382
4401
|
return !!this._map && this._map.hasLayer(this);
|
|
3383
4402
|
},
|
|
4403
|
+
// @method bringToFront: this
|
|
4404
|
+
// Brings this overlay in front of other overlays (in the same map pane).
|
|
3384
4405
|
bringToFront: function() {
|
|
3385
4406
|
return this._map && vt(this._container), this;
|
|
3386
4407
|
},
|
|
4408
|
+
// @method bringToBack: this
|
|
4409
|
+
// Brings this overlay to the back of other overlays (in the same map pane).
|
|
3387
4410
|
bringToBack: function() {
|
|
3388
4411
|
return this._map && gt(this._container), this;
|
|
3389
4412
|
},
|
|
4413
|
+
// prepare bound overlay to open: update latlng pos / content source (for FeatureGroup)
|
|
3390
4414
|
_prepareOpen: function(t) {
|
|
3391
4415
|
var e = this._source;
|
|
3392
4416
|
if (!e._map)
|
|
@@ -3452,22 +4476,68 @@ Y.include({
|
|
|
3452
4476
|
}
|
|
3453
4477
|
});
|
|
3454
4478
|
var Fe = X.extend({
|
|
4479
|
+
// @section
|
|
4480
|
+
// @aka Popup options
|
|
3455
4481
|
options: {
|
|
4482
|
+
// @option pane: String = 'popupPane'
|
|
4483
|
+
// `Map pane` where the popup will be added.
|
|
3456
4484
|
pane: "popupPane",
|
|
4485
|
+
// @option offset: Point = Point(0, 7)
|
|
4486
|
+
// The offset of the popup position.
|
|
3457
4487
|
offset: [0, 7],
|
|
4488
|
+
// @option maxWidth: Number = 300
|
|
4489
|
+
// Max width of the popup, in pixels.
|
|
3458
4490
|
maxWidth: 300,
|
|
4491
|
+
// @option minWidth: Number = 50
|
|
4492
|
+
// Min width of the popup, in pixels.
|
|
3459
4493
|
minWidth: 50,
|
|
4494
|
+
// @option maxHeight: Number = null
|
|
4495
|
+
// If set, creates a scrollable container of the given height
|
|
4496
|
+
// inside a popup if its content exceeds it.
|
|
4497
|
+
// The scrollable container can be styled using the
|
|
4498
|
+
// `leaflet-popup-scrolled` CSS class selector.
|
|
3460
4499
|
maxHeight: null,
|
|
4500
|
+
// @option autoPan: Boolean = true
|
|
4501
|
+
// Set it to `false` if you don't want the map to do panning animation
|
|
4502
|
+
// to fit the opened popup.
|
|
3461
4503
|
autoPan: !0,
|
|
4504
|
+
// @option autoPanPaddingTopLeft: Point = null
|
|
4505
|
+
// The margin between the popup and the top left corner of the map
|
|
4506
|
+
// view after autopanning was performed.
|
|
3462
4507
|
autoPanPaddingTopLeft: null,
|
|
4508
|
+
// @option autoPanPaddingBottomRight: Point = null
|
|
4509
|
+
// The margin between the popup and the bottom right corner of the map
|
|
4510
|
+
// view after autopanning was performed.
|
|
3463
4511
|
autoPanPaddingBottomRight: null,
|
|
4512
|
+
// @option autoPanPadding: Point = Point(5, 5)
|
|
4513
|
+
// Equivalent of setting both top left and bottom right autopan padding to the same value.
|
|
3464
4514
|
autoPanPadding: [5, 5],
|
|
4515
|
+
// @option keepInView: Boolean = false
|
|
4516
|
+
// Set it to `true` if you want to prevent users from panning the popup
|
|
4517
|
+
// off of the screen while it is open.
|
|
3465
4518
|
keepInView: !1,
|
|
4519
|
+
// @option closeButton: Boolean = true
|
|
4520
|
+
// Controls the presence of a close button in the popup.
|
|
3466
4521
|
closeButton: !0,
|
|
4522
|
+
// @option autoClose: Boolean = true
|
|
4523
|
+
// Set it to `false` if you want to override the default behavior of
|
|
4524
|
+
// the popup closing when another popup is opened.
|
|
3467
4525
|
autoClose: !0,
|
|
4526
|
+
// @option closeOnEscapeKey: Boolean = true
|
|
4527
|
+
// Set it to `false` if you want to override the default behavior of
|
|
4528
|
+
// the ESC key for closing of the popup.
|
|
3468
4529
|
closeOnEscapeKey: !0,
|
|
4530
|
+
// @option closeOnClick: Boolean = *
|
|
4531
|
+
// Set it if you want to override the default behavior of the popup closing when user clicks
|
|
4532
|
+
// on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option.
|
|
4533
|
+
// @option className: String = ''
|
|
4534
|
+
// A custom CSS class name to assign to the popup.
|
|
3469
4535
|
className: ""
|
|
3470
4536
|
},
|
|
4537
|
+
// @namespace Popup
|
|
4538
|
+
// @method openOn(map: Map): this
|
|
4539
|
+
// Alternative to `map.openPopup(popup)`.
|
|
4540
|
+
// Adds the popup to the map and closes the previous one.
|
|
3471
4541
|
openOn: function(t) {
|
|
3472
4542
|
return t = arguments.length ? t : this._source._map, !t.hasLayer(this) && t._popup && t._popup.options.autoClose && t.removeLayer(t._popup), t._popup = this, X.prototype.openOn.call(this, t);
|
|
3473
4543
|
},
|
|
@@ -3527,14 +4597,25 @@ g.mergeOptions({
|
|
|
3527
4597
|
closePopupOnClick: !0
|
|
3528
4598
|
});
|
|
3529
4599
|
g.include({
|
|
4600
|
+
// @method openPopup(popup: Popup): this
|
|
4601
|
+
// Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
|
|
4602
|
+
// @alternative
|
|
4603
|
+
// @method openPopup(content: String|HTMLElement, latlng: LatLng, options?: Popup options): this
|
|
4604
|
+
// Creates a popup with the specified content and options and opens it in the given point on a map.
|
|
3530
4605
|
openPopup: function(t, e, i) {
|
|
3531
4606
|
return this._initOverlay(Fe, t, e, i).openOn(this), this;
|
|
3532
4607
|
},
|
|
4608
|
+
// @method closePopup(popup?: Popup): this
|
|
4609
|
+
// Closes the popup previously opened with [openPopup](#map-openpopup) (or the given one).
|
|
3533
4610
|
closePopup: function(t) {
|
|
3534
4611
|
return t = arguments.length ? t : this._popup, t && t.close(), this;
|
|
3535
4612
|
}
|
|
3536
4613
|
});
|
|
3537
4614
|
Y.include({
|
|
4615
|
+
// @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this
|
|
4616
|
+
// Binds a popup to the layer with the passed `content` and sets up the
|
|
4617
|
+
// necessary event listeners. If a `Function` is passed it will receive
|
|
4618
|
+
// the layer as the first argument and should return a `String` or `HTMLElement`.
|
|
3538
4619
|
bindPopup: function(t, e) {
|
|
3539
4620
|
return this._popup = this._initOverlay(Fe, this._popup, t, e), this._popupHandlersAdded || (this.on({
|
|
3540
4621
|
click: this._openPopup,
|
|
@@ -3543,6 +4624,8 @@ Y.include({
|
|
|
3543
4624
|
move: this._movePopup
|
|
3544
4625
|
}), this._popupHandlersAdded = !0), this;
|
|
3545
4626
|
},
|
|
4627
|
+
// @method unbindPopup(): this
|
|
4628
|
+
// Removes the popup previously bound with `bindPopup`.
|
|
3546
4629
|
unbindPopup: function() {
|
|
3547
4630
|
return this._popup && (this.off({
|
|
3548
4631
|
click: this._openPopup,
|
|
@@ -3551,21 +4634,33 @@ Y.include({
|
|
|
3551
4634
|
move: this._movePopup
|
|
3552
4635
|
}), this._popupHandlersAdded = !1, this._popup = null), this;
|
|
3553
4636
|
},
|
|
4637
|
+
// @method openPopup(latlng?: LatLng): this
|
|
4638
|
+
// Opens the bound popup at the specified `latlng` or at the default popup anchor if no `latlng` is passed.
|
|
3554
4639
|
openPopup: function(t) {
|
|
3555
4640
|
return this._popup && (this instanceof et || (this._popup._source = this), this._popup._prepareOpen(t || this._latlng) && this._popup.openOn(this._map)), this;
|
|
3556
4641
|
},
|
|
4642
|
+
// @method closePopup(): this
|
|
4643
|
+
// Closes the popup bound to this layer if it is open.
|
|
3557
4644
|
closePopup: function() {
|
|
3558
4645
|
return this._popup && this._popup.close(), this;
|
|
3559
4646
|
},
|
|
4647
|
+
// @method togglePopup(): this
|
|
4648
|
+
// Opens or closes the popup bound to this layer depending on its current state.
|
|
3560
4649
|
togglePopup: function() {
|
|
3561
4650
|
return this._popup && this._popup.toggle(this), this;
|
|
3562
4651
|
},
|
|
4652
|
+
// @method isPopupOpen(): boolean
|
|
4653
|
+
// Returns `true` if the popup bound to this layer is currently open.
|
|
3563
4654
|
isPopupOpen: function() {
|
|
3564
4655
|
return this._popup ? this._popup.isOpen() : !1;
|
|
3565
4656
|
},
|
|
4657
|
+
// @method setPopupContent(content: String|HTMLElement|Popup): this
|
|
4658
|
+
// Sets the content of the popup bound to this layer.
|
|
3566
4659
|
setPopupContent: function(t) {
|
|
3567
4660
|
return this._popup && this._popup.setContent(t), this;
|
|
3568
4661
|
},
|
|
4662
|
+
// @method getPopup(): Popup
|
|
4663
|
+
// Returns the popup bound to this layer.
|
|
3569
4664
|
getPopup: function() {
|
|
3570
4665
|
return this._popup;
|
|
3571
4666
|
},
|
|
@@ -3588,12 +4683,29 @@ Y.include({
|
|
|
3588
4683
|
}
|
|
3589
4684
|
});
|
|
3590
4685
|
var We = X.extend({
|
|
4686
|
+
// @section
|
|
4687
|
+
// @aka Tooltip options
|
|
3591
4688
|
options: {
|
|
4689
|
+
// @option pane: String = 'tooltipPane'
|
|
4690
|
+
// `Map pane` where the tooltip will be added.
|
|
3592
4691
|
pane: "tooltipPane",
|
|
4692
|
+
// @option offset: Point = Point(0, 0)
|
|
4693
|
+
// Optional offset of the tooltip position.
|
|
3593
4694
|
offset: [0, 0],
|
|
4695
|
+
// @option direction: String = 'auto'
|
|
4696
|
+
// Direction where to open the tooltip. Possible values are: `right`, `left`,
|
|
4697
|
+
// `top`, `bottom`, `center`, `auto`.
|
|
4698
|
+
// `auto` will dynamically switch between `right` and `left` according to the tooltip
|
|
4699
|
+
// position on the map.
|
|
3594
4700
|
direction: "auto",
|
|
4701
|
+
// @option permanent: Boolean = false
|
|
4702
|
+
// Whether to open the tooltip permanently or only on mouseover.
|
|
3595
4703
|
permanent: !1,
|
|
4704
|
+
// @option sticky: Boolean = false
|
|
4705
|
+
// If true, the tooltip will follow the mouse instead of being fixed at the feature center.
|
|
3596
4706
|
sticky: !1,
|
|
4707
|
+
// @option opacity: Number = 0.9
|
|
4708
|
+
// Tooltip container opacity.
|
|
3597
4709
|
opacity: 0.9
|
|
3598
4710
|
},
|
|
3599
4711
|
onAdd: function(t) {
|
|
@@ -3636,17 +4748,30 @@ var We = X.extend({
|
|
|
3636
4748
|
return new We(t, e);
|
|
3637
4749
|
};
|
|
3638
4750
|
g.include({
|
|
4751
|
+
// @method openTooltip(tooltip: Tooltip): this
|
|
4752
|
+
// Opens the specified tooltip.
|
|
4753
|
+
// @alternative
|
|
4754
|
+
// @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this
|
|
4755
|
+
// Creates a tooltip with the specified content and options and open it.
|
|
3639
4756
|
openTooltip: function(t, e, i) {
|
|
3640
4757
|
return this._initOverlay(We, t, e, i).openOn(this), this;
|
|
3641
4758
|
},
|
|
4759
|
+
// @method closeTooltip(tooltip: Tooltip): this
|
|
4760
|
+
// Closes the tooltip given as parameter.
|
|
3642
4761
|
closeTooltip: function(t) {
|
|
3643
4762
|
return t.close(), this;
|
|
3644
4763
|
}
|
|
3645
4764
|
});
|
|
3646
4765
|
Y.include({
|
|
4766
|
+
// @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this
|
|
4767
|
+
// Binds a tooltip to the layer with the passed `content` and sets up the
|
|
4768
|
+
// necessary event listeners. If a `Function` is passed it will receive
|
|
4769
|
+
// the layer as the first argument and should return a `String` or `HTMLElement`.
|
|
3647
4770
|
bindTooltip: function(t, e) {
|
|
3648
4771
|
return this._tooltip && this.isTooltipOpen() && this.unbindTooltip(), this._tooltip = this._initOverlay(We, this._tooltip, t, e), this._initTooltipInteractions(), this._tooltip.options.permanent && this._map && this._map.hasLayer(this) && this.openTooltip(), this;
|
|
3649
4772
|
},
|
|
4773
|
+
// @method unbindTooltip(): this
|
|
4774
|
+
// Removes the tooltip previously bound with `bindTooltip`.
|
|
3650
4775
|
unbindTooltip: function() {
|
|
3651
4776
|
return this._tooltip && (this._initTooltipInteractions(!0), this.closeTooltip(), this._tooltip = null), this;
|
|
3652
4777
|
},
|
|
@@ -3659,22 +4784,34 @@ Y.include({
|
|
|
3659
4784
|
this._tooltip.options.permanent ? i.add = this._openTooltip : (i.mouseover = this._openTooltip, i.mouseout = this.closeTooltip, i.click = this._openTooltip, this._map ? this._addFocusListeners() : i.add = this._addFocusListeners), this._tooltip.options.sticky && (i.mousemove = this._moveTooltip), this[e](i), this._tooltipHandlersAdded = !t;
|
|
3660
4785
|
}
|
|
3661
4786
|
},
|
|
4787
|
+
// @method openTooltip(latlng?: LatLng): this
|
|
4788
|
+
// Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed.
|
|
3662
4789
|
openTooltip: function(t) {
|
|
3663
4790
|
return this._tooltip && (this instanceof et || (this._tooltip._source = this), this._tooltip._prepareOpen(t) && (this._tooltip.openOn(this._map), this.getElement ? this._setAriaDescribedByOnLayer(this) : this.eachLayer && this.eachLayer(this._setAriaDescribedByOnLayer, this))), this;
|
|
3664
4791
|
},
|
|
4792
|
+
// @method closeTooltip(): this
|
|
4793
|
+
// Closes the tooltip bound to this layer if it is open.
|
|
3665
4794
|
closeTooltip: function() {
|
|
3666
4795
|
if (this._tooltip)
|
|
3667
4796
|
return this._tooltip.close();
|
|
3668
4797
|
},
|
|
4798
|
+
// @method toggleTooltip(): this
|
|
4799
|
+
// Opens or closes the tooltip bound to this layer depending on its current state.
|
|
3669
4800
|
toggleTooltip: function() {
|
|
3670
4801
|
return this._tooltip && this._tooltip.toggle(this), this;
|
|
3671
4802
|
},
|
|
4803
|
+
// @method isTooltipOpen(): boolean
|
|
4804
|
+
// Returns `true` if the tooltip bound to this layer is currently open.
|
|
3672
4805
|
isTooltipOpen: function() {
|
|
3673
4806
|
return this._tooltip.isOpen();
|
|
3674
4807
|
},
|
|
4808
|
+
// @method setTooltipContent(content: String|HTMLElement|Tooltip): this
|
|
4809
|
+
// Sets the content of the tooltip bound to this layer.
|
|
3675
4810
|
setTooltipContent: function(t) {
|
|
3676
4811
|
return this._tooltip && this._tooltip.setContent(t), this;
|
|
3677
4812
|
},
|
|
4813
|
+
// @method getTooltip(): Tooltip
|
|
4814
|
+
// Returns the tooltip bound to this layer.
|
|
3678
4815
|
getTooltip: function() {
|
|
3679
4816
|
return this._tooltip;
|
|
3680
4817
|
},
|
|
@@ -3701,8 +4838,18 @@ Y.include({
|
|
|
3701
4838
|
});
|
|
3702
4839
|
var io = St.extend({
|
|
3703
4840
|
options: {
|
|
4841
|
+
// @section
|
|
4842
|
+
// @aka DivIcon options
|
|
3704
4843
|
iconSize: [12, 12],
|
|
4844
|
+
// also can be set through CSS
|
|
4845
|
+
// iconAnchor: (Point),
|
|
4846
|
+
// popupAnchor: (Point),
|
|
4847
|
+
// @option html: String|HTMLElement = ''
|
|
4848
|
+
// Custom HTML code to put inside the div element, empty by default. Alternatively,
|
|
4849
|
+
// an instance of `HTMLElement`.
|
|
3705
4850
|
html: !1,
|
|
4851
|
+
// @option bgPos: Point = [0, 0]
|
|
4852
|
+
// Optional relative position of the background, in pixels
|
|
3706
4853
|
bgPos: null,
|
|
3707
4854
|
className: "leaflet-div-icon"
|
|
3708
4855
|
},
|
|
@@ -3723,21 +4870,64 @@ function Ao(t) {
|
|
|
3723
4870
|
}
|
|
3724
4871
|
St.Default = Lt;
|
|
3725
4872
|
var Dt = Y.extend({
|
|
4873
|
+
// @section
|
|
4874
|
+
// @aka GridLayer options
|
|
3726
4875
|
options: {
|
|
4876
|
+
// @option tileSize: Number|Point = 256
|
|
4877
|
+
// Width and height of tiles in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.
|
|
3727
4878
|
tileSize: 256,
|
|
4879
|
+
// @option opacity: Number = 1.0
|
|
4880
|
+
// Opacity of the tiles. Can be used in the `createTile()` function.
|
|
3728
4881
|
opacity: 1,
|
|
4882
|
+
// @option updateWhenIdle: Boolean = (depends)
|
|
4883
|
+
// Load new tiles only when panning ends.
|
|
4884
|
+
// `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
|
|
4885
|
+
// `false` otherwise in order to display new tiles _during_ panning, since it is easy to pan outside the
|
|
4886
|
+
// [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.
|
|
3729
4887
|
updateWhenIdle: c.mobile,
|
|
4888
|
+
// @option updateWhenZooming: Boolean = true
|
|
4889
|
+
// By default, a smooth zoom animation (during a [touch zoom](#map-touchzoom) or a [`flyTo()`](#map-flyto)) will update grid layers every integer zoom level. Setting this option to `false` will update the grid layer only when the smooth animation ends.
|
|
3730
4890
|
updateWhenZooming: !0,
|
|
4891
|
+
// @option updateInterval: Number = 200
|
|
4892
|
+
// Tiles will not update more than once every `updateInterval` milliseconds when panning.
|
|
3731
4893
|
updateInterval: 200,
|
|
4894
|
+
// @option zIndex: Number = 1
|
|
4895
|
+
// The explicit zIndex of the tile layer.
|
|
3732
4896
|
zIndex: 1,
|
|
4897
|
+
// @option bounds: LatLngBounds = undefined
|
|
4898
|
+
// If set, tiles will only be loaded inside the set `LatLngBounds`.
|
|
3733
4899
|
bounds: null,
|
|
4900
|
+
// @option minZoom: Number = 0
|
|
4901
|
+
// The minimum zoom level down to which this layer will be displayed (inclusive).
|
|
3734
4902
|
minZoom: 0,
|
|
4903
|
+
// @option maxZoom: Number = undefined
|
|
4904
|
+
// The maximum zoom level up to which this layer will be displayed (inclusive).
|
|
3735
4905
|
maxZoom: void 0,
|
|
4906
|
+
// @option maxNativeZoom: Number = undefined
|
|
4907
|
+
// Maximum zoom number the tile source has available. If it is specified,
|
|
4908
|
+
// the tiles on all zoom levels higher than `maxNativeZoom` will be loaded
|
|
4909
|
+
// from `maxNativeZoom` level and auto-scaled.
|
|
3736
4910
|
maxNativeZoom: void 0,
|
|
4911
|
+
// @option minNativeZoom: Number = undefined
|
|
4912
|
+
// Minimum zoom number the tile source has available. If it is specified,
|
|
4913
|
+
// the tiles on all zoom levels lower than `minNativeZoom` will be loaded
|
|
4914
|
+
// from `minNativeZoom` level and auto-scaled.
|
|
3737
4915
|
minNativeZoom: void 0,
|
|
4916
|
+
// @option noWrap: Boolean = false
|
|
4917
|
+
// Whether the layer is wrapped around the antimeridian. If `true`, the
|
|
4918
|
+
// GridLayer will only be displayed once at low zoom levels. Has no
|
|
4919
|
+
// effect when the [map CRS](#map-crs) doesn't wrap around. Can be used
|
|
4920
|
+
// in combination with [`bounds`](#gridlayer-bounds) to prevent requesting
|
|
4921
|
+
// tiles outside the CRS limits.
|
|
3738
4922
|
noWrap: !1,
|
|
4923
|
+
// @option pane: String = 'tilePane'
|
|
4924
|
+
// `Map pane` where the grid layer will be added.
|
|
3739
4925
|
pane: "tilePane",
|
|
4926
|
+
// @option className: String = ''
|
|
4927
|
+
// A custom class name to assign to the tile layer. Empty by default.
|
|
3740
4928
|
className: "",
|
|
4929
|
+
// @option keepBuffer: Number = 2
|
|
4930
|
+
// When panning the map, keep this many rows and columns of tiles before unloading them.
|
|
3741
4931
|
keepBuffer: 2
|
|
3742
4932
|
},
|
|
3743
4933
|
initialize: function(t) {
|
|
@@ -3752,24 +4942,38 @@ var Dt = Y.extend({
|
|
|
3752
4942
|
onRemove: function(t) {
|
|
3753
4943
|
this._removeAllTiles(), C(this._container), t._removeZoomLimit(this), this._container = null, this._tileZoom = void 0;
|
|
3754
4944
|
},
|
|
4945
|
+
// @method bringToFront: this
|
|
4946
|
+
// Brings the tile layer to the top of all tile layers.
|
|
3755
4947
|
bringToFront: function() {
|
|
3756
4948
|
return this._map && (vt(this._container), this._setAutoZIndex(Math.max)), this;
|
|
3757
4949
|
},
|
|
4950
|
+
// @method bringToBack: this
|
|
4951
|
+
// Brings the tile layer to the bottom of all tile layers.
|
|
3758
4952
|
bringToBack: function() {
|
|
3759
4953
|
return this._map && (gt(this._container), this._setAutoZIndex(Math.min)), this;
|
|
3760
4954
|
},
|
|
4955
|
+
// @method getContainer: HTMLElement
|
|
4956
|
+
// Returns the HTML element that contains the tiles for this layer.
|
|
3761
4957
|
getContainer: function() {
|
|
3762
4958
|
return this._container;
|
|
3763
4959
|
},
|
|
4960
|
+
// @method setOpacity(opacity: Number): this
|
|
4961
|
+
// Changes the [opacity](#gridlayer-opacity) of the grid layer.
|
|
3764
4962
|
setOpacity: function(t) {
|
|
3765
4963
|
return this.options.opacity = t, this._updateOpacity(), this;
|
|
3766
4964
|
},
|
|
4965
|
+
// @method setZIndex(zIndex: Number): this
|
|
4966
|
+
// Changes the [zIndex](#gridlayer-zindex) of the grid layer.
|
|
3767
4967
|
setZIndex: function(t) {
|
|
3768
4968
|
return this.options.zIndex = t, this._updateZIndex(), this;
|
|
3769
4969
|
},
|
|
4970
|
+
// @method isLoading: Boolean
|
|
4971
|
+
// Returns `true` if any tile in the grid layer has not finished loading.
|
|
3770
4972
|
isLoading: function() {
|
|
3771
4973
|
return this._loading;
|
|
3772
4974
|
},
|
|
4975
|
+
// @method redraw: this
|
|
4976
|
+
// Causes the layer to clear all the tiles and request them again.
|
|
3773
4977
|
redraw: function() {
|
|
3774
4978
|
if (this._map) {
|
|
3775
4979
|
this._removeAllTiles();
|
|
@@ -3787,9 +4991,18 @@ var Dt = Y.extend({
|
|
|
3787
4991
|
};
|
|
3788
4992
|
return this.options.updateWhenIdle || (this._onMove || (this._onMove = oi(this._onMoveEnd, this.options.updateInterval, this)), t.move = this._onMove), this._zoomAnimated && (t.zoomanim = this._animateZoom), t;
|
|
3789
4993
|
},
|
|
4994
|
+
// @section Extension methods
|
|
4995
|
+
// Layers extending `GridLayer` shall reimplement the following method.
|
|
4996
|
+
// @method createTile(coords: Object, done?: Function): HTMLElement
|
|
4997
|
+
// Called only internally, must be overridden by classes extending `GridLayer`.
|
|
4998
|
+
// Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback
|
|
4999
|
+
// is specified, it must be called when the tile has finished loading and drawing.
|
|
3790
5000
|
createTile: function() {
|
|
3791
5001
|
return document.createElement("div");
|
|
3792
5002
|
},
|
|
5003
|
+
// @section
|
|
5004
|
+
// @method getTileSize: Point
|
|
5005
|
+
// Normalizes the [tileSize option](#gridlayer-tilesize) into a point. Used by the `createTile()` method.
|
|
3793
5006
|
getTileSize: function() {
|
|
3794
5007
|
var t = this.options.tileSize;
|
|
3795
5008
|
return t instanceof m ? t : new m(t, t);
|
|
@@ -3925,6 +5138,7 @@ var Dt = Y.extend({
|
|
|
3925
5138
|
var e = this._map, i = e._animatingZoom ? Math.max(e._animateToZoom, e.getZoom()) : e.getZoom(), n = e.getZoomScale(i, this._tileZoom), o = e.project(t, this._tileZoom).floor(), s = e.getSize().divideBy(n * 2);
|
|
3926
5139
|
return new S(o.subtract(s), o.add(s));
|
|
3927
5140
|
},
|
|
5141
|
+
// Private method to load tiles in the grid's active zoom level according to map bounds
|
|
3928
5142
|
_update: function(t) {
|
|
3929
5143
|
var e = this._map;
|
|
3930
5144
|
if (e) {
|
|
@@ -3983,13 +5197,16 @@ var Dt = Y.extend({
|
|
|
3983
5197
|
var e = this._map, i = this.getTileSize(), n = t.scaleBy(i), o = n.add(i), s = e.unproject(n, t.z), r = e.unproject(o, t.z);
|
|
3984
5198
|
return [s, r];
|
|
3985
5199
|
},
|
|
5200
|
+
// converts tile coordinates to its geographical bounds
|
|
3986
5201
|
_tileCoordsToBounds: function(t) {
|
|
3987
5202
|
var e = this._tileCoordsToNwSe(t), i = new R(e[0], e[1]);
|
|
3988
5203
|
return this.options.noWrap || (i = this._map.wrapLatLngBounds(i)), i;
|
|
3989
5204
|
},
|
|
5205
|
+
// converts tile coordinates to key for the tile cache
|
|
3990
5206
|
_tileCoordsToKey: function(t) {
|
|
3991
5207
|
return t.x + ":" + t.y + ":" + t.z;
|
|
3992
5208
|
},
|
|
5209
|
+
// converts tile cache key to coordinates
|
|
3993
5210
|
_keyToTileCoords: function(t) {
|
|
3994
5211
|
var e = t.split(":"), i = new m(+e[0], +e[1]);
|
|
3995
5212
|
return i.z = +e[2], i;
|
|
@@ -4057,28 +5274,70 @@ function Bo(t) {
|
|
|
4057
5274
|
return new Dt(t);
|
|
4058
5275
|
}
|
|
4059
5276
|
var Tt = Dt.extend({
|
|
5277
|
+
// @section
|
|
5278
|
+
// @aka TileLayer options
|
|
4060
5279
|
options: {
|
|
5280
|
+
// @option minZoom: Number = 0
|
|
5281
|
+
// The minimum zoom level down to which this layer will be displayed (inclusive).
|
|
4061
5282
|
minZoom: 0,
|
|
5283
|
+
// @option maxZoom: Number = 18
|
|
5284
|
+
// The maximum zoom level up to which this layer will be displayed (inclusive).
|
|
4062
5285
|
maxZoom: 18,
|
|
5286
|
+
// @option subdomains: String|String[] = 'abc'
|
|
5287
|
+
// Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
|
|
4063
5288
|
subdomains: "abc",
|
|
5289
|
+
// @option errorTileUrl: String = ''
|
|
5290
|
+
// URL to the tile image to show in place of the tile that failed to load.
|
|
4064
5291
|
errorTileUrl: "",
|
|
5292
|
+
// @option zoomOffset: Number = 0
|
|
5293
|
+
// The zoom number used in tile URLs will be offset with this value.
|
|
4065
5294
|
zoomOffset: 0,
|
|
5295
|
+
// @option tms: Boolean = false
|
|
5296
|
+
// If `true`, inverses Y axis numbering for tiles (turn this on for [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) services).
|
|
4066
5297
|
tms: !1,
|
|
5298
|
+
// @option zoomReverse: Boolean = false
|
|
5299
|
+
// If set to true, the zoom number used in tile URLs will be reversed (`maxZoom - zoom` instead of `zoom`)
|
|
4067
5300
|
zoomReverse: !1,
|
|
5301
|
+
// @option detectRetina: Boolean = false
|
|
5302
|
+
// If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
|
|
4068
5303
|
detectRetina: !1,
|
|
5304
|
+
// @option crossOrigin: Boolean|String = false
|
|
5305
|
+
// Whether the crossOrigin attribute will be added to the tiles.
|
|
5306
|
+
// If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
|
|
5307
|
+
// Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.
|
|
4069
5308
|
crossOrigin: !1,
|
|
5309
|
+
// @option referrerPolicy: Boolean|String = false
|
|
5310
|
+
// Whether the referrerPolicy attribute will be added to the tiles.
|
|
5311
|
+
// If a String is provided, all tiles will have their referrerPolicy attribute set to the String provided.
|
|
5312
|
+
// This may be needed if your map's rendering context has a strict default but your tile provider expects a valid referrer
|
|
5313
|
+
// (e.g. to validate an API token).
|
|
5314
|
+
// Refer to [HTMLImageElement.referrerPolicy](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/referrerPolicy) for valid String values.
|
|
4070
5315
|
referrerPolicy: !1
|
|
4071
5316
|
},
|
|
4072
5317
|
initialize: function(t, e) {
|
|
4073
5318
|
this._url = t, e = z(this, e), e.detectRetina && c.retina && e.maxZoom > 0 ? (e.tileSize = Math.floor(e.tileSize / 2), e.zoomReverse ? (e.zoomOffset--, e.minZoom = Math.min(e.maxZoom, e.minZoom + 1)) : (e.zoomOffset++, e.maxZoom = Math.max(e.minZoom, e.maxZoom - 1)), e.minZoom = Math.max(0, e.minZoom)) : e.zoomReverse ? e.minZoom = Math.min(e.maxZoom, e.minZoom) : e.maxZoom = Math.max(e.minZoom, e.maxZoom), typeof e.subdomains == "string" && (e.subdomains = e.subdomains.split("")), this.on("tileunload", this._onTileRemove);
|
|
4074
5319
|
},
|
|
5320
|
+
// @method setUrl(url: String, noRedraw?: Boolean): this
|
|
5321
|
+
// Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`).
|
|
5322
|
+
// If the URL does not change, the layer will not be redrawn unless
|
|
5323
|
+
// the noRedraw parameter is set to false.
|
|
4075
5324
|
setUrl: function(t, e) {
|
|
4076
5325
|
return this._url === t && e === void 0 && (e = !0), this._url = t, e || this.redraw(), this;
|
|
4077
5326
|
},
|
|
5327
|
+
// @method createTile(coords: Object, done?: Function): HTMLElement
|
|
5328
|
+
// Called only internally, overrides GridLayer's [`createTile()`](#gridlayer-createtile)
|
|
5329
|
+
// to return an `<img>` HTML element with the appropriate image URL given `coords`. The `done`
|
|
5330
|
+
// callback is called when the tile has been loaded.
|
|
4078
5331
|
createTile: function(t, e) {
|
|
4079
5332
|
var i = document.createElement("img");
|
|
4080
5333
|
return _(i, "load", M(this._tileOnLoad, this, e, i)), _(i, "error", M(this._tileOnError, this, e, i)), (this.options.crossOrigin || this.options.crossOrigin === "") && (i.crossOrigin = this.options.crossOrigin === !0 ? "" : this.options.crossOrigin), typeof this.options.referrerPolicy == "string" && (i.referrerPolicy = this.options.referrerPolicy), i.alt = "", i.src = this.getTileUrl(t), i;
|
|
4081
5334
|
},
|
|
5335
|
+
// @section Extension methods
|
|
5336
|
+
// @uninheritable
|
|
5337
|
+
// Layers extending `TileLayer` might reimplement the following method.
|
|
5338
|
+
// @method getTileUrl(coords: Object): String
|
|
5339
|
+
// Called only internally, returns the URL for a tile given its coordinates.
|
|
5340
|
+
// Classes extending `TileLayer` can override this function to provide custom tile URL naming schemes.
|
|
4082
5341
|
getTileUrl: function(t) {
|
|
4083
5342
|
var e = {
|
|
4084
5343
|
r: c.retina ? "@2x" : "",
|
|
@@ -4111,6 +5370,7 @@ var Tt = Dt.extend({
|
|
|
4111
5370
|
var e = Math.abs(t.x + t.y) % this.options.subdomains.length;
|
|
4112
5371
|
return this.options.subdomains[e];
|
|
4113
5372
|
},
|
|
5373
|
+
// stops loading all tiles in the background layer
|
|
4114
5374
|
_abortLoading: function() {
|
|
4115
5375
|
var t, e;
|
|
4116
5376
|
for (t in this._tiles)
|
|
@@ -4137,17 +5397,37 @@ function no(t, e) {
|
|
|
4137
5397
|
return new Tt(t, e);
|
|
4138
5398
|
}
|
|
4139
5399
|
var Vi = Tt.extend({
|
|
5400
|
+
// @section
|
|
5401
|
+
// @aka TileLayer.WMS options
|
|
5402
|
+
// If any custom options not documented here are used, they will be sent to the
|
|
5403
|
+
// WMS server as extra parameters in each request URL. This can be useful for
|
|
5404
|
+
// [non-standard vendor WMS parameters](https://docs.geoserver.org/stable/en/user/services/wms/vendor.html).
|
|
4140
5405
|
defaultWmsParams: {
|
|
4141
5406
|
service: "WMS",
|
|
4142
5407
|
request: "GetMap",
|
|
5408
|
+
// @option layers: String = ''
|
|
5409
|
+
// **(required)** Comma-separated list of WMS layers to show.
|
|
4143
5410
|
layers: "",
|
|
5411
|
+
// @option styles: String = ''
|
|
5412
|
+
// Comma-separated list of WMS styles.
|
|
4144
5413
|
styles: "",
|
|
5414
|
+
// @option format: String = 'image/jpeg'
|
|
5415
|
+
// WMS image format (use `'image/png'` for layers with transparency).
|
|
4145
5416
|
format: "image/jpeg",
|
|
5417
|
+
// @option transparent: Boolean = false
|
|
5418
|
+
// If `true`, the WMS service will return images with transparency.
|
|
4146
5419
|
transparent: !1,
|
|
5420
|
+
// @option version: String = '1.1.1'
|
|
5421
|
+
// Version of the WMS service to use
|
|
4147
5422
|
version: "1.1.1"
|
|
4148
5423
|
},
|
|
4149
5424
|
options: {
|
|
5425
|
+
// @option crs: CRS = null
|
|
5426
|
+
// Coordinate Reference System to use for the WMS requests, defaults to
|
|
5427
|
+
// map CRS. Don't change this if you're not sure what it means.
|
|
4150
5428
|
crs: null,
|
|
5429
|
+
// @option uppercase: Boolean = false
|
|
5430
|
+
// If `true`, WMS request parameter keys will be uppercase.
|
|
4151
5431
|
uppercase: !1
|
|
4152
5432
|
},
|
|
4153
5433
|
initialize: function(t, e) {
|
|
@@ -4168,6 +5448,8 @@ var Vi = Tt.extend({
|
|
|
4168
5448
|
var e = this._tileCoordsToNwSe(t), i = this._crs, n = N(i.project(e[0]), i.project(e[1])), o = n.min, s = n.max, r = (this._wmsVersion >= 1.3 && this._crs === Ui ? [o.y, o.x, s.y, s.x] : [o.x, o.y, s.x, s.y]).join(","), a = Tt.prototype.getTileUrl.call(this, t);
|
|
4169
5449
|
return a + si(this.wmsParams, a, this.options.uppercase) + (this.options.uppercase ? "&BBOX=" : "&bbox=") + r;
|
|
4170
5450
|
},
|
|
5451
|
+
// @method setParams(params: Object, noRedraw?: Boolean): this
|
|
5452
|
+
// Merges an object with the new parameters and re-requests tiles on the current screen (unless `noRedraw` was set to true).
|
|
4171
5453
|
setParams: function(t, e) {
|
|
4172
5454
|
return P(this.wmsParams, t), e || this.redraw(), this;
|
|
4173
5455
|
}
|
|
@@ -4178,7 +5460,12 @@ function oo(t, e) {
|
|
|
4178
5460
|
Tt.WMS = Vi;
|
|
4179
5461
|
no.wms = oo;
|
|
4180
5462
|
var Q = Y.extend({
|
|
5463
|
+
// @section
|
|
5464
|
+
// @aka Renderer options
|
|
4181
5465
|
options: {
|
|
5466
|
+
// @option padding: Number = 0.1
|
|
5467
|
+
// How much to extend the clip area around the map view (relative to its size)
|
|
5468
|
+
// e.g. 0.1 would be 10% of map view in each direction
|
|
4182
5469
|
padding: 0.1
|
|
4183
5470
|
},
|
|
4184
5471
|
initialize: function(t) {
|
|
@@ -4227,7 +5514,11 @@ var Q = Y.extend({
|
|
|
4227
5514
|
this._bounds = new S(i, i.add(e.multiplyBy(1 + t * 2)).round()), this._center = this._map.getCenter(), this._zoom = this._map.getZoom();
|
|
4228
5515
|
}
|
|
4229
5516
|
}), so = Q.extend({
|
|
5517
|
+
// @section
|
|
5518
|
+
// @aka Canvas options
|
|
4230
5519
|
options: {
|
|
5520
|
+
// @option tolerance: Number = 0
|
|
5521
|
+
// How much to extend the click tolerance around a path/object on the map.
|
|
4231
5522
|
tolerance: 0
|
|
4232
5523
|
},
|
|
4233
5524
|
getEvents: function() {
|
|
@@ -4354,6 +5645,8 @@ var Q = Y.extend({
|
|
|
4354
5645
|
var i = e.options;
|
|
4355
5646
|
i.fill && (t.globalAlpha = i.fillOpacity, t.fillStyle = i.fillColor || i.color, t.fill(i.fillRule || "evenodd")), i.stroke && i.weight !== 0 && (t.setLineDash && t.setLineDash(e.options && e.options._dashArray || []), t.globalAlpha = i.opacity, t.lineWidth = i.weight, t.strokeStyle = i.color, t.lineCap = i.lineCap, t.lineJoin = i.lineJoin, t.stroke());
|
|
4356
5647
|
},
|
|
5648
|
+
// Canvas obviously doesn't have mouse events for individual drawn objects,
|
|
5649
|
+
// so we emulate that by calculating what's under the mouse on mousemove/click manually
|
|
4357
5650
|
_onClick: function(t) {
|
|
4358
5651
|
for (var e = this._map.mouseEventToLayerPoint(t), i, n, o = this._drawFirst; o; o = o.next)
|
|
4359
5652
|
i = o.layer, i.options.interactive && i._containsPoint(e) && (!(t.type === "click" || t.type === "preclick") || !this._map._draggableMoved(i)) && (n = i);
|
|
@@ -4467,6 +5760,7 @@ var xt = function() {
|
|
|
4467
5760
|
(!this._svgSize || !this._svgSize.equals(e)) && (this._svgSize = e, i.setAttribute("width", e.x), i.setAttribute("height", e.y)), O(i, t.min), i.setAttribute("viewBox", [t.min.x, t.min.y, e.x, e.y].join(" ")), this.fire("update");
|
|
4468
5761
|
}
|
|
4469
5762
|
},
|
|
5763
|
+
// methods below are called by vector layers implementations
|
|
4470
5764
|
_initPath: function(t) {
|
|
4471
5765
|
var e = t._path = Ht("path");
|
|
4472
5766
|
t.options.className && p(e, t.options.className), t.options.interactive && p(e, "leaflet-interactive"), this._updateStyle(t), this._layers[x(t)] = t;
|
|
@@ -4494,6 +5788,7 @@ var xt = function() {
|
|
|
4494
5788
|
_setPath: function(t, e) {
|
|
4495
5789
|
t._path.setAttribute("d", e);
|
|
4496
5790
|
},
|
|
5791
|
+
// SVG does not have the concept of zIndex so we resort to changing the DOM order of elements
|
|
4497
5792
|
_bringToFront: function(t) {
|
|
4498
5793
|
vt(t._path);
|
|
4499
5794
|
},
|
|
@@ -4506,6 +5801,10 @@ function ho(t) {
|
|
|
4506
5801
|
return c.svg || c.vml ? new ee(t) : null;
|
|
4507
5802
|
}
|
|
4508
5803
|
g.include({
|
|
5804
|
+
// @namespace Map; @method getRenderer(layer: Path): Renderer
|
|
5805
|
+
// Returns the instance of `Renderer` that should be used to render the given
|
|
5806
|
+
// `Path`. It will ensure that the `renderer` options of the map and paths
|
|
5807
|
+
// are respected, and that the renderers do exist on the map.
|
|
4509
5808
|
getRenderer: function(t) {
|
|
4510
5809
|
var e = t.options.renderer || this._getPaneRenderer(t.options.pane) || this.options.renderer || this._renderer;
|
|
4511
5810
|
return e || (e = this._renderer = this._createRenderer()), this.hasLayer(e) || this.addLayer(e), e;
|
|
@@ -4524,6 +5823,8 @@ var uo = kt.extend({
|
|
|
4524
5823
|
initialize: function(t, e) {
|
|
4525
5824
|
kt.prototype.initialize.call(this, this._boundsToLatLngs(t), e);
|
|
4526
5825
|
},
|
|
5826
|
+
// @method setBounds(latLngBounds: LatLngBounds): this
|
|
5827
|
+
// Redraws the rectangle with the passed bounds.
|
|
4527
5828
|
setBounds: function(t) {
|
|
4528
5829
|
return this.setLatLngs(this._boundsToLatLngs(t));
|
|
4529
5830
|
},
|
|
@@ -4549,6 +5850,9 @@ st.latLngsToCoords = Qt;
|
|
|
4549
5850
|
st.getFeature = pt;
|
|
4550
5851
|
st.asFeature = te;
|
|
4551
5852
|
g.mergeOptions({
|
|
5853
|
+
// @option boxZoom: Boolean = true
|
|
5854
|
+
// Whether the map can be zoomed to a rectangular area specified by
|
|
5855
|
+
// dragging the mouse while pressing the shift key.
|
|
4552
5856
|
boxZoom: !0
|
|
4553
5857
|
});
|
|
4554
5858
|
var Gi = J.extend({
|
|
@@ -4612,6 +5916,11 @@ var Gi = J.extend({
|
|
|
4612
5916
|
});
|
|
4613
5917
|
g.addInitHook("addHandler", "boxZoom", Gi);
|
|
4614
5918
|
g.mergeOptions({
|
|
5919
|
+
// @option doubleClickZoom: Boolean|String = true
|
|
5920
|
+
// Whether the map can be zoomed in by double clicking on it and
|
|
5921
|
+
// zoomed out by double clicking while holding shift. If passed
|
|
5922
|
+
// `'center'`, double-click zoom will zoom to the center of the
|
|
5923
|
+
// view regardless of where the mouse was.
|
|
4615
5924
|
doubleClickZoom: !0
|
|
4616
5925
|
});
|
|
4617
5926
|
var ji = J.extend({
|
|
@@ -4628,12 +5937,38 @@ var ji = J.extend({
|
|
|
4628
5937
|
});
|
|
4629
5938
|
g.addInitHook("addHandler", "doubleClickZoom", ji);
|
|
4630
5939
|
g.mergeOptions({
|
|
5940
|
+
// @option dragging: Boolean = true
|
|
5941
|
+
// Whether the map is draggable with mouse/touch or not.
|
|
4631
5942
|
dragging: !0,
|
|
5943
|
+
// @section Panning Inertia Options
|
|
5944
|
+
// @option inertia: Boolean = *
|
|
5945
|
+
// If enabled, panning of the map will have an inertia effect where
|
|
5946
|
+
// the map builds momentum while dragging and continues moving in
|
|
5947
|
+
// the same direction for some time. Feels especially nice on touch
|
|
5948
|
+
// devices. Enabled by default.
|
|
4632
5949
|
inertia: !0,
|
|
5950
|
+
// @option inertiaDeceleration: Number = 3000
|
|
5951
|
+
// The rate with which the inertial movement slows down, in pixels/second².
|
|
4633
5952
|
inertiaDeceleration: 3400,
|
|
5953
|
+
// px/s^2
|
|
5954
|
+
// @option inertiaMaxSpeed: Number = Infinity
|
|
5955
|
+
// Max speed of the inertial movement, in pixels/second.
|
|
4634
5956
|
inertiaMaxSpeed: 1 / 0,
|
|
5957
|
+
// px/s
|
|
5958
|
+
// @option easeLinearity: Number = 0.2
|
|
4635
5959
|
easeLinearity: 0.2,
|
|
5960
|
+
// TODO refactor, move to CRS
|
|
5961
|
+
// @option worldCopyJump: Boolean = false
|
|
5962
|
+
// With this option enabled, the map tracks when you pan to another "copy"
|
|
5963
|
+
// of the world and seamlessly jumps to the original one so that all overlays
|
|
5964
|
+
// like markers and vector layers are still visible.
|
|
4636
5965
|
worldCopyJump: !1,
|
|
5966
|
+
// @option maxBoundsViscosity: Number = 0.0
|
|
5967
|
+
// If `maxBounds` is set, this option will control how solid the bounds
|
|
5968
|
+
// are when dragging the map around. The default value of `0.0` allows the
|
|
5969
|
+
// user to drag outside the bounds at normal speed, higher values will
|
|
5970
|
+
// slow down map dragging outside bounds, and `1.0` makes the bounds fully
|
|
5971
|
+
// solid, preventing the user from dragging outside the bounds.
|
|
4637
5972
|
maxBoundsViscosity: 0
|
|
4638
5973
|
});
|
|
4639
5974
|
var Ki = J.extend({
|
|
@@ -4717,7 +6052,12 @@ var Ki = J.extend({
|
|
|
4717
6052
|
});
|
|
4718
6053
|
g.addInitHook("addHandler", "dragging", Ki);
|
|
4719
6054
|
g.mergeOptions({
|
|
6055
|
+
// @option keyboard: Boolean = true
|
|
6056
|
+
// Makes the map focusable and allows users to navigate the map with keyboard
|
|
6057
|
+
// arrows and `+`/`-` keys.
|
|
4720
6058
|
keyboard: !0,
|
|
6059
|
+
// @option keyboardPanDelta: Number = 80
|
|
6060
|
+
// Amount of pixels to pan when pressing an arrow key.
|
|
4721
6061
|
keyboardPanDelta: 80
|
|
4722
6062
|
});
|
|
4723
6063
|
var Yi = J.extend({
|
|
@@ -4811,8 +6151,19 @@ var Yi = J.extend({
|
|
|
4811
6151
|
});
|
|
4812
6152
|
g.addInitHook("addHandler", "keyboard", Yi);
|
|
4813
6153
|
g.mergeOptions({
|
|
6154
|
+
// @section Mouse wheel options
|
|
6155
|
+
// @option scrollWheelZoom: Boolean|String = true
|
|
6156
|
+
// Whether the map can be zoomed by using the mouse wheel. If passed `'center'`,
|
|
6157
|
+
// it will zoom to the center of the view regardless of where the mouse was.
|
|
4814
6158
|
scrollWheelZoom: !0,
|
|
6159
|
+
// @option wheelDebounceTime: Number = 40
|
|
6160
|
+
// Limits the rate at which a wheel can fire (in milliseconds). By default
|
|
6161
|
+
// user can't zoom via wheel more often than once per 40 ms.
|
|
4815
6162
|
wheelDebounceTime: 40,
|
|
6163
|
+
// @option wheelPxPerZoomLevel: Number = 60
|
|
6164
|
+
// How many scroll pixels (as reported by [L.DomEvent.getWheelDelta](#domevent-getwheeldelta))
|
|
6165
|
+
// mean a change of one full zoom level. Smaller values will make wheel-zooming
|
|
6166
|
+
// faster (and vice versa).
|
|
4816
6167
|
wheelPxPerZoomLevel: 60
|
|
4817
6168
|
});
|
|
4818
6169
|
var Xi = J.extend({
|
|
@@ -4838,7 +6189,13 @@ var Xi = J.extend({
|
|
|
4838
6189
|
g.addInitHook("addHandler", "scrollWheelZoom", Xi);
|
|
4839
6190
|
var lo = 600;
|
|
4840
6191
|
g.mergeOptions({
|
|
6192
|
+
// @section Touch interaction options
|
|
6193
|
+
// @option tapHold: Boolean
|
|
6194
|
+
// Enables simulation of `contextmenu` event, default is `true` for mobile Safari.
|
|
4841
6195
|
tapHold: c.touchNative && c.safari && c.mobile,
|
|
6196
|
+
// @option tapTolerance: Number = 15
|
|
6197
|
+
// The max number of pixels a user can shift his finger during touch
|
|
6198
|
+
// for it to be considered a valid tap.
|
|
4842
6199
|
tapTolerance: 15
|
|
4843
6200
|
});
|
|
4844
6201
|
var Ji = J.extend({
|
|
@@ -4874,17 +6231,29 @@ var Ji = J.extend({
|
|
|
4874
6231
|
bubbles: !0,
|
|
4875
6232
|
cancelable: !0,
|
|
4876
6233
|
view: window,
|
|
6234
|
+
// detail: 1,
|
|
4877
6235
|
screenX: e.screenX,
|
|
4878
6236
|
screenY: e.screenY,
|
|
4879
6237
|
clientX: e.clientX,
|
|
4880
6238
|
clientY: e.clientY
|
|
6239
|
+
// button: 2,
|
|
6240
|
+
// buttons: 2
|
|
4881
6241
|
});
|
|
4882
6242
|
i._simulated = !0, e.target.dispatchEvent(i);
|
|
4883
6243
|
}
|
|
4884
6244
|
});
|
|
4885
6245
|
g.addInitHook("addHandler", "tapHold", Ji);
|
|
4886
6246
|
g.mergeOptions({
|
|
6247
|
+
// @section Touch interaction options
|
|
6248
|
+
// @option touchZoom: Boolean|String = *
|
|
6249
|
+
// Whether the map can be zoomed by touch-dragging with two fingers. If
|
|
6250
|
+
// passed `'center'`, it will zoom to the center of the view regardless of
|
|
6251
|
+
// where the touch events (fingers) were. Enabled for touch-capable web
|
|
6252
|
+
// browsers.
|
|
4887
6253
|
touchZoom: c.touch,
|
|
6254
|
+
// @option bounceAtZoomLimits: Boolean = true
|
|
6255
|
+
// Set it to false if you don't want the map to zoom beyond min/max zoom
|
|
6256
|
+
// and then bounce back when pinch-zooming.
|
|
4888
6257
|
bounceAtZoomLimits: !0
|
|
4889
6258
|
});
|
|
4890
6259
|
var $i = J.extend({
|
|
@@ -5014,3 +6383,4 @@ export {
|
|
|
5014
6383
|
co as version,
|
|
5015
6384
|
Zo as videoOverlay
|
|
5016
6385
|
};
|
|
6386
|
+
//# sourceMappingURL=leaflet-src.esm-114b2dcb.js.map
|