decidim 0.26.9 → 0.26.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/decidim/version.rb +1 -1
- data/package-lock.json +7 -7
- data/packages/browserslist-config/package.json +1 -1
- data/packages/core/node_modules/leaflet/CHANGELOG.md +2191 -0
- data/packages/core/node_modules/leaflet/LICENSE +26 -0
- data/packages/core/node_modules/leaflet/README.md +55 -0
- data/packages/core/node_modules/leaflet/dist/images/layers-2x.png +0 -0
- data/packages/core/node_modules/leaflet/dist/images/layers.png +0 -0
- data/packages/core/node_modules/leaflet/dist/images/marker-icon-2x.png +0 -0
- data/packages/core/node_modules/leaflet/dist/images/marker-icon.png +0 -0
- data/packages/core/node_modules/leaflet/dist/images/marker-shadow.png +0 -0
- data/packages/core/node_modules/leaflet/dist/leaflet-src.esm.js +14419 -0
- data/packages/core/node_modules/leaflet/dist/leaflet-src.esm.js.map +1 -0
- data/packages/core/node_modules/leaflet/dist/leaflet-src.js +14512 -0
- data/packages/core/node_modules/leaflet/dist/leaflet-src.js.map +1 -0
- data/packages/core/node_modules/leaflet/dist/leaflet.css +661 -0
- data/packages/core/node_modules/leaflet/dist/leaflet.js +6 -0
- data/packages/core/node_modules/leaflet/dist/leaflet.js.map +1 -0
- data/packages/core/node_modules/leaflet/package.json +149 -0
- data/packages/core/node_modules/leaflet/src/Leaflet.js +24 -0
- data/packages/core/node_modules/leaflet/src/control/Control.Attribution.js +148 -0
- data/packages/core/node_modules/leaflet/src/control/Control.Layers.js +443 -0
- data/packages/core/node_modules/leaflet/src/control/Control.Scale.js +132 -0
- data/packages/core/node_modules/leaflet/src/control/Control.Zoom.js +146 -0
- data/packages/core/node_modules/leaflet/src/control/Control.js +174 -0
- data/packages/core/node_modules/leaflet/src/control/index.js +17 -0
- data/packages/core/node_modules/leaflet/src/core/Browser.js +220 -0
- data/packages/core/node_modules/leaflet/src/core/Class.js +135 -0
- data/packages/core/node_modules/leaflet/src/core/Class.leafdoc +197 -0
- data/packages/core/node_modules/leaflet/src/core/Events.js +344 -0
- data/packages/core/node_modules/leaflet/src/core/Events.leafdoc +143 -0
- data/packages/core/node_modules/leaflet/src/core/Handler.js +57 -0
- data/packages/core/node_modules/leaflet/src/core/Util.js +241 -0
- data/packages/core/node_modules/leaflet/src/core/index.js +15 -0
- data/packages/core/node_modules/leaflet/src/dom/DomEvent.DoubleTap.js +91 -0
- data/packages/core/node_modules/leaflet/src/dom/DomEvent.Pointer.js +97 -0
- data/packages/core/node_modules/leaflet/src/dom/DomEvent.js +315 -0
- data/packages/core/node_modules/leaflet/src/dom/DomUtil.js +349 -0
- data/packages/core/node_modules/leaflet/src/dom/Draggable.js +220 -0
- data/packages/core/node_modules/leaflet/src/dom/PosAnimation.js +113 -0
- data/packages/core/node_modules/leaflet/src/dom/index.js +9 -0
- data/packages/core/node_modules/leaflet/src/geo/LatLng.js +137 -0
- data/packages/core/node_modules/leaflet/src/geo/LatLngBounds.js +251 -0
- data/packages/core/node_modules/leaflet/src/geo/crs/CRS.EPSG3395.js +20 -0
- data/packages/core/node_modules/leaflet/src/geo/crs/CRS.EPSG3857.js +27 -0
- data/packages/core/node_modules/leaflet/src/geo/crs/CRS.EPSG4326.js +23 -0
- data/packages/core/node_modules/leaflet/src/geo/crs/CRS.Earth.js +33 -0
- data/packages/core/node_modules/leaflet/src/geo/crs/CRS.Simple.js +36 -0
- data/packages/core/node_modules/leaflet/src/geo/crs/CRS.js +139 -0
- data/packages/core/node_modules/leaflet/src/geo/crs/index.js +15 -0
- data/packages/core/node_modules/leaflet/src/geo/index.js +7 -0
- data/packages/core/node_modules/leaflet/src/geo/projection/Projection.LonLat.js +28 -0
- data/packages/core/node_modules/leaflet/src/geo/projection/Projection.Mercator.js +49 -0
- data/packages/core/node_modules/leaflet/src/geo/projection/Projection.SphericalMercator.js +44 -0
- data/packages/core/node_modules/leaflet/src/geo/projection/index.js +26 -0
- data/packages/core/node_modules/leaflet/src/geometry/Bounds.js +219 -0
- data/packages/core/node_modules/leaflet/src/geometry/LineUtil.js +306 -0
- data/packages/core/node_modules/leaflet/src/geometry/Point.js +222 -0
- data/packages/core/node_modules/leaflet/src/geometry/PolyUtil.js +129 -0
- data/packages/core/node_modules/leaflet/src/geometry/Transformation.js +79 -0
- data/packages/core/node_modules/leaflet/src/geometry/index.js +8 -0
- data/packages/core/node_modules/leaflet/src/images/layers.svg +1 -0
- data/packages/core/node_modules/leaflet/src/images/logo.svg +1 -0
- data/packages/core/node_modules/leaflet/src/images/marker.svg +1 -0
- data/packages/core/node_modules/leaflet/src/layer/DivOverlay.js +348 -0
- data/packages/core/node_modules/leaflet/src/layer/FeatureGroup.js +94 -0
- data/packages/core/node_modules/leaflet/src/layer/GeoJSON.js +452 -0
- data/packages/core/node_modules/leaflet/src/layer/ImageOverlay.js +270 -0
- data/packages/core/node_modules/leaflet/src/layer/Layer.Interactive.leafdoc +39 -0
- data/packages/core/node_modules/leaflet/src/layer/Layer.js +275 -0
- data/packages/core/node_modules/leaflet/src/layer/LayerGroup.js +159 -0
- data/packages/core/node_modules/leaflet/src/layer/Popup.js +506 -0
- data/packages/core/node_modules/leaflet/src/layer/SVGOverlay.js +50 -0
- data/packages/core/node_modules/leaflet/src/layer/Tooltip.js +444 -0
- data/packages/core/node_modules/leaflet/src/layer/VideoOverlay.js +106 -0
- data/packages/core/node_modules/leaflet/src/layer/index.js +24 -0
- data/packages/core/node_modules/leaflet/src/layer/marker/DivIcon.js +74 -0
- data/packages/core/node_modules/leaflet/src/layer/marker/Icon.Default.js +66 -0
- data/packages/core/node_modules/leaflet/src/layer/marker/Icon.js +165 -0
- data/packages/core/node_modules/leaflet/src/layer/marker/Marker.Drag.js +161 -0
- data/packages/core/node_modules/leaflet/src/layer/marker/Marker.js +419 -0
- data/packages/core/node_modules/leaflet/src/layer/marker/index.js +8 -0
- data/packages/core/node_modules/leaflet/src/layer/tile/GridLayer.js +923 -0
- data/packages/core/node_modules/leaflet/src/layer/tile/TileLayer.WMS.js +137 -0
- data/packages/core/node_modules/leaflet/src/layer/tile/TileLayer.js +289 -0
- data/packages/core/node_modules/leaflet/src/layer/tile/index.js +6 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Canvas.js +492 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Circle.js +113 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/CircleMarker.js +109 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Path.js +148 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Polygon.js +159 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Polyline.js +307 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Rectangle.js +57 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Renderer.getRenderer.js +45 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/Renderer.js +133 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/SVG.Util.js +39 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/SVG.VML.js +144 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/SVG.js +207 -0
- data/packages/core/node_modules/leaflet/src/layer/vector/index.js +14 -0
- data/packages/core/node_modules/leaflet/src/map/Map.js +1751 -0
- data/packages/core/node_modules/leaflet/src/map/Map.methodOptions.leafdoc +112 -0
- data/packages/core/node_modules/leaflet/src/map/handler/Map.BoxZoom.js +152 -0
- data/packages/core/node_modules/leaflet/src/map/handler/Map.DoubleClickZoom.js +55 -0
- data/packages/core/node_modules/leaflet/src/map/handler/Map.Drag.js +235 -0
- data/packages/core/node_modules/leaflet/src/map/handler/Map.Keyboard.js +183 -0
- data/packages/core/node_modules/leaflet/src/map/handler/Map.ScrollWheelZoom.js +91 -0
- data/packages/core/node_modules/leaflet/src/map/handler/Map.TapHold.js +102 -0
- data/packages/core/node_modules/leaflet/src/map/handler/Map.TouchZoom.js +130 -0
- data/packages/core/node_modules/leaflet/src/map/index.js +17 -0
- data/packages/core/package.json +1 -1
- data/packages/dev/package.json +1 -1
- data/packages/elections/package.json +1 -1
- data/packages/eslint-config/package.json +1 -1
- data/packages/stylelint-config/package.json +1 -1
- data/packages/webpacker/package.json +1 -1
- metadata +148 -42
@@ -0,0 +1,419 @@
|
|
1
|
+
import {Layer} from '../Layer';
|
2
|
+
import {IconDefault} from './Icon.Default';
|
3
|
+
import * as Util from '../../core/Util';
|
4
|
+
import {toLatLng as latLng} from '../../geo/LatLng';
|
5
|
+
import {toPoint as point} from '../../geometry/Point';
|
6
|
+
import * as DomUtil from '../../dom/DomUtil';
|
7
|
+
import * as DomEvent from '../../dom/DomEvent';
|
8
|
+
import {MarkerDrag} from './Marker.Drag';
|
9
|
+
|
10
|
+
/*
|
11
|
+
* @class Marker
|
12
|
+
* @inherits Interactive layer
|
13
|
+
* @aka L.Marker
|
14
|
+
* L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`.
|
15
|
+
*
|
16
|
+
* @example
|
17
|
+
*
|
18
|
+
* ```js
|
19
|
+
* L.marker([50.5, 30.5]).addTo(map);
|
20
|
+
* ```
|
21
|
+
*/
|
22
|
+
|
23
|
+
export var Marker = Layer.extend({
|
24
|
+
|
25
|
+
// @section
|
26
|
+
// @aka Marker options
|
27
|
+
options: {
|
28
|
+
// @option icon: Icon = *
|
29
|
+
// Icon instance to use for rendering the marker.
|
30
|
+
// See [Icon documentation](#L.Icon) for details on how to customize the marker icon.
|
31
|
+
// If not specified, a common instance of `L.Icon.Default` is used.
|
32
|
+
icon: new IconDefault(),
|
33
|
+
|
34
|
+
// Option inherited from "Interactive layer" abstract class
|
35
|
+
interactive: true,
|
36
|
+
|
37
|
+
// @option keyboard: Boolean = true
|
38
|
+
// Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
|
39
|
+
keyboard: true,
|
40
|
+
|
41
|
+
// @option title: String = ''
|
42
|
+
// Text for the browser tooltip that appear on marker hover (no tooltip by default).
|
43
|
+
// [Useful for accessibility](https://leafletjs.com/examples/accessibility/#markers-must-be-labelled).
|
44
|
+
title: '',
|
45
|
+
|
46
|
+
// @option alt: String = 'Marker'
|
47
|
+
// Text for the `alt` attribute of the icon image.
|
48
|
+
// [Useful for accessibility](https://leafletjs.com/examples/accessibility/#markers-must-be-labelled).
|
49
|
+
alt: 'Marker',
|
50
|
+
|
51
|
+
// @option zIndexOffset: Number = 0
|
52
|
+
// 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).
|
53
|
+
zIndexOffset: 0,
|
54
|
+
|
55
|
+
// @option opacity: Number = 1.0
|
56
|
+
// The opacity of the marker.
|
57
|
+
opacity: 1,
|
58
|
+
|
59
|
+
// @option riseOnHover: Boolean = false
|
60
|
+
// If `true`, the marker will get on top of others when you hover the mouse over it.
|
61
|
+
riseOnHover: false,
|
62
|
+
|
63
|
+
// @option riseOffset: Number = 250
|
64
|
+
// The z-index offset used for the `riseOnHover` feature.
|
65
|
+
riseOffset: 250,
|
66
|
+
|
67
|
+
// @option pane: String = 'markerPane'
|
68
|
+
// `Map pane` where the markers icon will be added.
|
69
|
+
pane: 'markerPane',
|
70
|
+
|
71
|
+
// @option shadowPane: String = 'shadowPane'
|
72
|
+
// `Map pane` where the markers shadow will be added.
|
73
|
+
shadowPane: 'shadowPane',
|
74
|
+
|
75
|
+
// @option bubblingMouseEvents: Boolean = false
|
76
|
+
// When `true`, a mouse event on this marker will trigger the same event on the map
|
77
|
+
// (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
|
78
|
+
bubblingMouseEvents: false,
|
79
|
+
|
80
|
+
// @option autoPanOnFocus: Boolean = true
|
81
|
+
// When `true`, the map will pan whenever the marker is focused (via
|
82
|
+
// e.g. pressing `tab` on the keyboard) to ensure the marker is
|
83
|
+
// visible within the map's bounds
|
84
|
+
autoPanOnFocus: true,
|
85
|
+
|
86
|
+
// @section Draggable marker options
|
87
|
+
// @option draggable: Boolean = false
|
88
|
+
// Whether the marker is draggable with mouse/touch or not.
|
89
|
+
draggable: false,
|
90
|
+
|
91
|
+
// @option autoPan: Boolean = false
|
92
|
+
// Whether to pan the map when dragging this marker near its edge or not.
|
93
|
+
autoPan: false,
|
94
|
+
|
95
|
+
// @option autoPanPadding: Point = Point(50, 50)
|
96
|
+
// Distance (in pixels to the left/right and to the top/bottom) of the
|
97
|
+
// map edge to start panning the map.
|
98
|
+
autoPanPadding: [50, 50],
|
99
|
+
|
100
|
+
// @option autoPanSpeed: Number = 10
|
101
|
+
// Number of pixels the map should pan by.
|
102
|
+
autoPanSpeed: 10
|
103
|
+
},
|
104
|
+
|
105
|
+
/* @section
|
106
|
+
*
|
107
|
+
* In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods:
|
108
|
+
*/
|
109
|
+
|
110
|
+
initialize: function (latlng, options) {
|
111
|
+
Util.setOptions(this, options);
|
112
|
+
this._latlng = latLng(latlng);
|
113
|
+
},
|
114
|
+
|
115
|
+
onAdd: function (map) {
|
116
|
+
this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;
|
117
|
+
|
118
|
+
if (this._zoomAnimated) {
|
119
|
+
map.on('zoomanim', this._animateZoom, this);
|
120
|
+
}
|
121
|
+
|
122
|
+
this._initIcon();
|
123
|
+
this.update();
|
124
|
+
},
|
125
|
+
|
126
|
+
onRemove: function (map) {
|
127
|
+
if (this.dragging && this.dragging.enabled()) {
|
128
|
+
this.options.draggable = true;
|
129
|
+
this.dragging.removeHooks();
|
130
|
+
}
|
131
|
+
delete this.dragging;
|
132
|
+
|
133
|
+
if (this._zoomAnimated) {
|
134
|
+
map.off('zoomanim', this._animateZoom, this);
|
135
|
+
}
|
136
|
+
|
137
|
+
this._removeIcon();
|
138
|
+
this._removeShadow();
|
139
|
+
},
|
140
|
+
|
141
|
+
getEvents: function () {
|
142
|
+
return {
|
143
|
+
zoom: this.update,
|
144
|
+
viewreset: this.update
|
145
|
+
};
|
146
|
+
},
|
147
|
+
|
148
|
+
// @method getLatLng: LatLng
|
149
|
+
// Returns the current geographical position of the marker.
|
150
|
+
getLatLng: function () {
|
151
|
+
return this._latlng;
|
152
|
+
},
|
153
|
+
|
154
|
+
// @method setLatLng(latlng: LatLng): this
|
155
|
+
// Changes the marker position to the given point.
|
156
|
+
setLatLng: function (latlng) {
|
157
|
+
var oldLatLng = this._latlng;
|
158
|
+
this._latlng = latLng(latlng);
|
159
|
+
this.update();
|
160
|
+
|
161
|
+
// @event move: Event
|
162
|
+
// Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.
|
163
|
+
return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});
|
164
|
+
},
|
165
|
+
|
166
|
+
// @method setZIndexOffset(offset: Number): this
|
167
|
+
// Changes the [zIndex offset](#marker-zindexoffset) of the marker.
|
168
|
+
setZIndexOffset: function (offset) {
|
169
|
+
this.options.zIndexOffset = offset;
|
170
|
+
return this.update();
|
171
|
+
},
|
172
|
+
|
173
|
+
// @method getIcon: Icon
|
174
|
+
// Returns the current icon used by the marker
|
175
|
+
getIcon: function () {
|
176
|
+
return this.options.icon;
|
177
|
+
},
|
178
|
+
|
179
|
+
// @method setIcon(icon: Icon): this
|
180
|
+
// Changes the marker icon.
|
181
|
+
setIcon: function (icon) {
|
182
|
+
|
183
|
+
this.options.icon = icon;
|
184
|
+
|
185
|
+
if (this._map) {
|
186
|
+
this._initIcon();
|
187
|
+
this.update();
|
188
|
+
}
|
189
|
+
|
190
|
+
if (this._popup) {
|
191
|
+
this.bindPopup(this._popup, this._popup.options);
|
192
|
+
}
|
193
|
+
|
194
|
+
return this;
|
195
|
+
},
|
196
|
+
|
197
|
+
getElement: function () {
|
198
|
+
return this._icon;
|
199
|
+
},
|
200
|
+
|
201
|
+
update: function () {
|
202
|
+
|
203
|
+
if (this._icon && this._map) {
|
204
|
+
var pos = this._map.latLngToLayerPoint(this._latlng).round();
|
205
|
+
this._setPos(pos);
|
206
|
+
}
|
207
|
+
|
208
|
+
return this;
|
209
|
+
},
|
210
|
+
|
211
|
+
_initIcon: function () {
|
212
|
+
var options = this.options,
|
213
|
+
classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');
|
214
|
+
|
215
|
+
var icon = options.icon.createIcon(this._icon),
|
216
|
+
addIcon = false;
|
217
|
+
|
218
|
+
// if we're not reusing the icon, remove the old one and init new one
|
219
|
+
if (icon !== this._icon) {
|
220
|
+
if (this._icon) {
|
221
|
+
this._removeIcon();
|
222
|
+
}
|
223
|
+
addIcon = true;
|
224
|
+
|
225
|
+
if (options.title) {
|
226
|
+
icon.title = options.title;
|
227
|
+
}
|
228
|
+
|
229
|
+
if (icon.tagName === 'IMG') {
|
230
|
+
icon.alt = options.alt || '';
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
DomUtil.addClass(icon, classToAdd);
|
235
|
+
|
236
|
+
if (options.keyboard) {
|
237
|
+
icon.tabIndex = '0';
|
238
|
+
icon.setAttribute('role', 'button');
|
239
|
+
}
|
240
|
+
|
241
|
+
this._icon = icon;
|
242
|
+
|
243
|
+
if (options.riseOnHover) {
|
244
|
+
this.on({
|
245
|
+
mouseover: this._bringToFront,
|
246
|
+
mouseout: this._resetZIndex
|
247
|
+
});
|
248
|
+
}
|
249
|
+
|
250
|
+
if (this.options.autoPanOnFocus) {
|
251
|
+
DomEvent.on(icon, 'focus', this._panOnFocus, this);
|
252
|
+
}
|
253
|
+
|
254
|
+
var newShadow = options.icon.createShadow(this._shadow),
|
255
|
+
addShadow = false;
|
256
|
+
|
257
|
+
if (newShadow !== this._shadow) {
|
258
|
+
this._removeShadow();
|
259
|
+
addShadow = true;
|
260
|
+
}
|
261
|
+
|
262
|
+
if (newShadow) {
|
263
|
+
DomUtil.addClass(newShadow, classToAdd);
|
264
|
+
newShadow.alt = '';
|
265
|
+
}
|
266
|
+
this._shadow = newShadow;
|
267
|
+
|
268
|
+
|
269
|
+
if (options.opacity < 1) {
|
270
|
+
this._updateOpacity();
|
271
|
+
}
|
272
|
+
|
273
|
+
|
274
|
+
if (addIcon) {
|
275
|
+
this.getPane().appendChild(this._icon);
|
276
|
+
}
|
277
|
+
this._initInteraction();
|
278
|
+
if (newShadow && addShadow) {
|
279
|
+
this.getPane(options.shadowPane).appendChild(this._shadow);
|
280
|
+
}
|
281
|
+
},
|
282
|
+
|
283
|
+
_removeIcon: function () {
|
284
|
+
if (this.options.riseOnHover) {
|
285
|
+
this.off({
|
286
|
+
mouseover: this._bringToFront,
|
287
|
+
mouseout: this._resetZIndex
|
288
|
+
});
|
289
|
+
}
|
290
|
+
|
291
|
+
if (this.options.autoPanOnFocus) {
|
292
|
+
DomEvent.off(this._icon, 'focus', this._panOnFocus, this);
|
293
|
+
}
|
294
|
+
|
295
|
+
DomUtil.remove(this._icon);
|
296
|
+
this.removeInteractiveTarget(this._icon);
|
297
|
+
|
298
|
+
this._icon = null;
|
299
|
+
},
|
300
|
+
|
301
|
+
_removeShadow: function () {
|
302
|
+
if (this._shadow) {
|
303
|
+
DomUtil.remove(this._shadow);
|
304
|
+
}
|
305
|
+
this._shadow = null;
|
306
|
+
},
|
307
|
+
|
308
|
+
_setPos: function (pos) {
|
309
|
+
|
310
|
+
if (this._icon) {
|
311
|
+
DomUtil.setPosition(this._icon, pos);
|
312
|
+
}
|
313
|
+
|
314
|
+
if (this._shadow) {
|
315
|
+
DomUtil.setPosition(this._shadow, pos);
|
316
|
+
}
|
317
|
+
|
318
|
+
this._zIndex = pos.y + this.options.zIndexOffset;
|
319
|
+
|
320
|
+
this._resetZIndex();
|
321
|
+
},
|
322
|
+
|
323
|
+
_updateZIndex: function (offset) {
|
324
|
+
if (this._icon) {
|
325
|
+
this._icon.style.zIndex = this._zIndex + offset;
|
326
|
+
}
|
327
|
+
},
|
328
|
+
|
329
|
+
_animateZoom: function (opt) {
|
330
|
+
var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();
|
331
|
+
|
332
|
+
this._setPos(pos);
|
333
|
+
},
|
334
|
+
|
335
|
+
_initInteraction: function () {
|
336
|
+
|
337
|
+
if (!this.options.interactive) { return; }
|
338
|
+
|
339
|
+
DomUtil.addClass(this._icon, 'leaflet-interactive');
|
340
|
+
|
341
|
+
this.addInteractiveTarget(this._icon);
|
342
|
+
|
343
|
+
if (MarkerDrag) {
|
344
|
+
var draggable = this.options.draggable;
|
345
|
+
if (this.dragging) {
|
346
|
+
draggable = this.dragging.enabled();
|
347
|
+
this.dragging.disable();
|
348
|
+
}
|
349
|
+
|
350
|
+
this.dragging = new MarkerDrag(this);
|
351
|
+
|
352
|
+
if (draggable) {
|
353
|
+
this.dragging.enable();
|
354
|
+
}
|
355
|
+
}
|
356
|
+
},
|
357
|
+
|
358
|
+
// @method setOpacity(opacity: Number): this
|
359
|
+
// Changes the opacity of the marker.
|
360
|
+
setOpacity: function (opacity) {
|
361
|
+
this.options.opacity = opacity;
|
362
|
+
if (this._map) {
|
363
|
+
this._updateOpacity();
|
364
|
+
}
|
365
|
+
|
366
|
+
return this;
|
367
|
+
},
|
368
|
+
|
369
|
+
_updateOpacity: function () {
|
370
|
+
var opacity = this.options.opacity;
|
371
|
+
|
372
|
+
if (this._icon) {
|
373
|
+
DomUtil.setOpacity(this._icon, opacity);
|
374
|
+
}
|
375
|
+
|
376
|
+
if (this._shadow) {
|
377
|
+
DomUtil.setOpacity(this._shadow, opacity);
|
378
|
+
}
|
379
|
+
},
|
380
|
+
|
381
|
+
_bringToFront: function () {
|
382
|
+
this._updateZIndex(this.options.riseOffset);
|
383
|
+
},
|
384
|
+
|
385
|
+
_resetZIndex: function () {
|
386
|
+
this._updateZIndex(0);
|
387
|
+
},
|
388
|
+
|
389
|
+
_panOnFocus: function () {
|
390
|
+
var map = this._map;
|
391
|
+
if (!map) { return; }
|
392
|
+
|
393
|
+
var iconOpts = this.options.icon.options;
|
394
|
+
var size = iconOpts.iconSize ? point(iconOpts.iconSize) : point(0, 0);
|
395
|
+
var anchor = iconOpts.iconAnchor ? point(iconOpts.iconAnchor) : point(0, 0);
|
396
|
+
|
397
|
+
map.panInside(this._latlng, {
|
398
|
+
paddingTopLeft: anchor,
|
399
|
+
paddingBottomRight: size.subtract(anchor)
|
400
|
+
});
|
401
|
+
},
|
402
|
+
|
403
|
+
_getPopupAnchor: function () {
|
404
|
+
return this.options.icon.options.popupAnchor;
|
405
|
+
},
|
406
|
+
|
407
|
+
_getTooltipAnchor: function () {
|
408
|
+
return this.options.icon.options.tooltipAnchor;
|
409
|
+
}
|
410
|
+
});
|
411
|
+
|
412
|
+
|
413
|
+
// factory L.marker(latlng: LatLng, options? : Marker options)
|
414
|
+
|
415
|
+
// @factory L.marker(latlng: LatLng, options? : Marker options)
|
416
|
+
// Instantiates a Marker object given a geographical point and optionally an options object.
|
417
|
+
export function marker(latlng, options) {
|
418
|
+
return new Marker(latlng, options);
|
419
|
+
}
|