cone.maps 0.2__py3-none-any.whl
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.
- cone/maps/__init__.py +64 -0
- cone/maps/browser/__init__.py +4 -0
- cone/maps/browser/map.py +139 -0
- cone/maps/browser/static/cone.maps.js +109 -0
- cone/maps/browser/static/cone.maps.min.js +1 -0
- cone/maps/browser/static/leaflet/images/layers-2x.png +0 -0
- cone/maps/browser/static/leaflet/images/layers.png +0 -0
- cone/maps/browser/static/leaflet/images/marker-icon-2x.png +0 -0
- cone/maps/browser/static/leaflet/images/marker-icon.png +0 -0
- cone/maps/browser/static/leaflet/images/marker-shadow.png +0 -0
- cone/maps/browser/static/leaflet/leaflet-src.js +14062 -0
- cone/maps/browser/static/leaflet/leaflet-src.js.map +1 -0
- cone/maps/browser/static/leaflet/leaflet.css +640 -0
- cone/maps/browser/static/leaflet/leaflet.js +6 -0
- cone/maps/browser/static/leaflet/leaflet.js.map +1 -0
- cone/maps/browser/static/leaflet-activearea/leaflet.activearea.js +458 -0
- cone/maps/browser/static/leaflet-geosearch/geosearch.css +240 -0
- cone/maps/browser/static/leaflet-geosearch/geosearch.umd.js +2 -0
- cone/maps/browser/static/leaflet-geosearch/geosearch.umd.js.map +1 -0
- cone/maps/browser/static/leaflet-markercluster/MarkerCluster.Default.css +60 -0
- cone/maps/browser/static/leaflet-markercluster/MarkerCluster.css +14 -0
- cone/maps/browser/static/leaflet-markercluster/leaflet.markercluster-src.js +2718 -0
- cone/maps/browser/static/leaflet-markercluster/leaflet.markercluster-src.js.map +1 -0
- cone/maps/browser/static/leaflet-markercluster/leaflet.markercluster.js +2 -0
- cone/maps/browser/static/leaflet-markercluster/leaflet.markercluster.js.map +1 -0
- cone/maps/browser/static/leaflet-nogap/L.TileLayer.NoGap.js +243 -0
- cone/maps/browser/static/leaflet-proj4/proj4leaflet.js +272 -0
- cone/maps/browser/static/proj4js/proj4-src.js +7174 -0
- cone/maps/browser/static/proj4js/proj4.js +1 -0
- cone/maps/locale/cone.maps.pot +0 -0
- cone/maps/tests.py +54 -0
- cone.maps-0.2-py3.9-nspkg.pth +1 -0
- cone_maps-0.2.dist-info/METADATA +179 -0
- cone_maps-0.2.dist-info/RECORD +39 -0
- cone_maps-0.2.dist-info/WHEEL +5 -0
- cone_maps-0.2.dist-info/licenses/LICENSE.rst +26 -0
- cone_maps-0.2.dist-info/licenses/LICENSE_LEAFLET.rst +23 -0
- cone_maps-0.2.dist-info/namespace_packages.txt +1 -0
- cone_maps-0.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
(function(previousMethods){
|
|
2
|
+
if (typeof previousMethods === 'undefined') {
|
|
3
|
+
// Defining previously that object allows you to use that plugin even if you have overridden L.map
|
|
4
|
+
previousMethods = {
|
|
5
|
+
getCenter: L.Map.prototype.getCenter,
|
|
6
|
+
setView: L.Map.prototype.setView,
|
|
7
|
+
flyTo: L.Map.prototype.flyTo,
|
|
8
|
+
setZoomAround: L.Map.prototype.setZoomAround,
|
|
9
|
+
getBoundsZoom: L.Map.prototype.getBoundsZoom,
|
|
10
|
+
PopupAdjustPan: L.Popup.prototype._adjustPan,
|
|
11
|
+
RendererUpdate: L.Renderer.prototype._update
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
L.Map.include({
|
|
16
|
+
|
|
17
|
+
// Overrides L.Map.getBounds
|
|
18
|
+
getBounds: function() {
|
|
19
|
+
if (this._viewport) {
|
|
20
|
+
return this.getViewportLatLngBounds()
|
|
21
|
+
} else {
|
|
22
|
+
var bounds = this.getPixelBounds(),
|
|
23
|
+
sw = this.unproject(bounds.getBottomLeft()),
|
|
24
|
+
ne = this.unproject(bounds.getTopRight());
|
|
25
|
+
|
|
26
|
+
return new L.LatLngBounds(sw, ne);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// Extends L.Map
|
|
31
|
+
getViewport: function() {
|
|
32
|
+
return this._viewport;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
// Extends L.Map
|
|
36
|
+
getViewportBounds: function() {
|
|
37
|
+
var vp = this._viewport,
|
|
38
|
+
topleft = L.point(vp.offsetLeft, vp.offsetTop),
|
|
39
|
+
vpsize = L.point(vp.clientWidth, vp.clientHeight);
|
|
40
|
+
|
|
41
|
+
if (vpsize.x === 0 || vpsize.y === 0) {
|
|
42
|
+
//Our own viewport has no good size - so we fallback to the container size:
|
|
43
|
+
vp = this.getContainer();
|
|
44
|
+
if(vp){
|
|
45
|
+
topleft = L.point(0, 0);
|
|
46
|
+
vpsize = L.point(vp.clientWidth, vp.clientHeight);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return L.bounds(topleft, topleft.add(vpsize));
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// Extends L.Map
|
|
55
|
+
getViewportLatLngBounds: function() {
|
|
56
|
+
var bounds = this.getViewportBounds();
|
|
57
|
+
return L.latLngBounds(this.containerPointToLatLng(bounds.min), this.containerPointToLatLng(bounds.max));
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// Extends L.Map
|
|
61
|
+
getOffset: function() {
|
|
62
|
+
var mCenter = this.getSize().divideBy(2),
|
|
63
|
+
vCenter = this.getViewportBounds().getCenter();
|
|
64
|
+
|
|
65
|
+
return mCenter.subtract(vCenter);
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// Overrides L.Map.getCenter
|
|
69
|
+
getCenter: function (withoutViewport) {
|
|
70
|
+
var center = previousMethods.getCenter.call(this);
|
|
71
|
+
|
|
72
|
+
if (this.getViewport() && !withoutViewport) {
|
|
73
|
+
var zoom = this.getZoom(),
|
|
74
|
+
point = this.project(center, zoom);
|
|
75
|
+
point = point.subtract(this.getOffset());
|
|
76
|
+
|
|
77
|
+
center = this.unproject(point, zoom);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return center;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// Overrides L.Map.setView
|
|
84
|
+
setView: function (center, zoom, options) {
|
|
85
|
+
center = L.latLng(center);
|
|
86
|
+
zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);
|
|
87
|
+
|
|
88
|
+
if (this.getViewport()) {
|
|
89
|
+
var point = this.project(center, this._limitZoom(zoom));
|
|
90
|
+
point = point.add(this.getOffset());
|
|
91
|
+
center = this.unproject(point, this._limitZoom(zoom));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return previousMethods.setView.call(this, center, zoom, options);
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
// Overrides L.Map.flyTo
|
|
98
|
+
flyTo: function (targetCenter, targetZoom, options) {
|
|
99
|
+
targetCenter = L.latLng(targetCenter);
|
|
100
|
+
targetZoom = targetZoom === undefined ? startZoom : targetZoom;
|
|
101
|
+
|
|
102
|
+
if (this.getViewport()) {
|
|
103
|
+
var point = this.project(targetCenter, this._limitZoom(targetZoom));
|
|
104
|
+
point = point.add(this.getOffset());
|
|
105
|
+
targetCenter = this.unproject(point, this._limitZoom(targetZoom));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
options = options || {};
|
|
109
|
+
if (options.animate === false || !L.Browser.any3d) {
|
|
110
|
+
return this.setView(targetCenter, targetZoom, options);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this._stop();
|
|
114
|
+
|
|
115
|
+
var from = this.project(previousMethods.getCenter.call(this)),
|
|
116
|
+
to = this.project(targetCenter),
|
|
117
|
+
size = this.getSize(),
|
|
118
|
+
startZoom = this._zoom;
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
var w0 = Math.max(size.x, size.y),
|
|
122
|
+
w1 = w0 * this.getZoomScale(startZoom, targetZoom),
|
|
123
|
+
u1 = (to.distanceTo(from)) || 1,
|
|
124
|
+
rho = 1.42,
|
|
125
|
+
rho2 = rho * rho;
|
|
126
|
+
|
|
127
|
+
function r(i) {
|
|
128
|
+
var s1 = i ? -1 : 1,
|
|
129
|
+
s2 = i ? w1 : w0,
|
|
130
|
+
t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,
|
|
131
|
+
b1 = 2 * s2 * rho2 * u1,
|
|
132
|
+
b = t1 / b1,
|
|
133
|
+
sq = Math.sqrt(b * b + 1) - b;
|
|
134
|
+
|
|
135
|
+
// workaround for floating point precision bug when sq = 0, log = -Infinite,
|
|
136
|
+
// thus triggering an infinite loop in flyTo
|
|
137
|
+
var log = sq < 0.000000001 ? -18 : Math.log(sq);
|
|
138
|
+
|
|
139
|
+
return log;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }
|
|
143
|
+
function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }
|
|
144
|
+
function tanh(n) { return sinh(n) / cosh(n); }
|
|
145
|
+
|
|
146
|
+
var r0 = r(0);
|
|
147
|
+
|
|
148
|
+
function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); }
|
|
149
|
+
function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; }
|
|
150
|
+
|
|
151
|
+
function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); }
|
|
152
|
+
|
|
153
|
+
var start = Date.now(),
|
|
154
|
+
S = (r(1) - r0) / rho,
|
|
155
|
+
duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;
|
|
156
|
+
|
|
157
|
+
function frame() {
|
|
158
|
+
var t = (Date.now() - start) / duration,
|
|
159
|
+
s = easeOut(t) * S;
|
|
160
|
+
|
|
161
|
+
if (t <= 1) {
|
|
162
|
+
this._flyToFrame = L.Util.requestAnimFrame(frame, this);
|
|
163
|
+
|
|
164
|
+
this._move(
|
|
165
|
+
this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom),
|
|
166
|
+
this.getScaleZoom(w0 / w(s), startZoom),
|
|
167
|
+
{flyTo: true});
|
|
168
|
+
|
|
169
|
+
} else {
|
|
170
|
+
this
|
|
171
|
+
._move(targetCenter, targetZoom)
|
|
172
|
+
._moveEnd(true);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
this._moveStart(true, options.noMoveStart);
|
|
177
|
+
|
|
178
|
+
frame.call(this);
|
|
179
|
+
return this;
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
// Overrides L.Map.setZoomAround
|
|
183
|
+
setZoomAround: function (latlng, zoom, options) {
|
|
184
|
+
var vp = this.getViewport();
|
|
185
|
+
|
|
186
|
+
if (vp) {
|
|
187
|
+
var scale = this.getZoomScale(zoom),
|
|
188
|
+
viewHalf = this.getViewportBounds().getCenter(),
|
|
189
|
+
containerPoint = latlng instanceof L.Point ? latlng : this.latLngToContainerPoint(latlng),
|
|
190
|
+
|
|
191
|
+
centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),
|
|
192
|
+
newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));
|
|
193
|
+
|
|
194
|
+
return this.setView(newCenter, zoom, {zoom: options});
|
|
195
|
+
} else {
|
|
196
|
+
return previousMethods.setZoomAround.call(this, latlng, zoom, options);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
// Overrides L.Map.getBoundsZoom
|
|
201
|
+
getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number
|
|
202
|
+
bounds = L.latLngBounds(bounds);
|
|
203
|
+
padding = L.point(padding || [0, 0]);
|
|
204
|
+
|
|
205
|
+
var zoom = this.getZoom() || 0,
|
|
206
|
+
min = this.getMinZoom(),
|
|
207
|
+
max = this.getMaxZoom(),
|
|
208
|
+
nw = bounds.getNorthWest(),
|
|
209
|
+
se = bounds.getSouthEast(),
|
|
210
|
+
vp = this.getViewport(),
|
|
211
|
+
size = (vp ? L.point(vp.clientWidth, vp.clientHeight) : this.getSize()).subtract(padding),
|
|
212
|
+
boundsSize = this.project(se, zoom).subtract(this.project(nw, zoom)),
|
|
213
|
+
snap = L.Browser.any3d ? this.options.zoomSnap : 1,
|
|
214
|
+
scalex = size.x / boundsSize.x,
|
|
215
|
+
scaley = size.y / boundsSize.y,
|
|
216
|
+
scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);
|
|
217
|
+
|
|
218
|
+
zoom = this.getScaleZoom(scale, zoom);
|
|
219
|
+
|
|
220
|
+
if (snap) {
|
|
221
|
+
zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level
|
|
222
|
+
zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return Math.max(min, Math.min(max, zoom));
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
// Extends L.Map
|
|
229
|
+
setActiveArea: function (css, keepCenter, animate) {
|
|
230
|
+
var center;
|
|
231
|
+
if (keepCenter && this._zoom) {
|
|
232
|
+
// save center if map is already initialized
|
|
233
|
+
// and keepCenter is passed
|
|
234
|
+
center = this.getCenter();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if( !this._viewport ){
|
|
238
|
+
//Make viewport if not already made
|
|
239
|
+
var container = this.getContainer();
|
|
240
|
+
this._viewport = L.DomUtil.create('div', '');
|
|
241
|
+
container.insertBefore(this._viewport, container.firstChild);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (typeof css === 'string') {
|
|
245
|
+
this._viewport.className = css;
|
|
246
|
+
} else {
|
|
247
|
+
L.extend(this._viewport.style, css);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (center) {
|
|
251
|
+
this.setView(center, this.getZoom(), { animate: !!animate });
|
|
252
|
+
}
|
|
253
|
+
return this;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
L.Renderer.include({
|
|
258
|
+
|
|
259
|
+
// Overrides L.Renderer._onZoom
|
|
260
|
+
_onZoom: function () {
|
|
261
|
+
this._updateTransform(this._map.getCenter(true), this._map.getZoom());
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
// Overrides L.Renderer._update
|
|
265
|
+
_update: function () {
|
|
266
|
+
previousMethods.RendererUpdate.call(this);
|
|
267
|
+
this._center = this._map.getCenter(true);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
L.GridLayer.include({
|
|
272
|
+
|
|
273
|
+
// Overrides L.GridLayer._updateLevels
|
|
274
|
+
_updateLevels: function () {
|
|
275
|
+
|
|
276
|
+
var zoom = this._tileZoom,
|
|
277
|
+
maxZoom = this.options.maxZoom;
|
|
278
|
+
|
|
279
|
+
if (zoom === undefined) { return undefined; }
|
|
280
|
+
|
|
281
|
+
for (var z in this._levels) {
|
|
282
|
+
z = Number(z);
|
|
283
|
+
if (this._levels[z].el.children.length || z === zoom) {
|
|
284
|
+
this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
|
|
285
|
+
this._onUpdateLevel(z);
|
|
286
|
+
} else {
|
|
287
|
+
L.DomUtil.remove(this._levels[z].el);
|
|
288
|
+
this._removeTilesAtZoom(z);
|
|
289
|
+
this._onRemoveLevel(z);
|
|
290
|
+
delete this._levels[z];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
var level = this._levels[zoom],
|
|
295
|
+
map = this._map;
|
|
296
|
+
|
|
297
|
+
if (!level) {
|
|
298
|
+
level = this._levels[zoom] = {};
|
|
299
|
+
|
|
300
|
+
level.el = L.DomUtil.create('div', 'leaflet-tile-container leaflet-zoom-animated', this._container);
|
|
301
|
+
level.el.style.zIndex = maxZoom;
|
|
302
|
+
|
|
303
|
+
level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();
|
|
304
|
+
level.zoom = zoom;
|
|
305
|
+
|
|
306
|
+
this._setZoomTransform(level, map.getCenter(true), map.getZoom());
|
|
307
|
+
|
|
308
|
+
// force the browser to consider the newly added element for transition
|
|
309
|
+
L.Util.falseFn(level.el.offsetWidth);
|
|
310
|
+
|
|
311
|
+
this._onCreateLevel(level);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
this._level = level;
|
|
315
|
+
|
|
316
|
+
return level;
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
// Overrides L.GridLayer._resetView
|
|
320
|
+
_resetView: function (e) {
|
|
321
|
+
var animating = e && (e.pinch || e.flyTo);
|
|
322
|
+
this._setView(this._map.getCenter(true), this._map.getZoom(), animating, animating);
|
|
323
|
+
},
|
|
324
|
+
|
|
325
|
+
// Overrides L.GridLayer._update
|
|
326
|
+
_update: function (center) {
|
|
327
|
+
var map = this._map;
|
|
328
|
+
if (!map) { return; }
|
|
329
|
+
var zoom = this._clampZoom(map.getZoom());
|
|
330
|
+
|
|
331
|
+
if (center === undefined) { center = map.getCenter(true); }
|
|
332
|
+
if (this._tileZoom === undefined) { return; } // if out of minzoom/maxzoom
|
|
333
|
+
|
|
334
|
+
var pixelBounds = this._getTiledPixelBounds(center),
|
|
335
|
+
tileRange = this._pxBoundsToTileRange(pixelBounds),
|
|
336
|
+
tileCenter = tileRange.getCenter(),
|
|
337
|
+
queue = [],
|
|
338
|
+
margin = this.options.keepBuffer,
|
|
339
|
+
noPruneRange = new L.Bounds(tileRange.getBottomLeft().subtract([margin, -margin]),
|
|
340
|
+
tileRange.getTopRight().add([margin, -margin]));
|
|
341
|
+
|
|
342
|
+
// Sanity check: panic if the tile range contains Infinity somewhere.
|
|
343
|
+
if (!(isFinite(tileRange.min.x) &&
|
|
344
|
+
isFinite(tileRange.min.y) &&
|
|
345
|
+
isFinite(tileRange.max.x) &&
|
|
346
|
+
isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); }
|
|
347
|
+
|
|
348
|
+
for (var key in this._tiles) {
|
|
349
|
+
var c = this._tiles[key].coords;
|
|
350
|
+
if (c.z !== this._tileZoom || !noPruneRange.contains(new L.Point(c.x, c.y))) {
|
|
351
|
+
this._tiles[key].current = false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// _update just loads more tiles. If the tile zoom level differs too much
|
|
356
|
+
// from the map's, let _setView reset levels and prune old tiles.
|
|
357
|
+
if (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; }
|
|
358
|
+
|
|
359
|
+
// create a queue of coordinates to load tiles from
|
|
360
|
+
for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {
|
|
361
|
+
for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {
|
|
362
|
+
var coords = new L.Point(i, j);
|
|
363
|
+
coords.z = this._tileZoom;
|
|
364
|
+
|
|
365
|
+
if (!this._isValidTile(coords)) { continue; }
|
|
366
|
+
|
|
367
|
+
var tile = this._tiles[this._tileCoordsToKey(coords)];
|
|
368
|
+
if (tile) {
|
|
369
|
+
tile.current = true;
|
|
370
|
+
} else {
|
|
371
|
+
queue.push(coords);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// sort tile queue to load tiles in order of their distance to center
|
|
377
|
+
queue.sort(function (a, b) {
|
|
378
|
+
return a.distanceTo(tileCenter) - b.distanceTo(tileCenter);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
if (queue.length !== 0) {
|
|
382
|
+
// if it's the first batch of tiles to load
|
|
383
|
+
if (!this._loading) {
|
|
384
|
+
this._loading = true;
|
|
385
|
+
// @event loading: Event
|
|
386
|
+
// Fired when the grid layer starts loading tiles.
|
|
387
|
+
this.fire('loading');
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// create DOM fragment to append tiles in one batch
|
|
391
|
+
var fragment = document.createDocumentFragment();
|
|
392
|
+
|
|
393
|
+
for (i = 0; i < queue.length; i++) {
|
|
394
|
+
this._addTile(queue[i], fragment);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
this._level.el.appendChild(fragment);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
L.Popup.include({
|
|
403
|
+
|
|
404
|
+
// Overrides L.Popup._adjustPan
|
|
405
|
+
_adjustPan: function () {
|
|
406
|
+
if (!this._map._viewport) {
|
|
407
|
+
previousMethods.PopupAdjustPan.call(this);
|
|
408
|
+
} else {
|
|
409
|
+
if (!this.options.autoPan) { return; }
|
|
410
|
+
if (this._map._panAnim) { this._map._panAnim.stop(); }
|
|
411
|
+
|
|
412
|
+
var map = this._map,
|
|
413
|
+
vp = map._viewport,
|
|
414
|
+
containerHeight = this._container.offsetHeight,
|
|
415
|
+
containerWidth = this._containerWidth,
|
|
416
|
+
vpTopleft = L.point(vp.offsetLeft, vp.offsetTop),
|
|
417
|
+
|
|
418
|
+
layerPos = new L.Point(
|
|
419
|
+
this._containerLeft - vpTopleft.x,
|
|
420
|
+
- containerHeight - this._containerBottom - vpTopleft.y);
|
|
421
|
+
|
|
422
|
+
layerPos._add(L.DomUtil.getPosition(this._container));
|
|
423
|
+
|
|
424
|
+
var containerPos = map.layerPointToContainerPoint(layerPos),
|
|
425
|
+
padding = L.point(this.options.autoPanPadding),
|
|
426
|
+
paddingTL = L.point(this.options.autoPanPaddingTopLeft || padding),
|
|
427
|
+
paddingBR = L.point(this.options.autoPanPaddingBottomRight || padding),
|
|
428
|
+
size = L.point(vp.clientWidth, vp.clientHeight),
|
|
429
|
+
dx = 0,
|
|
430
|
+
dy = 0;
|
|
431
|
+
|
|
432
|
+
if (containerPos.x + containerWidth + paddingBR.x > size.x) { // right
|
|
433
|
+
dx = containerPos.x + containerWidth - size.x + paddingBR.x;
|
|
434
|
+
}
|
|
435
|
+
if (containerPos.x - dx - paddingTL.x < 0) { // left
|
|
436
|
+
dx = containerPos.x - paddingTL.x;
|
|
437
|
+
}
|
|
438
|
+
if (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom
|
|
439
|
+
dy = containerPos.y + containerHeight - size.y + paddingBR.y;
|
|
440
|
+
}
|
|
441
|
+
if (containerPos.y - dy - paddingTL.y < 0) { // top
|
|
442
|
+
dy = containerPos.y - paddingTL.y;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// @namespace Map
|
|
446
|
+
// @section Popup events
|
|
447
|
+
// @event autopanstart: Event
|
|
448
|
+
// Fired when the map starts autopanning when opening a popup.
|
|
449
|
+
if (dx || dy) {
|
|
450
|
+
map
|
|
451
|
+
.fire('autopanstart')
|
|
452
|
+
.panBy([dx, dy]);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
})(window.leafletActiveAreaPreviousMethods);
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/* global styling */
|
|
2
|
+
.leaflet-control-geosearch *,
|
|
3
|
+
.leaflet-control-geosearch *:before,
|
|
4
|
+
.leaflet-control-geosearch *:after {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* leaflet button styling */
|
|
9
|
+
.leaflet-control-geosearch .leaflet-bar-part {
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
border-bottom: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.leaflet-control-geosearch a.leaflet-bar-part:before,
|
|
15
|
+
.leaflet-control-geosearch a.leaflet-bar-part:after {
|
|
16
|
+
position: absolute;
|
|
17
|
+
display: block;
|
|
18
|
+
content: '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* magnifying glass */
|
|
22
|
+
.leaflet-control-geosearch a.leaflet-bar-part:before {
|
|
23
|
+
top: 15px;
|
|
24
|
+
left: 13px;
|
|
25
|
+
width: 6px;
|
|
26
|
+
border-top: 2px solid #555;
|
|
27
|
+
transform: rotateZ(45deg);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.leaflet-control-geosearch a.leaflet-bar-part:after {
|
|
31
|
+
top: 8px;
|
|
32
|
+
left: 8px;
|
|
33
|
+
height: 8px;
|
|
34
|
+
width: 8px;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
border: 2px solid #555;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* resets for pending and error icons */
|
|
40
|
+
.leaflet-control-geosearch.error a.leaflet-bar-part:before,
|
|
41
|
+
.leaflet-control-geosearch.pending a.leaflet-bar-part:before {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.leaflet-control-geosearch.pending a.leaflet-bar-part:after,
|
|
46
|
+
.leaflet-control-geosearch.error a.leaflet-bar-part:after {
|
|
47
|
+
left: 50%;
|
|
48
|
+
top: 50%;
|
|
49
|
+
width: 18px;
|
|
50
|
+
height: 18px;
|
|
51
|
+
margin: -9px 0 0 -9px;
|
|
52
|
+
border-radius: 50%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* pending icon */
|
|
56
|
+
.leaflet-control-geosearch.pending a.leaflet-bar-part:after {
|
|
57
|
+
content: '';
|
|
58
|
+
border: 2px solid #555;
|
|
59
|
+
border-top: 2px solid #f3f3f3;
|
|
60
|
+
animation: spin 1s linear infinite;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* error icon */
|
|
64
|
+
.leaflet-control-geosearch.error a.leaflet-bar-part:after {
|
|
65
|
+
content: '!';
|
|
66
|
+
line-height: initial;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
font-size: 18px;
|
|
69
|
+
border: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* search form styling */
|
|
73
|
+
.leaflet-control-geosearch form {
|
|
74
|
+
display: none;
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: 0;
|
|
77
|
+
left: 36px;
|
|
78
|
+
border-radius: 0 4px 4px 0;
|
|
79
|
+
background-color: #fff;
|
|
80
|
+
background-clip: padding-box;
|
|
81
|
+
z-index: -1;
|
|
82
|
+
height: auto;
|
|
83
|
+
margin: 0;
|
|
84
|
+
padding: 0 8px;
|
|
85
|
+
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.leaflet-geosearch-button form.open {
|
|
89
|
+
border-radius: 0 4px 4px 4px;
|
|
90
|
+
}
|
|
91
|
+
.leaflet-control-geosearch.active form {
|
|
92
|
+
display: block;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.leaflet-geosearch-button.active .leaflet-bar-part {
|
|
96
|
+
border-radius: 4px 0 0 4px;
|
|
97
|
+
width: 36px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.leaflet-geosearch-button form {
|
|
101
|
+
max-width: 350px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.leaflet-control-geosearch form input {
|
|
105
|
+
min-width: 200px;
|
|
106
|
+
width: 100%;
|
|
107
|
+
outline: none;
|
|
108
|
+
border: none;
|
|
109
|
+
margin: 0;
|
|
110
|
+
padding: 0;
|
|
111
|
+
font-size: 12px;
|
|
112
|
+
height: 26px;
|
|
113
|
+
border: none;
|
|
114
|
+
border-radius: 0 4px 4px 0;
|
|
115
|
+
text-indent: 8px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.leaflet-touch .leaflet-geosearch-bar form {
|
|
119
|
+
border: 2px solid rgba(0,0,0,0.2);
|
|
120
|
+
box-shadow: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.leaflet-touch .leaflet-geosearch-bar form input {
|
|
124
|
+
height: 30px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.leaflet-control-geosearch .results {
|
|
128
|
+
background: #fff;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.leaflet-control-geosearch .results > * {
|
|
132
|
+
line-height: 24px;
|
|
133
|
+
padding: 0 8px;
|
|
134
|
+
border: 1px solid transparent;
|
|
135
|
+
|
|
136
|
+
white-space: nowrap;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
text-overflow: ellipsis;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.leaflet-control-geosearch .results.active {
|
|
142
|
+
padding: 8px 0;
|
|
143
|
+
border-top: 1px solid #c6c6c6;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.leaflet-control-geosearch .results > .active,
|
|
147
|
+
.leaflet-control-geosearch .results > :hover {
|
|
148
|
+
background-color: #f8f8f8;
|
|
149
|
+
border-color: #c6c6c6;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* add missing border to form */
|
|
154
|
+
.leaflet-control-geosearch .results.active:after {
|
|
155
|
+
content: '';
|
|
156
|
+
display: block;
|
|
157
|
+
width: 0;
|
|
158
|
+
position: absolute;
|
|
159
|
+
left: -2px;
|
|
160
|
+
bottom: -2px;
|
|
161
|
+
top: 30px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.leaflet-touch .leaflet-control-geosearch .results.active:after {
|
|
165
|
+
border-left: 2px solid rgba(0, 0, 0, .2);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* animations */
|
|
169
|
+
@keyframes spin {
|
|
170
|
+
0% { transform: rotate(0deg); }
|
|
171
|
+
100% { transform: rotate(360deg); }
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.leaflet-top .leaflet-geosearch-bar,
|
|
175
|
+
.leaflet-bottom .leaflet-geosearch-bar {
|
|
176
|
+
display: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.leaflet-geosearch-bar {
|
|
180
|
+
position: relative;
|
|
181
|
+
display: block;
|
|
182
|
+
height: auto;
|
|
183
|
+
width: 400px;
|
|
184
|
+
max-width: calc(100% - 120px);
|
|
185
|
+
margin: 10px auto 0;
|
|
186
|
+
cursor: auto;
|
|
187
|
+
z-index: 1000;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.leaflet-geosearch-bar form {
|
|
191
|
+
position: relative;
|
|
192
|
+
top: 0;
|
|
193
|
+
left: 0;
|
|
194
|
+
display: block;
|
|
195
|
+
border-radius: 4px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.leaflet-geosearch-bar form input {
|
|
199
|
+
min-width: 100%;
|
|
200
|
+
width: 100%;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.leaflet-geosearch-bar .results.active:after {
|
|
204
|
+
opacity: .2;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.leaflet-right .leaflet-control-geosearch form {
|
|
208
|
+
right: 28px;
|
|
209
|
+
left: initial;
|
|
210
|
+
border-radius: 4px 0 0 4px;
|
|
211
|
+
border-left: inherit;
|
|
212
|
+
border-right: none;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.leaflet-bar-notfound {
|
|
216
|
+
font-style: italic;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.leaflet-control-geosearch a.reset {
|
|
220
|
+
color: black;
|
|
221
|
+
font-weight: bold;
|
|
222
|
+
position: absolute;
|
|
223
|
+
line-height: 26px;
|
|
224
|
+
padding: 0 8px;
|
|
225
|
+
right: 0;
|
|
226
|
+
top: 0;
|
|
227
|
+
cursor: pointer;
|
|
228
|
+
border: none;
|
|
229
|
+
text-decoration: none;
|
|
230
|
+
background-color: #fff;
|
|
231
|
+
border-radius: 0 4px 4px 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.leaflet-touch .leaflet-control-geosearch a.reset {
|
|
235
|
+
line-height: 30px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.leaflet-control-geosearch a.reset:hover {
|
|
239
|
+
background: #f5f5f5;
|
|
240
|
+
}
|