Update leaflet to 1.4.0
This commit is contained in:
parent
b8a8acaae4
commit
0604b36708
2 changed files with 97 additions and 37 deletions
|
@ -11,13 +11,13 @@ folder 'vendor/assets' do
|
||||||
end
|
end
|
||||||
|
|
||||||
folder 'leaflet' do
|
folder 'leaflet' do
|
||||||
file 'leaflet.js', 'https://unpkg.com/leaflet@1.3.4/dist/leaflet-src.js'
|
file 'leaflet.js', 'https://unpkg.com/leaflet@1.4.0/dist/leaflet-src.js'
|
||||||
file 'leaflet.css', 'https://unpkg.com/leaflet@1.3.4/dist/leaflet.css'
|
file 'leaflet.css', 'https://unpkg.com/leaflet@1.4.0/dist/leaflet.css'
|
||||||
|
|
||||||
[ 'layers.png', 'layers-2x.png',
|
[ 'layers.png', 'layers-2x.png',
|
||||||
'marker-icon.png', 'marker-icon-2x.png',
|
'marker-icon.png', 'marker-icon-2x.png',
|
||||||
'marker-shadow.png' ].each do |image|
|
'marker-shadow.png' ].each do |image|
|
||||||
file "images/#{image}", "https://unpkg.com/leaflet@1.3.4/dist/images/#{image}"
|
file "images/#{image}", "https://unpkg.com/leaflet@1.4.0/dist/images/#{image}"
|
||||||
end
|
end
|
||||||
|
|
||||||
from 'git://github.com/aratcliffe/Leaflet.contextmenu.git', :tag => 'v1.5.0' do
|
from 'git://github.com/aratcliffe/Leaflet.contextmenu.git', :tag => 'v1.5.0' do
|
||||||
|
|
128
vendor/assets/leaflet/leaflet.js
vendored
128
vendor/assets/leaflet/leaflet.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/* @preserve
|
/* @preserve
|
||||||
* Leaflet 1.3.4, a JS library for interactive maps. http://leafletjs.com
|
* Leaflet 1.4.0, a JS library for interactive maps. http://leafletjs.com
|
||||||
* (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
* (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
(factory((global.L = {})));
|
(factory((global.L = {})));
|
||||||
}(this, (function (exports) { 'use strict';
|
}(this, (function (exports) { 'use strict';
|
||||||
|
|
||||||
var version = "1.3.4";
|
var version = "1.4.0";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @namespace Util
|
* @namespace Util
|
||||||
|
@ -2290,7 +2290,7 @@ function empty(el) {
|
||||||
// Makes `el` the last child of its parent, so it renders in front of the other children.
|
// Makes `el` the last child of its parent, so it renders in front of the other children.
|
||||||
function toFront(el) {
|
function toFront(el) {
|
||||||
var parent = el.parentNode;
|
var parent = el.parentNode;
|
||||||
if (parent.lastChild !== el) {
|
if (parent && parent.lastChild !== el) {
|
||||||
parent.appendChild(el);
|
parent.appendChild(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2299,7 +2299,7 @@ function toFront(el) {
|
||||||
// Makes `el` the first child of its parent, so it renders behind the other children.
|
// Makes `el` the first child of its parent, so it renders behind the other children.
|
||||||
function toBack(el) {
|
function toBack(el) {
|
||||||
var parent = el.parentNode;
|
var parent = el.parentNode;
|
||||||
if (parent.firstChild !== el) {
|
if (parent && parent.firstChild !== el) {
|
||||||
parent.insertBefore(el, parent.firstChild);
|
parent.insertBefore(el, parent.firstChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2352,6 +2352,11 @@ function setClass(el, name) {
|
||||||
// @function getClass(el: HTMLElement): String
|
// @function getClass(el: HTMLElement): String
|
||||||
// Returns the element's class.
|
// Returns the element's class.
|
||||||
function getClass(el) {
|
function getClass(el) {
|
||||||
|
// Check if the element is an SVGElementInstance and use the correspondingElement instead
|
||||||
|
// (Required for linked SVG elements in IE11.)
|
||||||
|
if (el.correspondingElement) {
|
||||||
|
el = el.correspondingElement;
|
||||||
|
}
|
||||||
return el.className.baseVal === undefined ? el.className : el.className.baseVal;
|
return el.className.baseVal === undefined ? el.className : el.className.baseVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3113,6 +3118,13 @@ var Map = Evented.extend({
|
||||||
initialize: function (id, options) { // (HTMLElement or String, Object)
|
initialize: function (id, options) { // (HTMLElement or String, Object)
|
||||||
options = setOptions(this, options);
|
options = setOptions(this, options);
|
||||||
|
|
||||||
|
// Make sure to assign internal flags at the beginning,
|
||||||
|
// to avoid inconsistent state in some edge cases.
|
||||||
|
this._handlers = [];
|
||||||
|
this._layers = {};
|
||||||
|
this._zoomBoundLayers = {};
|
||||||
|
this._sizeChanged = true;
|
||||||
|
|
||||||
this._initContainer(id);
|
this._initContainer(id);
|
||||||
this._initLayout();
|
this._initLayout();
|
||||||
|
|
||||||
|
@ -3133,11 +3145,6 @@ var Map = Evented.extend({
|
||||||
this.setView(toLatLng(options.center), options.zoom, {reset: true});
|
this.setView(toLatLng(options.center), options.zoom, {reset: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
this._handlers = [];
|
|
||||||
this._layers = {};
|
|
||||||
this._zoomBoundLayers = {};
|
|
||||||
this._sizeChanged = true;
|
|
||||||
|
|
||||||
this.callInitHooks();
|
this.callInitHooks();
|
||||||
|
|
||||||
// don't animate on browsers without hardware-accelerated transitions or old Android/Opera
|
// don't animate on browsers without hardware-accelerated transitions or old Android/Opera
|
||||||
|
@ -3496,6 +3503,51 @@ var Map = Evented.extend({
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// @method panInside(latlng: LatLng, options?: options): this
|
||||||
|
// Pans the map the minimum amount to make the `latlng` visible. Use
|
||||||
|
// `padding`, `paddingTopLeft` and `paddingTopRight` options to fit
|
||||||
|
// the display to more restricted bounds, like [`fitBounds`](#map-fitbounds).
|
||||||
|
// If `latlng` is already within the (optionally padded) display bounds,
|
||||||
|
// the map will not be panned.
|
||||||
|
panInside: function (latlng, options) {
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),
|
||||||
|
paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),
|
||||||
|
center = this.getCenter(),
|
||||||
|
pixelCenter = this.project(center),
|
||||||
|
pixelPoint = this.project(latlng),
|
||||||
|
pixelBounds = this.getPixelBounds(),
|
||||||
|
halfPixelBounds = pixelBounds.getSize().divideBy(2),
|
||||||
|
paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]);
|
||||||
|
|
||||||
|
if (!paddedBounds.contains(pixelPoint)) {
|
||||||
|
this._enforcingBounds = true;
|
||||||
|
var diff = pixelCenter.subtract(pixelPoint),
|
||||||
|
newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y);
|
||||||
|
|
||||||
|
if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) {
|
||||||
|
newCenter.x = pixelCenter.x - diff.x;
|
||||||
|
if (diff.x > 0) {
|
||||||
|
newCenter.x += halfPixelBounds.x - paddingTL.x;
|
||||||
|
} else {
|
||||||
|
newCenter.x -= halfPixelBounds.x - paddingBR.x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) {
|
||||||
|
newCenter.y = pixelCenter.y - diff.y;
|
||||||
|
if (diff.y > 0) {
|
||||||
|
newCenter.y += halfPixelBounds.y - paddingTL.y;
|
||||||
|
} else {
|
||||||
|
newCenter.y -= halfPixelBounds.y - paddingBR.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.panTo(this.unproject(newCenter), options);
|
||||||
|
this._enforcingBounds = false;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
// @method invalidateSize(options: Zoom/pan options): this
|
// @method invalidateSize(options: Zoom/pan options): this
|
||||||
// Checks if the map container size changed and updates the map if so —
|
// Checks if the map container size changed and updates the map if so —
|
||||||
// call it after you've changed the map size dynamically, also animating
|
// call it after you've changed the map size dynamically, also animating
|
||||||
|
@ -4614,7 +4666,7 @@ var Map = Evented.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
// @event zoomanim: ZoomAnimEvent
|
// @event zoomanim: ZoomAnimEvent
|
||||||
// Fired on every frame of a zoom animation
|
// Fired at least once per zoom animation. For continous zoom, like pinch zooming, fired once per frame during zoom.
|
||||||
this.fire('zoomanim', {
|
this.fire('zoomanim', {
|
||||||
center: center,
|
center: center,
|
||||||
zoom: zoom,
|
zoom: zoom,
|
||||||
|
@ -4970,13 +5022,13 @@ var Layers = Control.extend({
|
||||||
// Expand the control container if collapsed.
|
// Expand the control container if collapsed.
|
||||||
expand: function () {
|
expand: function () {
|
||||||
addClass(this._container, 'leaflet-control-layers-expanded');
|
addClass(this._container, 'leaflet-control-layers-expanded');
|
||||||
this._form.style.height = null;
|
this._section.style.height = null;
|
||||||
var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
|
var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
|
||||||
if (acceptableHeight < this._form.clientHeight) {
|
if (acceptableHeight < this._section.clientHeight) {
|
||||||
addClass(this._form, 'leaflet-control-layers-scrollbar');
|
addClass(this._section, 'leaflet-control-layers-scrollbar');
|
||||||
this._form.style.height = acceptableHeight + 'px';
|
this._section.style.height = acceptableHeight + 'px';
|
||||||
} else {
|
} else {
|
||||||
removeClass(this._form, 'leaflet-control-layers-scrollbar');
|
removeClass(this._section, 'leaflet-control-layers-scrollbar');
|
||||||
}
|
}
|
||||||
this._checkDisabledLayers();
|
this._checkDisabledLayers();
|
||||||
return this;
|
return this;
|
||||||
|
@ -5000,7 +5052,7 @@ var Layers = Control.extend({
|
||||||
disableClickPropagation(container);
|
disableClickPropagation(container);
|
||||||
disableScrollPropagation(container);
|
disableScrollPropagation(container);
|
||||||
|
|
||||||
var form = this._form = create$1('form', className + '-list');
|
var section = this._section = create$1('section', className + '-list');
|
||||||
|
|
||||||
if (collapsed) {
|
if (collapsed) {
|
||||||
this._map.on('click', this.collapse, this);
|
this._map.on('click', this.collapse, this);
|
||||||
|
@ -5028,11 +5080,11 @@ var Layers = Control.extend({
|
||||||
this.expand();
|
this.expand();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._baseLayersList = create$1('div', className + '-base', form);
|
this._baseLayersList = create$1('div', className + '-base', section);
|
||||||
this._separator = create$1('div', className + '-separator', form);
|
this._separator = create$1('div', className + '-separator', section);
|
||||||
this._overlaysList = create$1('div', className + '-overlays', form);
|
this._overlaysList = create$1('div', className + '-overlays', section);
|
||||||
|
|
||||||
container.appendChild(form);
|
container.appendChild(section);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getLayer: function (id) {
|
_getLayer: function (id) {
|
||||||
|
@ -6457,7 +6509,7 @@ var Layer = Evented.extend({
|
||||||
pane: 'overlayPane',
|
pane: 'overlayPane',
|
||||||
|
|
||||||
// @option attribution: String = null
|
// @option attribution: String = null
|
||||||
// String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
|
// 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.
|
||||||
attribution: null,
|
attribution: null,
|
||||||
|
|
||||||
bubblingMouseEvents: true
|
bubblingMouseEvents: true
|
||||||
|
@ -9692,7 +9744,8 @@ var Popup = DivOverlay.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_adjustPan: function () {
|
_adjustPan: function () {
|
||||||
if (!this.options.autoPan || (this._map._panAnim && this._map._panAnim._inProgress)) { return; }
|
if (!this.options.autoPan) { return; }
|
||||||
|
if (this._map._panAnim) { this._map._panAnim.stop(); }
|
||||||
|
|
||||||
var map = this._map,
|
var map = this._map,
|
||||||
marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0,
|
marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0,
|
||||||
|
@ -11383,12 +11436,12 @@ function gridLayer(options) {
|
||||||
* @class TileLayer
|
* @class TileLayer
|
||||||
* @inherits GridLayer
|
* @inherits GridLayer
|
||||||
* @aka L.TileLayer
|
* @aka L.TileLayer
|
||||||
* Used to load and display tile layers on the map. Extends `GridLayer`.
|
* Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under `Layer`. Extends `GridLayer`.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar'}).addTo(map);
|
* L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @section URL template
|
* @section URL template
|
||||||
|
@ -11488,7 +11541,13 @@ var TileLayer = GridLayer.extend({
|
||||||
|
|
||||||
// @method setUrl(url: String, noRedraw?: Boolean): this
|
// @method setUrl(url: String, noRedraw?: Boolean): this
|
||||||
// Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`).
|
// Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`).
|
||||||
|
// If the URL does not change, the layer will not be redrawn unless
|
||||||
|
// the noRedraw parameter is set to false.
|
||||||
setUrl: function (url, noRedraw) {
|
setUrl: function (url, noRedraw) {
|
||||||
|
if (this._url === url && noRedraw === undefined) {
|
||||||
|
noRedraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
this._url = url;
|
this._url = url;
|
||||||
|
|
||||||
if (!noRedraw) {
|
if (!noRedraw) {
|
||||||
|
@ -11995,8 +12054,6 @@ var Canvas = Renderer.extend({
|
||||||
_update: function () {
|
_update: function () {
|
||||||
if (this._map._animatingZoom && this._bounds) { return; }
|
if (this._map._animatingZoom && this._bounds) { return; }
|
||||||
|
|
||||||
this._drawnLayers = {};
|
|
||||||
|
|
||||||
Renderer.prototype._update.call(this);
|
Renderer.prototype._update.call(this);
|
||||||
|
|
||||||
var b = this._bounds,
|
var b = this._bounds,
|
||||||
|
@ -12066,8 +12123,6 @@ var Canvas = Renderer.extend({
|
||||||
this._drawFirst = next;
|
this._drawFirst = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete this._drawnLayers[layer._leaflet_id];
|
|
||||||
|
|
||||||
delete layer._order;
|
delete layer._order;
|
||||||
|
|
||||||
delete this._layers[stamp(layer)];
|
delete this._layers[stamp(layer)];
|
||||||
|
@ -12095,9 +12150,13 @@ var Canvas = Renderer.extend({
|
||||||
if (typeof layer.options.dashArray === 'string') {
|
if (typeof layer.options.dashArray === 'string') {
|
||||||
var parts = layer.options.dashArray.split(/[, ]+/),
|
var parts = layer.options.dashArray.split(/[, ]+/),
|
||||||
dashArray = [],
|
dashArray = [],
|
||||||
|
dashValue,
|
||||||
i;
|
i;
|
||||||
for (i = 0; i < parts.length; i++) {
|
for (i = 0; i < parts.length; i++) {
|
||||||
dashArray.push(Number(parts[i]));
|
dashValue = Number(parts[i]);
|
||||||
|
// Ignore dash array containing invalid lengths
|
||||||
|
if (isNaN(dashValue)) { return; }
|
||||||
|
dashArray.push(dashValue);
|
||||||
}
|
}
|
||||||
layer.options._dashArray = dashArray;
|
layer.options._dashArray = dashArray;
|
||||||
} else {
|
} else {
|
||||||
|
@ -12179,8 +12238,6 @@ var Canvas = Renderer.extend({
|
||||||
|
|
||||||
if (!len) { return; }
|
if (!len) { return; }
|
||||||
|
|
||||||
this._drawnLayers[layer._leaflet_id] = layer;
|
|
||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
|
@ -12207,8 +12264,6 @@ var Canvas = Renderer.extend({
|
||||||
r = Math.max(Math.round(layer._radius), 1),
|
r = Math.max(Math.round(layer._radius), 1),
|
||||||
s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;
|
s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;
|
||||||
|
|
||||||
this._drawnLayers[layer._leaflet_id] = layer;
|
|
||||||
|
|
||||||
if (s !== 1) {
|
if (s !== 1) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.scale(1, s);
|
ctx.scale(1, s);
|
||||||
|
@ -12313,6 +12368,9 @@ var Canvas = Renderer.extend({
|
||||||
|
|
||||||
_bringToFront: function (layer) {
|
_bringToFront: function (layer) {
|
||||||
var order = layer._order;
|
var order = layer._order;
|
||||||
|
|
||||||
|
if (!order) { return; }
|
||||||
|
|
||||||
var next = order.next;
|
var next = order.next;
|
||||||
var prev = order.prev;
|
var prev = order.prev;
|
||||||
|
|
||||||
|
@ -12341,6 +12399,9 @@ var Canvas = Renderer.extend({
|
||||||
|
|
||||||
_bringToBack: function (layer) {
|
_bringToBack: function (layer) {
|
||||||
var order = layer._order;
|
var order = layer._order;
|
||||||
|
|
||||||
|
if (!order) { return; }
|
||||||
|
|
||||||
var next = order.next;
|
var next = order.next;
|
||||||
var prev = order.prev;
|
var prev = order.prev;
|
||||||
|
|
||||||
|
@ -12396,7 +12457,6 @@ var vmlCreate = (function () {
|
||||||
/*
|
/*
|
||||||
* @class SVG
|
* @class SVG
|
||||||
*
|
*
|
||||||
* Although SVG is not available on IE7 and IE8, these browsers support [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language), and the SVG renderer will fall back to VML in this case.
|
|
||||||
*
|
*
|
||||||
* VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
|
* VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
|
||||||
* with old versions of Internet Explorer.
|
* with old versions of Internet Explorer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue