leaflet-with-dashoffset-canvas-fix 1.9.4

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +2191 -0
  2. package/LICENSE +26 -0
  3. package/README.md +3 -0
  4. package/package.json +149 -0
  5. package/src/Leaflet.js +24 -0
  6. package/src/control/Control.Attribution.js +148 -0
  7. package/src/control/Control.Layers.js +443 -0
  8. package/src/control/Control.Scale.js +132 -0
  9. package/src/control/Control.Zoom.js +146 -0
  10. package/src/control/Control.js +174 -0
  11. package/src/control/index.js +17 -0
  12. package/src/core/Browser.js +220 -0
  13. package/src/core/Class.js +135 -0
  14. package/src/core/Events.js +344 -0
  15. package/src/core/Handler.js +57 -0
  16. package/src/core/Util.js +241 -0
  17. package/src/core/index.js +15 -0
  18. package/src/dom/DomEvent.DoubleTap.js +91 -0
  19. package/src/dom/DomEvent.Pointer.js +97 -0
  20. package/src/dom/DomEvent.js +315 -0
  21. package/src/dom/DomUtil.js +349 -0
  22. package/src/dom/Draggable.js +220 -0
  23. package/src/dom/PosAnimation.js +113 -0
  24. package/src/dom/index.js +9 -0
  25. package/src/geo/LatLng.js +137 -0
  26. package/src/geo/LatLngBounds.js +251 -0
  27. package/src/geo/crs/CRS.EPSG3395.js +20 -0
  28. package/src/geo/crs/CRS.EPSG3857.js +27 -0
  29. package/src/geo/crs/CRS.EPSG4326.js +23 -0
  30. package/src/geo/crs/CRS.Earth.js +33 -0
  31. package/src/geo/crs/CRS.Simple.js +36 -0
  32. package/src/geo/crs/CRS.js +139 -0
  33. package/src/geo/crs/index.js +15 -0
  34. package/src/geo/index.js +7 -0
  35. package/src/geo/projection/Projection.LonLat.js +28 -0
  36. package/src/geo/projection/Projection.Mercator.js +49 -0
  37. package/src/geo/projection/Projection.SphericalMercator.js +44 -0
  38. package/src/geo/projection/index.js +26 -0
  39. package/src/geometry/Bounds.js +219 -0
  40. package/src/geometry/LineUtil.js +306 -0
  41. package/src/geometry/Point.js +222 -0
  42. package/src/geometry/PolyUtil.js +129 -0
  43. package/src/geometry/Transformation.js +79 -0
  44. package/src/geometry/index.js +8 -0
  45. package/src/images/layers.svg +1 -0
  46. package/src/images/logo.svg +1 -0
  47. package/src/images/marker.svg +1 -0
  48. package/src/layer/DivOverlay.js +348 -0
  49. package/src/layer/FeatureGroup.js +94 -0
  50. package/src/layer/GeoJSON.js +452 -0
  51. package/src/layer/ImageOverlay.js +270 -0
  52. package/src/layer/Layer.js +275 -0
  53. package/src/layer/LayerGroup.js +159 -0
  54. package/src/layer/Popup.js +506 -0
  55. package/src/layer/SVGOverlay.js +50 -0
  56. package/src/layer/Tooltip.js +444 -0
  57. package/src/layer/VideoOverlay.js +106 -0
  58. package/src/layer/index.js +24 -0
  59. package/src/layer/marker/DivIcon.js +74 -0
  60. package/src/layer/marker/Icon.Default.js +66 -0
  61. package/src/layer/marker/Icon.js +165 -0
  62. package/src/layer/marker/Marker.Drag.js +161 -0
  63. package/src/layer/marker/Marker.js +419 -0
  64. package/src/layer/marker/index.js +8 -0
  65. package/src/layer/tile/GridLayer.js +923 -0
  66. package/src/layer/tile/TileLayer.WMS.js +137 -0
  67. package/src/layer/tile/TileLayer.js +289 -0
  68. package/src/layer/tile/index.js +6 -0
  69. package/src/layer/vector/Canvas.js +493 -0
  70. package/src/layer/vector/Circle.js +113 -0
  71. package/src/layer/vector/CircleMarker.js +109 -0
  72. package/src/layer/vector/Path.js +148 -0
  73. package/src/layer/vector/Polygon.js +159 -0
  74. package/src/layer/vector/Polyline.js +307 -0
  75. package/src/layer/vector/Rectangle.js +57 -0
  76. package/src/layer/vector/Renderer.getRenderer.js +45 -0
  77. package/src/layer/vector/Renderer.js +133 -0
  78. package/src/layer/vector/SVG.Util.js +39 -0
  79. package/src/layer/vector/SVG.VML.js +144 -0
  80. package/src/layer/vector/SVG.js +207 -0
  81. package/src/layer/vector/index.js +14 -0
  82. package/src/map/Map.js +1751 -0
  83. package/src/map/handler/Map.BoxZoom.js +152 -0
  84. package/src/map/handler/Map.DoubleClickZoom.js +55 -0
  85. package/src/map/handler/Map.Drag.js +235 -0
  86. package/src/map/handler/Map.Keyboard.js +183 -0
  87. package/src/map/handler/Map.ScrollWheelZoom.js +91 -0
  88. package/src/map/handler/Map.TapHold.js +102 -0
  89. package/src/map/handler/Map.TouchZoom.js +130 -0
  90. package/src/map/index.js +17 -0
@@ -0,0 +1,444 @@
1
+ import {DivOverlay} from './DivOverlay';
2
+ import {toPoint} from '../geometry/Point';
3
+ import {Map} from '../map/Map';
4
+ import {Layer} from './Layer';
5
+ import * as DomUtil from '../dom/DomUtil';
6
+ import * as DomEvent from '../dom/DomEvent';
7
+ import * as Util from '../core/Util';
8
+ import {FeatureGroup} from './FeatureGroup';
9
+
10
+ /*
11
+ * @class Tooltip
12
+ * @inherits DivOverlay
13
+ * @aka L.Tooltip
14
+ * Used to display small texts on top of map layers.
15
+ *
16
+ * @example
17
+ * If you want to just bind a tooltip to marker:
18
+ *
19
+ * ```js
20
+ * marker.bindTooltip("my tooltip text").openTooltip();
21
+ * ```
22
+ * Path overlays like polylines also have a `bindTooltip` method.
23
+ *
24
+ * A tooltip can be also standalone:
25
+ *
26
+ * ```js
27
+ * var tooltip = L.tooltip()
28
+ * .setLatLng(latlng)
29
+ * .setContent('Hello world!<br />This is a nice tooltip.')
30
+ * .addTo(map);
31
+ * ```
32
+ * or
33
+ * ```js
34
+ * var tooltip = L.tooltip(latlng, {content: 'Hello world!<br />This is a nice tooltip.'})
35
+ * .addTo(map);
36
+ * ```
37
+ *
38
+ *
39
+ * Note about tooltip offset. Leaflet takes two options in consideration
40
+ * for computing tooltip offsetting:
41
+ * - the `offset` Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
42
+ * Add a positive x offset to move the tooltip to the right, and a positive y offset to
43
+ * move it to the bottom. Negatives will move to the left and top.
44
+ * - the `tooltipAnchor` Icon option: this will only be considered for Marker. You
45
+ * should adapt this value if you use a custom icon.
46
+ */
47
+
48
+
49
+ // @namespace Tooltip
50
+ export var Tooltip = DivOverlay.extend({
51
+
52
+ // @section
53
+ // @aka Tooltip options
54
+ options: {
55
+ // @option pane: String = 'tooltipPane'
56
+ // `Map pane` where the tooltip will be added.
57
+ pane: 'tooltipPane',
58
+
59
+ // @option offset: Point = Point(0, 0)
60
+ // Optional offset of the tooltip position.
61
+ offset: [0, 0],
62
+
63
+ // @option direction: String = 'auto'
64
+ // Direction where to open the tooltip. Possible values are: `right`, `left`,
65
+ // `top`, `bottom`, `center`, `auto`.
66
+ // `auto` will dynamically switch between `right` and `left` according to the tooltip
67
+ // position on the map.
68
+ direction: 'auto',
69
+
70
+ // @option permanent: Boolean = false
71
+ // Whether to open the tooltip permanently or only on mouseover.
72
+ permanent: false,
73
+
74
+ // @option sticky: Boolean = false
75
+ // If true, the tooltip will follow the mouse instead of being fixed at the feature center.
76
+ sticky: false,
77
+
78
+ // @option opacity: Number = 0.9
79
+ // Tooltip container opacity.
80
+ opacity: 0.9
81
+ },
82
+
83
+ onAdd: function (map) {
84
+ DivOverlay.prototype.onAdd.call(this, map);
85
+ this.setOpacity(this.options.opacity);
86
+
87
+ // @namespace Map
88
+ // @section Tooltip events
89
+ // @event tooltipopen: TooltipEvent
90
+ // Fired when a tooltip is opened in the map.
91
+ map.fire('tooltipopen', {tooltip: this});
92
+
93
+ if (this._source) {
94
+ this.addEventParent(this._source);
95
+
96
+ // @namespace Layer
97
+ // @section Tooltip events
98
+ // @event tooltipopen: TooltipEvent
99
+ // Fired when a tooltip bound to this layer is opened.
100
+ this._source.fire('tooltipopen', {tooltip: this}, true);
101
+ }
102
+ },
103
+
104
+ onRemove: function (map) {
105
+ DivOverlay.prototype.onRemove.call(this, map);
106
+
107
+ // @namespace Map
108
+ // @section Tooltip events
109
+ // @event tooltipclose: TooltipEvent
110
+ // Fired when a tooltip in the map is closed.
111
+ map.fire('tooltipclose', {tooltip: this});
112
+
113
+ if (this._source) {
114
+ this.removeEventParent(this._source);
115
+
116
+ // @namespace Layer
117
+ // @section Tooltip events
118
+ // @event tooltipclose: TooltipEvent
119
+ // Fired when a tooltip bound to this layer is closed.
120
+ this._source.fire('tooltipclose', {tooltip: this}, true);
121
+ }
122
+ },
123
+
124
+ getEvents: function () {
125
+ var events = DivOverlay.prototype.getEvents.call(this);
126
+
127
+ if (!this.options.permanent) {
128
+ events.preclick = this.close;
129
+ }
130
+
131
+ return events;
132
+ },
133
+
134
+ _initLayout: function () {
135
+ var prefix = 'leaflet-tooltip',
136
+ className = prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');
137
+
138
+ this._contentNode = this._container = DomUtil.create('div', className);
139
+
140
+ this._container.setAttribute('role', 'tooltip');
141
+ this._container.setAttribute('id', 'leaflet-tooltip-' + Util.stamp(this));
142
+ },
143
+
144
+ _updateLayout: function () {},
145
+
146
+ _adjustPan: function () {},
147
+
148
+ _setPosition: function (pos) {
149
+ var subX, subY,
150
+ map = this._map,
151
+ container = this._container,
152
+ centerPoint = map.latLngToContainerPoint(map.getCenter()),
153
+ tooltipPoint = map.layerPointToContainerPoint(pos),
154
+ direction = this.options.direction,
155
+ tooltipWidth = container.offsetWidth,
156
+ tooltipHeight = container.offsetHeight,
157
+ offset = toPoint(this.options.offset),
158
+ anchor = this._getAnchor();
159
+
160
+ if (direction === 'top') {
161
+ subX = tooltipWidth / 2;
162
+ subY = tooltipHeight;
163
+ } else if (direction === 'bottom') {
164
+ subX = tooltipWidth / 2;
165
+ subY = 0;
166
+ } else if (direction === 'center') {
167
+ subX = tooltipWidth / 2;
168
+ subY = tooltipHeight / 2;
169
+ } else if (direction === 'right') {
170
+ subX = 0;
171
+ subY = tooltipHeight / 2;
172
+ } else if (direction === 'left') {
173
+ subX = tooltipWidth;
174
+ subY = tooltipHeight / 2;
175
+ } else if (tooltipPoint.x < centerPoint.x) {
176
+ direction = 'right';
177
+ subX = 0;
178
+ subY = tooltipHeight / 2;
179
+ } else {
180
+ direction = 'left';
181
+ subX = tooltipWidth + (offset.x + anchor.x) * 2;
182
+ subY = tooltipHeight / 2;
183
+ }
184
+
185
+ pos = pos.subtract(toPoint(subX, subY, true)).add(offset).add(anchor);
186
+
187
+ DomUtil.removeClass(container, 'leaflet-tooltip-right');
188
+ DomUtil.removeClass(container, 'leaflet-tooltip-left');
189
+ DomUtil.removeClass(container, 'leaflet-tooltip-top');
190
+ DomUtil.removeClass(container, 'leaflet-tooltip-bottom');
191
+ DomUtil.addClass(container, 'leaflet-tooltip-' + direction);
192
+ DomUtil.setPosition(container, pos);
193
+ },
194
+
195
+ _updatePosition: function () {
196
+ var pos = this._map.latLngToLayerPoint(this._latlng);
197
+ this._setPosition(pos);
198
+ },
199
+
200
+ setOpacity: function (opacity) {
201
+ this.options.opacity = opacity;
202
+
203
+ if (this._container) {
204
+ DomUtil.setOpacity(this._container, opacity);
205
+ }
206
+ },
207
+
208
+ _animateZoom: function (e) {
209
+ var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
210
+ this._setPosition(pos);
211
+ },
212
+
213
+ _getAnchor: function () {
214
+ // Where should we anchor the tooltip on the source layer?
215
+ return toPoint(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]);
216
+ }
217
+
218
+ });
219
+
220
+ // @namespace Tooltip
221
+ // @factory L.tooltip(options?: Tooltip options, source?: Layer)
222
+ // Instantiates a `Tooltip` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the tooltip with a reference to the Layer to which it refers.
223
+ // @alternative
224
+ // @factory L.tooltip(latlng: LatLng, options?: Tooltip options)
225
+ // Instantiates a `Tooltip` object given `latlng` where the tooltip will open and an optional `options` object that describes its appearance and location.
226
+ export var tooltip = function (options, source) {
227
+ return new Tooltip(options, source);
228
+ };
229
+
230
+ // @namespace Map
231
+ // @section Methods for Layers and Controls
232
+ Map.include({
233
+
234
+ // @method openTooltip(tooltip: Tooltip): this
235
+ // Opens the specified tooltip.
236
+ // @alternative
237
+ // @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this
238
+ // Creates a tooltip with the specified content and options and open it.
239
+ openTooltip: function (tooltip, latlng, options) {
240
+ this._initOverlay(Tooltip, tooltip, latlng, options)
241
+ .openOn(this);
242
+
243
+ return this;
244
+ },
245
+
246
+ // @method closeTooltip(tooltip: Tooltip): this
247
+ // Closes the tooltip given as parameter.
248
+ closeTooltip: function (tooltip) {
249
+ tooltip.close();
250
+ return this;
251
+ }
252
+
253
+ });
254
+
255
+ /*
256
+ * @namespace Layer
257
+ * @section Tooltip methods example
258
+ *
259
+ * All layers share a set of methods convenient for binding tooltips to it.
260
+ *
261
+ * ```js
262
+ * var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
263
+ * layer.openTooltip();
264
+ * layer.closeTooltip();
265
+ * ```
266
+ */
267
+
268
+ // @section Tooltip methods
269
+ Layer.include({
270
+
271
+ // @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this
272
+ // Binds a tooltip to the layer with the passed `content` and sets up the
273
+ // necessary event listeners. If a `Function` is passed it will receive
274
+ // the layer as the first argument and should return a `String` or `HTMLElement`.
275
+ bindTooltip: function (content, options) {
276
+
277
+ if (this._tooltip && this.isTooltipOpen()) {
278
+ this.unbindTooltip();
279
+ }
280
+
281
+ this._tooltip = this._initOverlay(Tooltip, this._tooltip, content, options);
282
+ this._initTooltipInteractions();
283
+
284
+ if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) {
285
+ this.openTooltip();
286
+ }
287
+
288
+ return this;
289
+ },
290
+
291
+ // @method unbindTooltip(): this
292
+ // Removes the tooltip previously bound with `bindTooltip`.
293
+ unbindTooltip: function () {
294
+ if (this._tooltip) {
295
+ this._initTooltipInteractions(true);
296
+ this.closeTooltip();
297
+ this._tooltip = null;
298
+ }
299
+ return this;
300
+ },
301
+
302
+ _initTooltipInteractions: function (remove) {
303
+ if (!remove && this._tooltipHandlersAdded) { return; }
304
+ var onOff = remove ? 'off' : 'on',
305
+ events = {
306
+ remove: this.closeTooltip,
307
+ move: this._moveTooltip
308
+ };
309
+ if (!this._tooltip.options.permanent) {
310
+ events.mouseover = this._openTooltip;
311
+ events.mouseout = this.closeTooltip;
312
+ events.click = this._openTooltip;
313
+ if (this._map) {
314
+ this._addFocusListeners();
315
+ } else {
316
+ events.add = this._addFocusListeners;
317
+ }
318
+ } else {
319
+ events.add = this._openTooltip;
320
+ }
321
+ if (this._tooltip.options.sticky) {
322
+ events.mousemove = this._moveTooltip;
323
+ }
324
+ this[onOff](events);
325
+ this._tooltipHandlersAdded = !remove;
326
+ },
327
+
328
+ // @method openTooltip(latlng?: LatLng): this
329
+ // Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed.
330
+ openTooltip: function (latlng) {
331
+ if (this._tooltip) {
332
+ if (!(this instanceof FeatureGroup)) {
333
+ this._tooltip._source = this;
334
+ }
335
+ if (this._tooltip._prepareOpen(latlng)) {
336
+ // open the tooltip on the map
337
+ this._tooltip.openOn(this._map);
338
+
339
+ if (this.getElement) {
340
+ this._setAriaDescribedByOnLayer(this);
341
+ } else if (this.eachLayer) {
342
+ this.eachLayer(this._setAriaDescribedByOnLayer, this);
343
+ }
344
+ }
345
+ }
346
+ return this;
347
+ },
348
+
349
+ // @method closeTooltip(): this
350
+ // Closes the tooltip bound to this layer if it is open.
351
+ closeTooltip: function () {
352
+ if (this._tooltip) {
353
+ return this._tooltip.close();
354
+ }
355
+ },
356
+
357
+ // @method toggleTooltip(): this
358
+ // Opens or closes the tooltip bound to this layer depending on its current state.
359
+ toggleTooltip: function () {
360
+ if (this._tooltip) {
361
+ this._tooltip.toggle(this);
362
+ }
363
+ return this;
364
+ },
365
+
366
+ // @method isTooltipOpen(): boolean
367
+ // Returns `true` if the tooltip bound to this layer is currently open.
368
+ isTooltipOpen: function () {
369
+ return this._tooltip.isOpen();
370
+ },
371
+
372
+ // @method setTooltipContent(content: String|HTMLElement|Tooltip): this
373
+ // Sets the content of the tooltip bound to this layer.
374
+ setTooltipContent: function (content) {
375
+ if (this._tooltip) {
376
+ this._tooltip.setContent(content);
377
+ }
378
+ return this;
379
+ },
380
+
381
+ // @method getTooltip(): Tooltip
382
+ // Returns the tooltip bound to this layer.
383
+ getTooltip: function () {
384
+ return this._tooltip;
385
+ },
386
+
387
+ _addFocusListeners: function () {
388
+ if (this.getElement) {
389
+ this._addFocusListenersOnLayer(this);
390
+ } else if (this.eachLayer) {
391
+ this.eachLayer(this._addFocusListenersOnLayer, this);
392
+ }
393
+ },
394
+
395
+ _addFocusListenersOnLayer: function (layer) {
396
+ var el = typeof layer.getElement === 'function' && layer.getElement();
397
+ if (el) {
398
+ DomEvent.on(el, 'focus', function () {
399
+ this._tooltip._source = layer;
400
+ this.openTooltip();
401
+ }, this);
402
+ DomEvent.on(el, 'blur', this.closeTooltip, this);
403
+ }
404
+ },
405
+
406
+ _setAriaDescribedByOnLayer: function (layer) {
407
+ var el = typeof layer.getElement === 'function' && layer.getElement();
408
+ if (el) {
409
+ el.setAttribute('aria-describedby', this._tooltip._container.id);
410
+ }
411
+ },
412
+
413
+
414
+ _openTooltip: function (e) {
415
+ if (!this._tooltip || !this._map) {
416
+ return;
417
+ }
418
+
419
+ // If the map is moving, we will show the tooltip after it's done.
420
+ if (this._map.dragging && this._map.dragging.moving() && !this._openOnceFlag) {
421
+ this._openOnceFlag = true;
422
+ var that = this;
423
+ this._map.once('moveend', function () {
424
+ that._openOnceFlag = false;
425
+ that._openTooltip(e);
426
+ });
427
+ return;
428
+ }
429
+
430
+ this._tooltip._source = e.layer || e.target;
431
+
432
+ this.openTooltip(this._tooltip.options.sticky ? e.latlng : undefined);
433
+ },
434
+
435
+ _moveTooltip: function (e) {
436
+ var latlng = e.latlng, containerPoint, layerPoint;
437
+ if (this._tooltip.options.sticky && e.originalEvent) {
438
+ containerPoint = this._map.mouseEventToContainerPoint(e.originalEvent);
439
+ layerPoint = this._map.containerPointToLayerPoint(containerPoint);
440
+ latlng = this._map.layerPointToLatLng(layerPoint);
441
+ }
442
+ this._tooltip.setLatLng(latlng);
443
+ }
444
+ });
@@ -0,0 +1,106 @@
1
+ import {ImageOverlay} from './ImageOverlay';
2
+ import * as DomUtil from '../dom/DomUtil';
3
+ import * as Util from '../core/Util';
4
+
5
+ /*
6
+ * @class VideoOverlay
7
+ * @aka L.VideoOverlay
8
+ * @inherits ImageOverlay
9
+ *
10
+ * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`.
11
+ *
12
+ * A video overlay uses the [`<video>`](https://developer.mozilla.org/docs/Web/HTML/Element/video)
13
+ * HTML5 element.
14
+ *
15
+ * @example
16
+ *
17
+ * ```js
18
+ * var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
19
+ * videoBounds = [[ 32, -130], [ 13, -100]];
20
+ * L.videoOverlay(videoUrl, videoBounds ).addTo(map);
21
+ * ```
22
+ */
23
+
24
+ export var VideoOverlay = ImageOverlay.extend({
25
+
26
+ // @section
27
+ // @aka VideoOverlay options
28
+ options: {
29
+ // @option autoplay: Boolean = true
30
+ // Whether the video starts playing automatically when loaded.
31
+ // On some browsers autoplay will only work with `muted: true`
32
+ autoplay: true,
33
+
34
+ // @option loop: Boolean = true
35
+ // Whether the video will loop back to the beginning when played.
36
+ loop: true,
37
+
38
+ // @option keepAspectRatio: Boolean = true
39
+ // Whether the video will save aspect ratio after the projection.
40
+ // Relevant for supported browsers. See [browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit)
41
+ keepAspectRatio: true,
42
+
43
+ // @option muted: Boolean = false
44
+ // Whether the video starts on mute when loaded.
45
+ muted: false,
46
+
47
+ // @option playsInline: Boolean = true
48
+ // Mobile browsers will play the video right where it is instead of open it up in fullscreen mode.
49
+ playsInline: true
50
+ },
51
+
52
+ _initImage: function () {
53
+ var wasElementSupplied = this._url.tagName === 'VIDEO';
54
+ var vid = this._image = wasElementSupplied ? this._url : DomUtil.create('video');
55
+
56
+ DomUtil.addClass(vid, 'leaflet-image-layer');
57
+ if (this._zoomAnimated) { DomUtil.addClass(vid, 'leaflet-zoom-animated'); }
58
+ if (this.options.className) { DomUtil.addClass(vid, this.options.className); }
59
+
60
+ vid.onselectstart = Util.falseFn;
61
+ vid.onmousemove = Util.falseFn;
62
+
63
+ // @event load: Event
64
+ // Fired when the video has finished loading the first frame
65
+ vid.onloadeddata = Util.bind(this.fire, this, 'load');
66
+
67
+ if (wasElementSupplied) {
68
+ var sourceElements = vid.getElementsByTagName('source');
69
+ var sources = [];
70
+ for (var j = 0; j < sourceElements.length; j++) {
71
+ sources.push(sourceElements[j].src);
72
+ }
73
+
74
+ this._url = (sourceElements.length > 0) ? sources : [vid.src];
75
+ return;
76
+ }
77
+
78
+ if (!Util.isArray(this._url)) { this._url = [this._url]; }
79
+
80
+ if (!this.options.keepAspectRatio && Object.prototype.hasOwnProperty.call(vid.style, 'objectFit')) {
81
+ vid.style['objectFit'] = 'fill';
82
+ }
83
+ vid.autoplay = !!this.options.autoplay;
84
+ vid.loop = !!this.options.loop;
85
+ vid.muted = !!this.options.muted;
86
+ vid.playsInline = !!this.options.playsInline;
87
+ for (var i = 0; i < this._url.length; i++) {
88
+ var source = DomUtil.create('source');
89
+ source.src = this._url[i];
90
+ vid.appendChild(source);
91
+ }
92
+ }
93
+
94
+ // @method getElement(): HTMLVideoElement
95
+ // Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement)
96
+ // used by this overlay.
97
+ });
98
+
99
+
100
+ // @factory L.videoOverlay(video: String|Array|HTMLVideoElement, bounds: LatLngBounds, options?: VideoOverlay options)
101
+ // Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
102
+ // geographical bounds it is tied to.
103
+
104
+ export function videoOverlay(video, bounds, options) {
105
+ return new VideoOverlay(video, bounds, options);
106
+ }
@@ -0,0 +1,24 @@
1
+ export {Layer} from './Layer';
2
+ export {LayerGroup, layerGroup} from './LayerGroup';
3
+ export {FeatureGroup, featureGroup} from './FeatureGroup';
4
+ import {GeoJSON, geoJSON, geoJson, geometryToLayer, coordsToLatLng, coordsToLatLngs, latLngToCoords, latLngsToCoords, getFeature, asFeature} from './GeoJSON';
5
+ GeoJSON.geometryToLayer = geometryToLayer;
6
+ GeoJSON.coordsToLatLng = coordsToLatLng;
7
+ GeoJSON.coordsToLatLngs = coordsToLatLngs;
8
+ GeoJSON.latLngToCoords = latLngToCoords;
9
+ GeoJSON.latLngsToCoords = latLngsToCoords;
10
+ GeoJSON.getFeature = getFeature;
11
+ GeoJSON.asFeature = asFeature;
12
+ export {GeoJSON, geoJSON, geoJson};
13
+
14
+ export {ImageOverlay, imageOverlay} from './ImageOverlay';
15
+ export {VideoOverlay, videoOverlay} from './VideoOverlay';
16
+ export {SVGOverlay, svgOverlay} from './SVGOverlay';
17
+
18
+ export {DivOverlay} from './DivOverlay';
19
+ export {Popup, popup} from './Popup';
20
+ export {Tooltip, tooltip} from './Tooltip';
21
+
22
+ export * from './marker/index';
23
+ export * from './tile/index';
24
+ export * from './vector/index';
@@ -0,0 +1,74 @@
1
+ import {Icon} from './Icon';
2
+ import {toPoint as point} from '../../geometry/Point';
3
+ import {empty} from '../../dom/DomUtil';
4
+
5
+ /*
6
+ * @class DivIcon
7
+ * @aka L.DivIcon
8
+ * @inherits Icon
9
+ *
10
+ * Represents a lightweight icon for markers that uses a simple `<div>`
11
+ * element instead of an image. Inherits from `Icon` but ignores the `iconUrl` and shadow options.
12
+ *
13
+ * @example
14
+ * ```js
15
+ * var myIcon = L.divIcon({className: 'my-div-icon'});
16
+ * // you can set .my-div-icon styles in CSS
17
+ *
18
+ * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
19
+ * ```
20
+ *
21
+ * By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
22
+ */
23
+
24
+ export var DivIcon = Icon.extend({
25
+ options: {
26
+ // @section
27
+ // @aka DivIcon options
28
+ iconSize: [12, 12], // also can be set through CSS
29
+
30
+ // iconAnchor: (Point),
31
+ // popupAnchor: (Point),
32
+
33
+ // @option html: String|HTMLElement = ''
34
+ // Custom HTML code to put inside the div element, empty by default. Alternatively,
35
+ // an instance of `HTMLElement`.
36
+ html: false,
37
+
38
+ // @option bgPos: Point = [0, 0]
39
+ // Optional relative position of the background, in pixels
40
+ bgPos: null,
41
+
42
+ className: 'leaflet-div-icon'
43
+ },
44
+
45
+ createIcon: function (oldIcon) {
46
+ var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'),
47
+ options = this.options;
48
+
49
+ if (options.html instanceof Element) {
50
+ empty(div);
51
+ div.appendChild(options.html);
52
+ } else {
53
+ div.innerHTML = options.html !== false ? options.html : '';
54
+ }
55
+
56
+ if (options.bgPos) {
57
+ var bgPos = point(options.bgPos);
58
+ div.style.backgroundPosition = (-bgPos.x) + 'px ' + (-bgPos.y) + 'px';
59
+ }
60
+ this._setIconStyles(div, 'icon');
61
+
62
+ return div;
63
+ },
64
+
65
+ createShadow: function () {
66
+ return null;
67
+ }
68
+ });
69
+
70
+ // @factory L.divIcon(options: DivIcon options)
71
+ // Creates a `DivIcon` instance with the given options.
72
+ export function divIcon(options) {
73
+ return new DivIcon(options);
74
+ }