Update leaflet plugins
This commit is contained in:
parent
bf9430f43e
commit
47ff3a8f97
4 changed files with 58 additions and 22 deletions
|
@ -20,7 +20,7 @@ folder 'vendor/assets' do
|
||||||
file "images/#{image}", "https://unpkg.com/leaflet@1.6.0/dist/images/#{image}"
|
file "images/#{image}", "https://unpkg.com/leaflet@1.6.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.1' do
|
||||||
file 'leaflet.contextmenu.js', 'dist/leaflet.contextmenu.js'
|
file 'leaflet.contextmenu.js', 'dist/leaflet.contextmenu.js'
|
||||||
file 'leaflet.contextmenu.css', 'dist/leaflet.contextmenu.css'
|
file 'leaflet.contextmenu.css', 'dist/leaflet.contextmenu.css'
|
||||||
end
|
end
|
||||||
|
@ -31,7 +31,7 @@ folder 'vendor/assets' do
|
||||||
folder 'img', 'src/img'
|
folder 'img', 'src/img'
|
||||||
end
|
end
|
||||||
|
|
||||||
from 'git://github.com/domoritz/leaflet-locatecontrol.git', :tag => 'v0.66.0' do
|
from 'git://github.com/domoritz/leaflet-locatecontrol.git', :tag => 'v0.71.0' do
|
||||||
file 'leaflet.locate.js', 'src/L.Control.Locate.js'
|
file 'leaflet.locate.js', 'src/L.Control.Locate.js'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ folder 'vendor/assets' do
|
||||||
file 'leaflet.osm.js', 'leaflet-osm.js'
|
file 'leaflet.osm.js', 'leaflet-osm.js'
|
||||||
end
|
end
|
||||||
|
|
||||||
from 'git://github.com/jieter/Leaflet.encoded.git', :tag => '0.0.8' do
|
from 'git://github.com/jieter/Leaflet.encoded.git', :tag => '0.0.9' do
|
||||||
file 'leaflet.polyline.js', 'Polyline.encoded.js'
|
file 'leaflet.polyline.js', 'Polyline.encoded.js'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
20
vendor/assets/leaflet/leaflet.contextmenu.js
vendored
20
vendor/assets/leaflet/leaflet.contextmenu.js
vendored
|
@ -71,7 +71,6 @@ L.Map.ContextMenu = L.Handler.extend({
|
||||||
this._map.on({
|
this._map.on({
|
||||||
contextmenu: this._show,
|
contextmenu: this._show,
|
||||||
mousedown: this._hide,
|
mousedown: this._hide,
|
||||||
movestart: this._hide,
|
|
||||||
zoomstart: this._hide
|
zoomstart: this._hide
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
@ -90,7 +89,6 @@ L.Map.ContextMenu = L.Handler.extend({
|
||||||
this._map.off({
|
this._map.off({
|
||||||
contextmenu: this._show,
|
contextmenu: this._show,
|
||||||
mousedown: this._hide,
|
mousedown: this._hide,
|
||||||
movestart: this._hide,
|
|
||||||
zoomstart: this._hide
|
zoomstart: this._hide
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
@ -320,12 +318,24 @@ L.Map.ContextMenu = L.Handler.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var map = me._map,
|
||||||
|
containerPoint = me._showLocation.containerPoint,
|
||||||
|
layerPoint = map.containerPointToLayerPoint(containerPoint),
|
||||||
|
latlng = map.layerPointToLatLng(layerPoint),
|
||||||
|
relatedTarget = me._showLocation.relatedTarget,
|
||||||
|
data = {
|
||||||
|
containerPoint: containerPoint,
|
||||||
|
layerPoint: layerPoint,
|
||||||
|
latlng: latlng,
|
||||||
|
relatedTarget: relatedTarget
|
||||||
|
};
|
||||||
|
|
||||||
if (hideOnSelect) {
|
if (hideOnSelect) {
|
||||||
me._hide();
|
me._hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func) {
|
if (func) {
|
||||||
func.call(context || map, me._showLocation);
|
func.call(context || map, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
me._map.fire('contextmenu.select', {
|
me._map.fire('contextmenu.select', {
|
||||||
|
@ -361,13 +371,9 @@ L.Map.ContextMenu = L.Handler.extend({
|
||||||
_showAtPoint: function (pt, data) {
|
_showAtPoint: function (pt, data) {
|
||||||
if (this._items.length) {
|
if (this._items.length) {
|
||||||
var map = this._map,
|
var map = this._map,
|
||||||
layerPoint = map.containerPointToLayerPoint(pt),
|
|
||||||
latlng = map.layerPointToLatLng(layerPoint),
|
|
||||||
event = L.extend(data || {}, {contextmenu: this});
|
event = L.extend(data || {}, {contextmenu: this});
|
||||||
|
|
||||||
this._showLocation = {
|
this._showLocation = {
|
||||||
latlng: latlng,
|
|
||||||
layerPoint: layerPoint,
|
|
||||||
containerPoint: pt
|
containerPoint: pt
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
46
vendor/assets/leaflet/leaflet.locate.js
vendored
46
vendor/assets/leaflet/leaflet.locate.js
vendored
|
@ -133,7 +133,7 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
|
||||||
'<path d="'+path+'" style="'+style+'" />'+
|
'<path d="'+path+'" style="'+style+'" />'+
|
||||||
'</svg>';
|
'</svg>';
|
||||||
return {
|
return {
|
||||||
className: 'leafet-control-locate-heading',
|
className: 'leaflet-control-locate-heading',
|
||||||
svg: svg,
|
svg: svg,
|
||||||
w: w,
|
w: w,
|
||||||
h: h
|
h: h
|
||||||
|
@ -168,6 +168,8 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
|
||||||
setView: 'untilPanOrZoom',
|
setView: 'untilPanOrZoom',
|
||||||
/** Keep the current map zoom level when setting the view and only pan. */
|
/** Keep the current map zoom level when setting the view and only pan. */
|
||||||
keepCurrentZoomLevel: false,
|
keepCurrentZoomLevel: false,
|
||||||
|
/** After activating the plugin by clicking on the icon, zoom to the selected zoom level, even when keepCurrentZoomLevel is true. Set to 'false' to disable this feature. */
|
||||||
|
initialZoomLevel: false,
|
||||||
/**
|
/**
|
||||||
* This callback can be used to override the viewport tracking
|
* This callback can be used to override the viewport tracking
|
||||||
* This function should return a LatLngBounds object.
|
* This function should return a LatLngBounds object.
|
||||||
|
@ -467,10 +469,21 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
|
||||||
this._map.on('zoomstart', this._onZoom, this);
|
this._map.on('zoomstart', this._onZoom, this);
|
||||||
this._map.on('zoomend', this._onZoomEnd, this);
|
this._map.on('zoomend', this._onZoomEnd, this);
|
||||||
if (this.options.showCompass) {
|
if (this.options.showCompass) {
|
||||||
if ('ondeviceorientationabsolute' in window) {
|
var oriAbs = 'ondeviceorientationabsolute' in window;
|
||||||
L.DomEvent.on(window, 'deviceorientationabsolute', this._onDeviceOrientation, this);
|
if (oriAbs || ('ondeviceorientation' in window)) {
|
||||||
} else if ('ondeviceorientation' in window) {
|
var _this = this;
|
||||||
L.DomEvent.on(window, 'deviceorientation', this._onDeviceOrientation, this);
|
var deviceorientation = function () {
|
||||||
|
L.DomEvent.on(window, oriAbs ? 'deviceorientationabsolute' : 'deviceorientation', _this._onDeviceOrientation, _this);
|
||||||
|
};
|
||||||
|
if (DeviceOrientationEvent && typeof DeviceOrientationEvent.requestPermission === 'function') {
|
||||||
|
DeviceOrientationEvent.requestPermission().then(function (permissionState) {
|
||||||
|
if (permissionState === 'granted') {
|
||||||
|
deviceorientation();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
deviceorientation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -514,6 +527,10 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
|
||||||
this._event = undefined; // clear the current location so we can get back into the bounds
|
this._event = undefined; // clear the current location so we can get back into the bounds
|
||||||
this.options.onLocationOutsideMapBounds(this);
|
this.options.onLocationOutsideMapBounds(this);
|
||||||
} else {
|
} else {
|
||||||
|
if (this._justClicked && this.options.initialZoomLevel !== false) {
|
||||||
|
var f = this.options.flyTo ? this._map.flyTo : this._map.setView;
|
||||||
|
f.bind(this._map)([this._event.latitude, this._event.longitude], this.options.initialZoomLevel);
|
||||||
|
} else
|
||||||
if (this.options.keepCurrentZoomLevel) {
|
if (this.options.keepCurrentZoomLevel) {
|
||||||
var f = this.options.flyTo ? this._map.flyTo : this._map.panTo;
|
var f = this.options.flyTo ? this._map.flyTo : this._map.panTo;
|
||||||
f.bind(this._map)([this._event.latitude, this._event.longitude]);
|
f.bind(this._map)([this._event.latitude, this._event.longitude]);
|
||||||
|
@ -538,6 +555,10 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
_drawCompass: function() {
|
_drawCompass: function() {
|
||||||
|
if (!this._event) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var latlng = this._event.latlng;
|
var latlng = this._event.latlng;
|
||||||
|
|
||||||
if (this.options.showCompass && latlng && this._compassHeading !== null) {
|
if (this.options.showCompass && latlng && this._compassHeading !== null) {
|
||||||
|
@ -610,14 +631,23 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
|
||||||
this._drawCompass();
|
this._drawCompass();
|
||||||
|
|
||||||
var t = this.options.strings.popup;
|
var t = this.options.strings.popup;
|
||||||
|
function getPopupText() {
|
||||||
|
if (typeof t === 'string') {
|
||||||
|
return L.Util.template(t, {distance: distance, unit: unit});
|
||||||
|
} else if (typeof t === 'function') {
|
||||||
|
return t({distance: distance, unit: unit});
|
||||||
|
} else {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.options.showPopup && t && this._marker) {
|
if (this.options.showPopup && t && this._marker) {
|
||||||
this._marker
|
this._marker
|
||||||
.bindPopup(L.Util.template(t, {distance: distance, unit: unit}))
|
.bindPopup(getPopupText())
|
||||||
._popup.setLatLng(latlng);
|
._popup.setLatLng(latlng);
|
||||||
}
|
}
|
||||||
if (this.options.showPopup && t && this._compass) {
|
if (this.options.showPopup && t && this._compass) {
|
||||||
this._compass
|
this._compass
|
||||||
.bindPopup(L.Util.template(t, {distance: distance, unit: unit}))
|
.bindPopup(getPopupText())
|
||||||
._popup.setLatLng(latlng);
|
._popup.setLatLng(latlng);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -774,7 +804,7 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
|
||||||
|
|
||||||
if (this._event && !this._ignoreEvent) {
|
if (this._event && !this._ignoreEvent) {
|
||||||
// If we have zoomed in and out and ended up sideways treat it as a pan
|
// If we have zoomed in and out and ended up sideways treat it as a pan
|
||||||
if (!this._map.getBounds().pad(-.3).contains(this._marker.getLatLng())) {
|
if (this._marker && !this._map.getBounds().pad(-.3).contains(this._marker.getLatLng())) {
|
||||||
this._userPanned = true;
|
this._userPanned = true;
|
||||||
this._updateContainerStyle();
|
this._updateContainerStyle();
|
||||||
this._drawMarker();
|
this._drawMarker();
|
||||||
|
|
2
vendor/assets/leaflet/leaflet.polyline.js
vendored
2
vendor/assets/leaflet/leaflet.polyline.js
vendored
|
@ -78,7 +78,7 @@
|
||||||
|
|
||||||
for (var i = 0, len = numbers.length; i < len;) {
|
for (var i = 0, len = numbers.length; i < len;) {
|
||||||
for (var d = 0; d < options.dimension; ++d, ++i) {
|
for (var d = 0; d < options.dimension; ++d, ++i) {
|
||||||
var num = numbers[i];
|
var num = numbers[i].toFixed(options.precision);
|
||||||
var delta = num - (lastNumbers[d] || 0);
|
var delta = num - (lastNumbers[d] || 0);
|
||||||
lastNumbers[d] = num;
|
lastNumbers[d] = num;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue