First attempt at leaflet 1.4 upgrade
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-contrib-web-worldmap",
|
||||
"version": "1.5.30",
|
||||
"version": "2.0.0",
|
||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||
"dependencies": {
|
||||
"cgi": "0.3.1",
|
||||
|
@ -53,14 +53,14 @@ a {
|
||||
#map {
|
||||
position:fixed;
|
||||
top:40px;
|
||||
bottom:0px;
|
||||
bottom:1px;
|
||||
min-width:100%;
|
||||
display:block;
|
||||
}
|
||||
|
||||
#foot {
|
||||
position:absolute;
|
||||
bottom:-1px;
|
||||
bottom:0px;
|
||||
left:-1px;
|
||||
z-index:1;
|
||||
font-size:9px;
|
||||
|
@ -32,7 +32,6 @@
|
||||
<link rel="stylesheet",type="text/css" href="leaflet/leaflet.fullscreen.css">
|
||||
<link rel="stylesheet",type="text/css" href="leaflet/Leaflet.Dialog.css">
|
||||
<link rel="stylesheet",type="text/css" href="leaflet/leaflet-velocity.min.css">
|
||||
<link rel="stylesheet",type="text/css" href="leaflet/leaflet.label.css">
|
||||
<link rel="stylesheet",type="text/css" href="leaflet/Leaflet.coordinates.css">
|
||||
|
||||
<link rel="shortcut icon" type="image/ico" href="favicon.ico"/>
|
||||
@ -61,7 +60,6 @@
|
||||
<script type="text/javascript" src="leaflet/leaflet-side-by-side.js"></script>
|
||||
<script type="text/javascript" src="leaflet/OSMBuildings-Leaflet.js"></script>
|
||||
<script type="text/javascript" src="leaflet/leaflet-omnivore.min.js"></script>
|
||||
<script type="text/javascript" src="leaflet/leaflet.label.js"></script>
|
||||
<script type="text/javascript" src="leaflet/Leaflet.coordinates.js"></script>
|
||||
|
||||
<script type="text/javascript" src="leaflet/dialog-polyfill.js"></script>
|
||||
@ -1340,18 +1338,20 @@ function setMarker(data) {
|
||||
// If .label then use that rather than name tooltip
|
||||
if (data.label) {
|
||||
if (typeof data.label === "boolean" && data.label === true) {
|
||||
marker.bindLabel(data.name, { noHide:true, offset:labelOffset });
|
||||
marker.bindTooltip(data.name, { permanent:true, direction:"right", offset:labelOffset });
|
||||
}
|
||||
else if (typeof data.label === "string" && data.label.length > 0) {
|
||||
marker.bindLabel(data.label, { noHide:true, offset:labelOffset });
|
||||
marker.bindTooltip(data.label, { permanent:true, direction:"right", offset:labelOffset });
|
||||
}
|
||||
console.log("M1",marker);
|
||||
delete marker.options.title;
|
||||
delete data.label;
|
||||
}
|
||||
// otherwise check for .tooltip then use that rather than name tooltip
|
||||
else if (data.tooltip) {
|
||||
if (typeof data.tooltip === "string" && data.tooltip.length > 0) {
|
||||
marker.bindLabel(data.tooltip, { direction:"left", offset:[22,-16] });
|
||||
marker.bindTooltip(data.tooltip, { direction:"left", offset:[22,-16] });
|
||||
console.log("M2",marker);
|
||||
delete marker.options.title;
|
||||
delete data.tooltip;
|
||||
}
|
||||
|
@ -5,8 +5,6 @@
|
||||
text-align: left;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.leaflet-control-dialog .leaflet-control-dialog-inner {
|
||||
@ -15,7 +13,7 @@
|
||||
float: left;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 16px 0px;
|
||||
padding: 20px 0px;
|
||||
}
|
||||
|
||||
.leaflet-control-dialog
|
||||
@ -70,7 +68,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0px;
|
||||
padding: 0 14px;
|
||||
padding: 0 20px;
|
||||
min-height: 50px;
|
||||
overflow: auto;
|
||||
box-sizing: border-box;
|
||||
|
@ -1,22 +1,24 @@
|
||||
L.Control.Dialog = L.Control.extend({
|
||||
options: {
|
||||
size: [ 200, 160 ],
|
||||
minSize: [ 200, 100 ],
|
||||
maxSize: [ 400, 800 ],
|
||||
anchor: [ 44, -165 ],
|
||||
position: "topright",
|
||||
size: [ 300, 300 ],
|
||||
minSize: [ 100, 100 ],
|
||||
maxSize: [ 350, 350 ],
|
||||
anchor: [ 250, 250 ],
|
||||
position: "topleft",
|
||||
initOpen: true
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
this.options = JSON.parse(JSON.stringify(this.options));
|
||||
L.setOptions(this, options);
|
||||
|
||||
this._attributions = {};
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
this._initLayout();
|
||||
this._map = map;
|
||||
|
||||
this.update();
|
||||
|
||||
if (!this.options.initOpen) {
|
||||
@ -176,17 +178,14 @@ L.Control.Dialog = L.Control.extend({
|
||||
},
|
||||
|
||||
_initLayout: function() {
|
||||
var className = "leaflet-control-dialog";
|
||||
var container = (this._container = L.DomUtil.create("div", className));
|
||||
var className = "leaflet-control-dialog",
|
||||
container = (this._container = L.DomUtil.create("div", className));
|
||||
|
||||
container.style.width = this.options.size[0] + "px";
|
||||
//container.style.height = this.options.size[1] + "px";
|
||||
container.style.height = this.options.size[1] + "px";
|
||||
|
||||
container.style.top = this.options.anchor[0] + "px";
|
||||
// container.style.left = this.options.anchor[1] + "px";
|
||||
container.style.right = "0px";
|
||||
// container.style.display = "flex";
|
||||
// container.style["flex-direction"] = "column";
|
||||
container.style.left = this.options.anchor[1] + "px";
|
||||
|
||||
var stop = L.DomEvent.stopPropagation;
|
||||
L.DomEvent.on(container, "click", stop)
|
||||
@ -361,11 +360,10 @@ L.Control.Dialog = L.Control.extend({
|
||||
|
||||
_updateLayout: function() {
|
||||
this._container.style.width = this.options.size[0] + "px";
|
||||
//this._container.style.height = this.options.size[1] + "px";
|
||||
this._container.style.height = this.options.size[1] + "px";
|
||||
|
||||
this._container.style.top = this.options.anchor[0] + "px";
|
||||
//this._container.style.left = this.options.anchor[1] + "px";
|
||||
this._container.style.right = "0px";
|
||||
this._container.style.left = this.options.anchor[1] + "px";
|
||||
}
|
||||
});
|
||||
|
||||
|
2
worldmap/leaflet/Leaflet.fullscreen.min.js
vendored
@ -1 +1 @@
|
||||
L.Control.Fullscreen=L.Control.extend({options:{position:"topleft",title:{"false":"View Fullscreen","true":"Exit Fullscreen"}},onAdd:function(map){var container=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",container);this.link.href="#";this._map=map;this._map.on("fullscreenchange",this._toggleTitle,this);this._toggleTitle();L.DomEvent.on(this.link,"click",this._click,this);return container},_click:function(e){L.DomEvent.stopPropagation(e);L.DomEvent.preventDefault(e);this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||false},toggleFullscreen:function(options){var container=this.getContainer();if(this.isFullscreen()){if(options&&options.pseudoFullscreen){this._disablePseudoFullscreen(container)}else if(document.exitFullscreen){document.exitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else{this._disablePseudoFullscreen(container)}}else{if(options&&options.pseudoFullscreen){this._enablePseudoFullscreen(container)}else if(container.requestFullscreen){container.requestFullscreen()}else if(container.mozRequestFullScreen){container.mozRequestFullScreen()}else if(container.webkitRequestFullscreen){container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}else if(container.msRequestFullscreen){container.msRequestFullscreen()}else{this._enablePseudoFullscreen(container)}}},_enablePseudoFullscreen:function(container){L.DomUtil.addClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(true);this.invalidateSize();this.fire("fullscreenchange")},_disablePseudoFullscreen:function(container){L.DomUtil.removeClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(false);this.invalidateSize();this.fire("fullscreenchange")},_setFullscreen:function(fullscreen){this._isFullscreen=fullscreen;var container=this.getContainer();if(fullscreen){L.DomUtil.addClass(container,"leaflet-fullscreen-on")}else{L.DomUtil.removeClass(container,"leaflet-fullscreen-on")}},_onFullscreenChange:function(e){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;if(fullscreenElement===this.getContainer()&&!this._isFullscreen){this._setFullscreen(true);this.fire("fullscreenchange")}else if(fullscreenElement!==this.getContainer()&&this._isFullscreen){this._setFullscreen(false);this.fire("fullscreenchange")}}});L.Map.mergeOptions({fullscreenControl:false});L.Map.addInitHook(function(){if(this.options.fullscreenControl){this.fullscreenControl=new L.Control.Fullscreen(this.options.fullscreenControl);this.addControl(this.fullscreenControl)}var fullscreenchange;if("onfullscreenchange"in document){fullscreenchange="fullscreenchange"}else if("onmozfullscreenchange"in document){fullscreenchange="mozfullscreenchange"}else if("onwebkitfullscreenchange"in document){fullscreenchange="webkitfullscreenchange"}else if("onmsfullscreenchange"in document){fullscreenchange="MSFullscreenChange"}if(fullscreenchange){var onFullscreenChange=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,fullscreenchange,onFullscreenChange)});this.on("unload",function(){L.DomEvent.off(document,fullscreenchange,onFullscreenChange)})}});L.control.fullscreen=function(options){return new L.Control.Fullscreen(options)};
|
||||
(function(factory){var L;if(typeof define==="function"&&define.amd){define(["leaflet"],factory)}else if(typeof module!=="undefined"){L=require("leaflet");module.exports=factory(L)}else{if(typeof window.L==="undefined"){throw new Error("Leaflet must be loaded first")}factory(window.L)}})(function(L){L.Control.Fullscreen=L.Control.extend({options:{position:"topleft",title:{"false":"View Fullscreen","true":"Exit Fullscreen"}},onAdd:function(map){var container=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",container);this.link.href="#";this._map=map;this._map.on("fullscreenchange",this._toggleTitle,this);this._toggleTitle();L.DomEvent.on(this.link,"click",this._click,this);return container},_click:function(e){L.DomEvent.stopPropagation(e);L.DomEvent.preventDefault(e);this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||false},toggleFullscreen:function(options){var container=this.getContainer();if(this.isFullscreen()){if(options&&options.pseudoFullscreen){this._disablePseudoFullscreen(container)}else if(document.exitFullscreen){document.exitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else{this._disablePseudoFullscreen(container)}}else{if(options&&options.pseudoFullscreen){this._enablePseudoFullscreen(container)}else if(container.requestFullscreen){container.requestFullscreen()}else if(container.mozRequestFullScreen){container.mozRequestFullScreen()}else if(container.webkitRequestFullscreen){container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}else if(container.msRequestFullscreen){container.msRequestFullscreen()}else{this._enablePseudoFullscreen(container)}}},_enablePseudoFullscreen:function(container){L.DomUtil.addClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(true);this.fire("fullscreenchange")},_disablePseudoFullscreen:function(container){L.DomUtil.removeClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(false);this.fire("fullscreenchange")},_setFullscreen:function(fullscreen){this._isFullscreen=fullscreen;var container=this.getContainer();if(fullscreen){L.DomUtil.addClass(container,"leaflet-fullscreen-on")}else{L.DomUtil.removeClass(container,"leaflet-fullscreen-on")}this.invalidateSize()},_onFullscreenChange:function(e){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;if(fullscreenElement===this.getContainer()&&!this._isFullscreen){this._setFullscreen(true);this.fire("fullscreenchange")}else if(fullscreenElement!==this.getContainer()&&this._isFullscreen){this._setFullscreen(false);this.fire("fullscreenchange")}}});L.Map.mergeOptions({fullscreenControl:false});L.Map.addInitHook(function(){if(this.options.fullscreenControl){this.fullscreenControl=new L.Control.Fullscreen(this.options.fullscreenControl);this.addControl(this.fullscreenControl)}var fullscreenchange;if("onfullscreenchange"in document){fullscreenchange="fullscreenchange"}else if("onmozfullscreenchange"in document){fullscreenchange="mozfullscreenchange"}else if("onwebkitfullscreenchange"in document){fullscreenchange="webkitfullscreenchange"}else if("onmsfullscreenchange"in document){fullscreenchange="MSFullscreenChange"}if(fullscreenchange){var onFullscreenChange=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,fullscreenchange,onFullscreenChange)});this.on("unload",function(){L.DomEvent.off(document,fullscreenchange,onFullscreenChange)})}});L.control.fullscreen=function(options){return new L.Control.Fullscreen(options)}});
|
||||
|
@ -4,45 +4,50 @@
|
||||
|
||||
L.TileLayer.Grayscale = L.TileLayer.extend({
|
||||
options: {
|
||||
enableCanvas: true
|
||||
quotaRed: 21,
|
||||
quotaGreen: 71,
|
||||
quotaBlue: 8,
|
||||
quotaDividerTune: 0,
|
||||
quotaDivider: function() {
|
||||
return this.quotaRed + this.quotaGreen + this.quotaBlue + this.quotaDividerTune;
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function (url, options) {
|
||||
var canvasEl = document.createElement('canvas');
|
||||
if( !(canvasEl.getContext && canvasEl.getContext('2d')) ) {
|
||||
options.enableCanvas = false;
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
options.crossOrigin = true;
|
||||
L.TileLayer.prototype.initialize.call(this, url, options);
|
||||
|
||||
this.on('tileload', function(e) {
|
||||
this._makeGrayscale(e.tile);
|
||||
});
|
||||
},
|
||||
|
||||
_loadTile: function (tile, tilePoint) {
|
||||
tile.setAttribute('crossorigin', 'anonymous');
|
||||
L.TileLayer.prototype._loadTile.call(this, tile, tilePoint);
|
||||
_createTile: function () {
|
||||
var tile = L.TileLayer.prototype._createTile.call(this);
|
||||
tile.crossOrigin = "Anonymous";
|
||||
return tile;
|
||||
},
|
||||
|
||||
_tileOnLoad: function () {
|
||||
if (this._layer.options.enableCanvas && !this.canvasContext) {
|
||||
_makeGrayscale: function (img) {
|
||||
if (img.getAttribute('data-grayscaled'))
|
||||
return;
|
||||
|
||||
img.crossOrigin = '';
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = canvas.height = this._layer.options.tileSize;
|
||||
this.canvasContext = canvas.getContext("2d");
|
||||
}
|
||||
var ctx = this.canvasContext;
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0);
|
||||
|
||||
if (ctx) {
|
||||
this.onload = null; // to prevent an infinite loop
|
||||
ctx.drawImage(this, 0, 0);
|
||||
var imgd = ctx.getImageData(0, 0, this._layer.options.tileSize, this._layer.options.tileSize);
|
||||
var imgd = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
var pix = imgd.data;
|
||||
for (var i = 0, n = pix.length; i < n; i += 4) {
|
||||
pix[i] = pix[i + 1] = pix[i + 2] = (3 * pix[i] + 4 * pix[i + 1] + pix[i + 2]) / 8;
|
||||
pix[i] = pix[i + 1] = pix[i + 2] = (this.options.quotaRed * pix[i] + this.options.quotaGreen * pix[i + 1] + this.options.quotaBlue * pix[i + 2]) / this.options.quotaDivider();
|
||||
}
|
||||
ctx.putImageData(imgd, 0, 0);
|
||||
this.removeAttribute("crossorigin");
|
||||
this.src = ctx.canvas.toDataURL();
|
||||
}
|
||||
|
||||
L.TileLayer.prototype._tileOnLoad.call(this);
|
||||
img.setAttribute('data-grayscaled', true);
|
||||
img.src = canvas.toDataURL();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
background-color: #fff;
|
||||
border: none;
|
||||
border-bottom: 1px solid #ccc;
|
||||
min-width: 26px;
|
||||
min-height: 26px;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
@ -47,6 +48,7 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.leaflet-touch .leaflet-bar button {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
|
@ -169,10 +169,8 @@ L.Control.EasyButton = L.Control.extend({
|
||||
|
||||
this.button = L.DomUtil.create(this.options.tagName, '');
|
||||
|
||||
// the next three if statements should be collapsed into the options
|
||||
// when it's time for breaking changes.
|
||||
if (this.tagName === 'button') {
|
||||
this.button.type = 'button';
|
||||
if (this.options.tagName === 'button') {
|
||||
this.button.setAttribute('type', 'button');
|
||||
}
|
||||
|
||||
if (this.options.id ){
|
||||
@ -186,12 +184,13 @@ L.Control.EasyButton = L.Control.extend({
|
||||
// don't let double clicks and mousedown get to the map
|
||||
L.DomEvent.addListener(this.button, 'dblclick', L.DomEvent.stop);
|
||||
L.DomEvent.addListener(this.button, 'mousedown', L.DomEvent.stop);
|
||||
L.DomEvent.addListener(this.button, 'mouseup', L.DomEvent.stop);
|
||||
|
||||
// take care of normal clicks
|
||||
L.DomEvent.addListener(this.button,'click', function(e){
|
||||
L.DomEvent.stop(e);
|
||||
this._currentState.onClick(this, this._map ? this._map : null );
|
||||
this._map.getContainer().focus();
|
||||
this._map && this._map.getContainer().focus();
|
||||
}, this);
|
||||
|
||||
// prep the contents of the control
|
||||
@ -219,6 +218,11 @@ L.Control.EasyButton = L.Control.extend({
|
||||
|
||||
state: function(newState){
|
||||
|
||||
// when called with no args, it's a getter
|
||||
if (arguments.length === 0) {
|
||||
return this._currentState.stateName;
|
||||
}
|
||||
|
||||
// activate by name
|
||||
if(typeof newState == 'string'){
|
||||
|
||||
@ -279,8 +283,6 @@ L.Control.EasyButton = L.Control.extend({
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
enable: function(){
|
||||
L.DomUtil.addClass(this.button, 'enabled');
|
||||
L.DomUtil.removeClass(this.button, 'disabled');
|
||||
@ -288,8 +290,6 @@ L.Control.EasyButton = L.Control.extend({
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
|
||||
disable: function(){
|
||||
L.DomUtil.addClass(this.button, 'disabled');
|
||||
L.DomUtil.removeClass(this.button, 'enabled');
|
||||
@ -297,24 +297,21 @@ L.Control.EasyButton = L.Control.extend({
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
removeFrom: function (map) {
|
||||
|
||||
this._container.parentNode.removeChild(this._container);
|
||||
this._map = null;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
onAdd: function(){
|
||||
var containerObj = L.easyBar([this], {
|
||||
onAdd: function(map){
|
||||
var bar = L.easyBar([this], {
|
||||
position: this.options.position,
|
||||
leafletClasses: this.options.leafletClasses
|
||||
});
|
||||
this._container = containerObj.container;
|
||||
return this._container;
|
||||
}
|
||||
this._anonymousBar = bar;
|
||||
this._container = bar.container;
|
||||
return this._anonymousBar.container;
|
||||
},
|
||||
|
||||
removeFrom: function (map) {
|
||||
if (this._map === map)
|
||||
this.remove();
|
||||
return this;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 696 B |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 797 B After Width: | Height: | Size: 618 B |
2
worldmap/leaflet/l.ellipse.min.js
vendored
@ -1 +1 @@
|
||||
L.Ellipse=L.Path.extend({initialize:function(d,c,a,b){L.Path.prototype.initialize.call(this,b);this._latlng=L.latLng(d);if(a){this._tiltDeg=a}else{this._tiltDeg=0}if(c){this._mRadiusX=c[0];this._mRadiusY=c[1]}},options:{fill:true,startAngle:0,endAngle:359.9},setLatLng:function(a){this._latlng=L.latLng(a);return this.redraw()},setRadius:function(a){this._mRadiusX=a[0];this._mRadiusY=a[1];return this.redraw()},setTilt:function(a){this._tiltDeg=a;return this.redraw()},projectLatlngs:function(){var e=this._getLngRadius(),c=this._getLatRadius(),d=this._latlng,a=this._map.latLngToLayerPoint([d.lat,d.lng-e]),b=this._map.latLngToLayerPoint([d.lat-c,d.lng]);this._point=this._map.latLngToLayerPoint(d);this._radiusX=Math.max(this._point.x-a.x,1);this._radiusY=Math.max(b.y-this._point.y,1);this._endPointParams=this._centerPointToEndPoint()},getBounds:function(){var c=this._getLngRadius(),a=this._getLatRadius(),b=this._latlng;return new L.LatLngBounds([b.lat-a,b.lng-c],[b.lat+a,b.lng+c])},getLatLng:function(){return this._latlng},getPathString:function(){var f=this._point,e=this._radiusX,d=this._radiusY,b=this._tiltDeg,a=this._endPointParams;if(this._checkIfEmpty()){return""}if(L.Browser.svg){return"M"+a.x0+","+a.y0+"A"+e+","+d+","+b+","+a.largeArc+","+a.sweep+","+a.x1+","+a.y1+" z"}else{f._round();e=Math.round(e);d=Math.round(d);return"AL "+f.x+","+f.y+" "+e+","+d+" "+b+","+(65535*360)}},getRadius:function(){return new L.point(this._mRadiusX,this._mRadiusY)},_centerPointToEndPoint:function(){var j=this._point,e=this._radiusX,a=this._radiusY,g=(this.options.startAngle+this.options.endAngle)*L.LatLng.DEG_TO_RAD,h=this.options.startAngle*L.LatLng.DEG_TO_RAD,m=this.options.endAngle,i=this._tiltDeg*L.LatLng.DEG_TO_RAD;var f=j.x+Math.cos(i)*e*Math.cos(h)+Math.sin(-i)*a*Math.sin(h);var l=j.y+Math.sin(i)*e*Math.cos(h)+Math.cos(i)*a*Math.sin(h);var d=j.x+Math.cos(i)*e*Math.cos(g)+Math.sin(-i)*a*Math.sin(g);var k=j.y+Math.sin(i)*e*Math.cos(g)+Math.cos(i)*a*Math.sin(g);var b=(m>180)?1:0;var n=(m>0)?1:0;return{x0:f,y0:l,tilt:i,largeArc:b,sweep:n,x1:d,y1:k}},_getLatRadius:function(){return(this._mRadiusY/40075017)*360},_getLngRadius:function(){return((this._mRadiusX/40075017)*360)/Math.cos(L.LatLng.DEG_TO_RAD*this._latlng.lat)},_checkIfEmpty:function(){if(!this._map){return false}var a=this._map._pathViewport,b=this._radiusX,c=this._point;return c.x-b>a.max.x||c.y-b>a.max.y||c.x+b<a.min.x||c.y+b<a.min.y}});L.ellipse=function(d,c,a,b){return new L.Ellipse(d,c,a,b)};
|
||||
L.SVG.include({_updateEllipse:function(a){var c=(a._point,a._radiusX),d=a._radiusY,e=a._tiltDeg,f=a._endPointParams,g="M"+f.x0+","+f.y0+"A"+c+","+d+","+e+","+f.largeArc+","+f.sweep+","+f.x1+","+f.y1+" z";this._setPath(a,g)}}),L.Canvas.include({_updateEllipse:function(a){if(!a._empty()){var b=a._point,c=this._ctx,d=a._radiusX,e=(a._radiusY||d)/d;this._drawnLayers[a._leaflet_id]=a,c.save(),c.translate(b.x,b.y),0!==a._tilt&&c.rotate(a._tilt),1!==e&&c.scale(1,e),c.beginPath(),c.arc(0,0,d,0,2*Math.PI),c.restore(),this._fillStroke(c,a)}}}),L.Ellipse=L.Path.extend({options:{fill:!0,startAngle:0,endAngle:359.9},initialize:function(a,b,c,d){L.setOptions(this,d),this._latlng=L.latLng(a),c?this._tiltDeg=c:this._tiltDeg=0,b&&(this._mRadiusX=b[0],this._mRadiusY=b[1])},setRadius:function(a){return this._mRadiusX=a[0],this._mRadiusY=a[1],this.redraw()},getRadius:function(){return new L.point(this._mRadiusX,this._mRadiusY)},setTilt:function(a){return this._tiltDeg=a,this.redraw()},getBounds:function(){var a=this._getLngRadius(),b=this._getLatRadius(),c=this._latlng;return new L.LatLngBounds([c.lat-b,c.lng-a],[c.lat+b,c.lng+a])},setLatLng:function(a){return this._latlng=L.latLng(a),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setStyle:L.Path.prototype.setStyle,_project:function(){var a=this._getLngRadius(),b=this._getLatRadius(),c=this._latlng,d=this._map.latLngToLayerPoint([c.lat,c.lng-a]),e=this._map.latLngToLayerPoint([c.lat-b,c.lng]);this._point=this._map.latLngToLayerPoint(c),this._radiusX=Math.max(this._point.x-d.x,1),this._radiusY=Math.max(e.y-this._point.y,1),this._tilt=Math.PI*this._tiltDeg/180,this._endPointParams=this._centerPointToEndPoint(),this._updateBounds()},_updateBounds:function(){var a=Math.sin(this._tilt),b=Math.cos(this._tilt),c=a*a,d=b*b,e=this._radiusX*this._radiusX,f=this._radiusY*this._radiusY,g=Math.sqrt(e*d+f*c),h=Math.sqrt(e*c+f*d),i=this._clickTolerance(),j=[g+i,h+i];this._pxBounds=new L.Bounds(this._point.subtract(j),this._point.add(j))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateEllipse(this)},_getLatRadius:function(){return this._mRadiusY/40075017*360},_getLngRadius:function(){return this._mRadiusX/40075017*360/Math.cos(Math.PI/180*this._latlng.lat)},_centerPointToEndPoint:function(){var a=this._point,b=this._radiusX,c=this._radiusY,d=(this.options.startAngle+this.options.endAngle)*(Math.PI/180),e=this.options.startAngle*(Math.PI/180),f=this.options.endAngle,g=this._tiltDeg*(Math.PI/180),h=a.x+Math.cos(g)*b*Math.cos(e)+Math.sin(-g)*c*Math.sin(e),i=a.y+Math.sin(g)*b*Math.cos(e)+Math.cos(g)*c*Math.sin(e),j=a.x+Math.cos(g)*b*Math.cos(d)+Math.sin(-g)*c*Math.sin(d),k=a.y+Math.sin(g)*b*Math.cos(d)+Math.cos(g)*c*Math.sin(d),l=f>180?1:0,m=f>0?1:0;return{x0:h,y0:i,tilt:g,largeArc:l,sweep:m,x1:j,y1:k}},_empty:function(){return this._radiusX&&this._radiusY&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(a){var b=Math.sin(this._tilt),c=Math.cos(this._tilt),d=a.x-this._point.x,e=a.y-this._point.y,f=c*d+b*e,g=b*d-c*e;return f*f/(this._radiusX*this._radiusX)+g*g/(this._radiusY*this._radiusY)<=1}}),L.ellipse=function(a,b,c,d){return new L.Ellipse(a,b,c,d)};
|
||||
|
@ -3,9 +3,9 @@
|
||||
simpleheat, a tiny JavaScript library for drawing heatmaps with Canvas
|
||||
https://github.com/mourner/simpleheat
|
||||
*/
|
||||
!function(){"use strict";function t(i){return this instanceof t?(this._canvas=i="string"==typeof i?document.getElementById(i):i,this._ctx=i.getContext("2d"),this._width=i.width,this._height=i.height,this._max=1,void this.clear()):new t(i)}t.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,i){i=i||15;var a=this._circle=document.createElement("canvas"),e=a.getContext("2d"),s=this._r=t+i;return a.width=a.height=2*s,e.shadowOffsetX=e.shadowOffsetY=200,e.shadowBlur=i,e.shadowColor="black",e.beginPath(),e.arc(s-200,s-200,t,0,2*Math.PI,!0),e.closePath(),e.fill(),this},gradient:function(t){var i=document.createElement("canvas"),a=i.getContext("2d"),e=a.createLinearGradient(0,0,0,256);i.width=1,i.height=256;for(var s in t)e.addColorStop(s,t[s]);return a.fillStyle=e,a.fillRect(0,0,1,256),this._grad=a.getImageData(0,0,1,256).data,this},draw:function(t){this._circle||this.radius(this.defaultRadius),this._grad||this.gradient(this.defaultGradient);var i=this._ctx;i.clearRect(0,0,this._width,this._height);for(var a,e=0,s=this._data.length;s>e;e++)a=this._data[e],i.globalAlpha=Math.max(a[2]/this._max,t||.05),i.drawImage(this._circle,a[0]-this._r,a[1]-this._r);var n=i.getImageData(0,0,this._width,this._height);return this._colorize(n.data,this._grad),i.putImageData(n,0,0),this},_colorize:function(t,i){for(var a,e=3,s=t.length;s>e;e+=4)a=4*t[e],a&&(t[e-3]=i[a],t[e-2]=i[a+1],t[e-1]=i[a+2])}},window.simpleheat=t}(),/*
|
||||
!function(){"use strict";function t(i){return this instanceof t?(this._canvas=i="string"==typeof i?document.getElementById(i):i,this._ctx=i.getContext("2d"),this._width=i.width,this._height=i.height,this._max=1,void this.clear()):new t(i)}t.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t,i){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,i){i=i||15;var a=this._circle=document.createElement("canvas"),s=a.getContext("2d"),e=this._r=t+i;return a.width=a.height=2*e,s.shadowOffsetX=s.shadowOffsetY=200,s.shadowBlur=i,s.shadowColor="black",s.beginPath(),s.arc(e-200,e-200,t,0,2*Math.PI,!0),s.closePath(),s.fill(),this},gradient:function(t){var i=document.createElement("canvas"),a=i.getContext("2d"),s=a.createLinearGradient(0,0,0,256);i.width=1,i.height=256;for(var e in t)s.addColorStop(e,t[e]);return a.fillStyle=s,a.fillRect(0,0,1,256),this._grad=a.getImageData(0,0,1,256).data,this},draw:function(t){this._circle||this.radius(this.defaultRadius),this._grad||this.gradient(this.defaultGradient);var i=this._ctx;i.clearRect(0,0,this._width,this._height);for(var a,s=0,e=this._data.length;e>s;s++)a=this._data[s],i.globalAlpha=Math.max(a[2]/this._max,t||.05),i.drawImage(this._circle,a[0]-this._r,a[1]-this._r);var n=i.getImageData(0,0,this._width,this._height);return this._colorize(n.data,this._grad),i.putImageData(n,0,0),this},_colorize:function(t,i){for(var a,s=3,e=t.length;e>s;s+=4)a=4*t[s],a&&(t[s-3]=i[a],t[s-2]=i[a+1],t[s-1]=i[a+2])}},window.simpleheat=t}(),/*
|
||||
(c) 2014, Vladimir Agafonkin
|
||||
Leaflet.heat, a tiny and fast heatmap plugin for Leaflet.
|
||||
https://github.com/Leaflet/Leaflet.heat
|
||||
*/
|
||||
L.HeatLayer=L.Class.extend({initialize:function(t,i){this._latlngs=t,L.setOptions(this,i)},setLatLngs:function(t){return this._latlngs=t,this.redraw()},addLatLng:function(t){return this._latlngs.push(t),this.redraw()},setOptions:function(t){return L.setOptions(this,t),this._heat&&this._updateOptions(),this.redraw()},redraw:function(){return this._heat&&!this._frame&&(this._frame=L.Util.requestAnimFrame(this._redraw,this)),this},onAdd:function(t){this._map=t,this._canvas||this._initCanvas(),t._panes.overlayPane.appendChild(this._canvas),t.on("moveend",this._reset,this),t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(t){t.getPanes().overlayPane.removeChild(this._canvas),t.off("moveend",this._reset,this),t.options.zoomAnimation&&t.off("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},_initCanvas:function(){var t=this._canvas=L.DomUtil.create("canvas","leaflet-heatmap-layer"),i=this._map.getSize();t.width=i.x,t.height=i.y;var a=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(t,"leaflet-zoom-"+(a?"animated":"hide")),this._heat=simpleheat(t),this._updateOptions()},_updateOptions:function(){this._heat.radius(this.options.radius||this._heat.defaultRadius,this.options.blur),this.options.gradient&&this._heat.gradient(this.options.gradient),this.options.max&&this._heat.max(this.options.max)},_reset:function(){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t);var i=this._map.getSize();this._heat._width!==i.x&&(this._canvas.width=this._heat._width=i.x),this._heat._height!==i.y&&(this._canvas.height=this._heat._height=i.y),this._redraw()},_redraw:function(){var t,i,a,e,s,n,h,o,r,d=[],_=this._heat._r,l=this._map.getSize(),m=new L.LatLngBounds(this._map.containerPointToLatLng(L.point([-_,-_])),this._map.containerPointToLatLng(l.add([_,_]))),c=void 0===this.options.maxZoom?this._map.getMaxZoom():this.options.maxZoom,u=1/Math.pow(2,Math.max(0,Math.min(c-this._map.getZoom(),12))),g=_/2,f=[],p=this._map._getMapPanePos(),v=p.x%g,w=p.y%g;for(t=0,i=this._latlngs.length;i>t;t++)m.contains(this._latlngs[t])&&(a=this._map.latLngToContainerPoint(this._latlngs[t]),s=Math.floor((a.x-v)/g)+2,n=Math.floor((a.y-w)/g)+2,r=(this._latlngs[t].alt||1)*u,f[n]=f[n]||[],e=f[n][s],e?(e[0]=(e[0]*e[2]+a.x*r)/(e[2]+r),e[1]=(e[1]*e[2]+a.y*r)/(e[2]+r),e[2]+=r):f[n][s]=[a.x,a.y,r]);for(t=0,i=f.length;i>t;t++)if(f[t])for(h=0,o=f[t].length;o>h;h++)e=f[t][h],e&&d.push([Math.round(e[0]),Math.round(e[1]),Math.min(e[2],1)]);this._heat.data(d).draw(),this._frame=null},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),a=this._map._getCenterOffset(t.center)._multiplyBy(-i).subtract(this._map._getMapPanePos());this._canvas.style[L.DomUtil.TRANSFORM]=L.DomUtil.getTranslateString(a)+" scale("+i+")"}}),L.heatLayer=function(t,i){return new L.HeatLayer(t,i)};
|
||||
L.HeatLayer=(L.Layer?L.Layer:L.Class).extend({initialize:function(t,i){this._latlngs=t,L.setOptions(this,i)},setLatLngs:function(t){return this._latlngs=t,this.redraw()},addLatLng:function(t){return this._latlngs.push(t),this.redraw()},setOptions:function(t){return L.setOptions(this,t),this._heat&&this._updateOptions(),this.redraw()},redraw:function(){return!this._heat||this._frame||this._map._animating||(this._frame=L.Util.requestAnimFrame(this._redraw,this)),this},onAdd:function(t){this._map=t,this._canvas||this._initCanvas(),t._panes.overlayPane.appendChild(this._canvas),t.on("moveend",this._reset,this),t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(t){t.getPanes().overlayPane.removeChild(this._canvas),t.off("moveend",this._reset,this),t.options.zoomAnimation&&t.off("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},_initCanvas:function(){var t=this._canvas=L.DomUtil.create("canvas","leaflet-heatmap-layer leaflet-layer"),i=L.DomUtil.testProp(["transformOrigin","WebkitTransformOrigin","msTransformOrigin"]);t.style[i]="50% 50%";var a=this._map.getSize();t.width=a.x,t.height=a.y;var s=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(t,"leaflet-zoom-"+(s?"animated":"hide")),this._heat=simpleheat(t),this._updateOptions()},_updateOptions:function(){this._heat.radius(this.options.radius||this._heat.defaultRadius,this.options.blur),this.options.gradient&&this._heat.gradient(this.options.gradient),this.options.max&&this._heat.max(this.options.max)},_reset:function(){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t);var i=this._map.getSize();this._heat._width!==i.x&&(this._canvas.width=this._heat._width=i.x),this._heat._height!==i.y&&(this._canvas.height=this._heat._height=i.y),this._redraw()},_redraw:function(){var t,i,a,s,e,n,h,o,r,d=[],_=this._heat._r,l=this._map.getSize(),m=new L.Bounds(L.point([-_,-_]),l.add([_,_])),c=void 0===this.options.max?1:this.options.max,u=void 0===this.options.maxZoom?this._map.getMaxZoom():this.options.maxZoom,f=1/Math.pow(2,Math.max(0,Math.min(u-this._map.getZoom(),12))),g=_/2,p=[],v=this._map._getMapPanePos(),w=v.x%g,y=v.y%g;for(t=0,i=this._latlngs.length;i>t;t++)if(a=this._map.latLngToContainerPoint(this._latlngs[t]),m.contains(a)){e=Math.floor((a.x-w)/g)+2,n=Math.floor((a.y-y)/g)+2;var x=void 0!==this._latlngs[t].alt?this._latlngs[t].alt:void 0!==this._latlngs[t][2]?+this._latlngs[t][2]:1;r=x*f,p[n]=p[n]||[],s=p[n][e],s?(s[0]=(s[0]*s[2]+a.x*r)/(s[2]+r),s[1]=(s[1]*s[2]+a.y*r)/(s[2]+r),s[2]+=r):p[n][e]=[a.x,a.y,r]}for(t=0,i=p.length;i>t;t++)if(p[t])for(h=0,o=p[t].length;o>h;h++)s=p[t][h],s&&d.push([Math.round(s[0]),Math.round(s[1]),Math.min(s[2],c)]);this._heat.data(d).draw(this.options.minOpacity),this._frame=null},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),a=this._map._getCenterOffset(t.center)._multiplyBy(-i).subtract(this._map._getMapPanePos());L.DomUtil.setTransform?L.DomUtil.setTransform(this._canvas,a,i):this._canvas.style[L.DomUtil.TRANSFORM]=L.DomUtil.getTranslateString(a)+" scale("+i+")"}}),L.heatLayer=function(t,i){return new L.HeatLayer(t,i)};
|
||||
|
@ -1 +1,5 @@
|
||||
L.Control.ActiveLayers=L.Control.Layers.extend({getActiveBaseLayer:function(){return this._activeBaseLayer},getActiveOverlayLayers:function(){return this._activeOverlayLayers},onAdd:function(a){var b=L.Control.Layers.prototype.onAdd.call(this,a);return this._activeBaseLayer=this._findActiveBaseLayer(),this._activeOverlayLayers=this._findActiveOverlayLayers(),b},_findActiveBaseLayer:function(){var a=this._layers;for(var b in a)if(this._layers.hasOwnProperty(b)){var c=a[b];if(!c.overlay&&this._map.hasLayer(c.layer))return c}throw new Error("Control doesn't have any active base layer!")},_findActiveOverlayLayers:function(){var a={},b=this._layers;for(var c in b)if(this._layers.hasOwnProperty(c)){var d=b[c];d.overlay&&this._map.hasLayer(d.layer)&&(a[c]=d)}return a},_onLayerChange:function(){L.Control.Layers.prototype._onLayerChange.apply(this,arguments),this._recountLayers()},_onInputClick:function(){this._handlingClick=!0,this._recountLayers(),L.Control.Layers.prototype._onInputClick.call(this),this._handlingClick=!1},_recountLayers:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(a=0;e>a;a++)b=d[a],c=this._layers[b.layerId],b.checked&&!this._map.hasLayer(c.layer)?c.overlay?this._activeOverlayLayers[b.layerId]=c:this._activeBaseLayer=c:!b.checked&&this._map.hasLayer(c.layer)&&c.overlay&&delete this._activeOverlayLayers[b.layerId]}}),L.control.activeLayers=function(a,b,c){return new L.Control.ActiveLayers(a,b,c)};
|
||||
/**
|
||||
* Created: vogdb Date: 5/4/13 Time: 1:54 PM
|
||||
* Version: 0.3.0
|
||||
*/
|
||||
L.Control.ActiveLayers=L.Control.Layers.extend({getActiveBaseLayer:function(){return this._activeBaseLayer},getActiveOverlayLayers:function(){return this._activeOverlayLayers},onAdd:function(e){var t=L.Control.Layers.prototype.onAdd.call(this,e);return Array.isArray(this._layers)?(this._activeBaseLayer=this._findActiveBaseLayer(),this._activeOverlayLayers=this._findActiveOverlayLayers()):(this._activeBaseLayer=this._findActiveBaseLayerLegacy(),this._activeOverlayLayers=this._findActiveOverlayLayersLegacy()),t},_findActiveBaseLayer:function(){var e=this._layers;for(var t=0;t<e.length;t++){var n=e[t];if(!n.overlay&&this._map.hasLayer(n.layer))return n}throw new Error("Control doesn't have any active base layer!")},_findActiveOverlayLayers:function(){var e={},t=this._layers;for(var n=0;n<t.length;n++){var r=t[n];r.overlay&&this._map.hasLayer(r.layer)&&(e[r.layer._leaflet_id]=r)}return e},_findActiveBaseLayerLegacy:function(){var e=this._layers;for(var t in e)if(this._layers.hasOwnProperty(t)){var n=e[t];if(!n.overlay&&this._map.hasLayer(n.layer))return n}throw new Error("Control doesn't have any active base layer!")},_findActiveOverlayLayersLegacy:function(){var e={},t=this._layers;for(var n in t)if(this._layers.hasOwnProperty(n)){var r=t[n];r.overlay&&this._map.hasLayer(r.layer)&&(e[n]=r)}return e},_onLayerChange:function(){L.Control.Layers.prototype._onLayerChange.apply(this,arguments),this._recountLayers()},_onInputClick:function(){this._handlingClick=!0,this._recountLayers(),L.Control.Layers.prototype._onInputClick.call(this),this._handlingClick=!1},_recountLayers:function(){var e,t,n,r=this._form.getElementsByTagName("input"),i=r.length;for(e=0;e<i;e++)t=r[e],Array.isArray(this._layers)?n=this._layers[e]:n=this._layers[t.layerId],t.checked&&!this._map.hasLayer(n.layer)?n.overlay?this._activeOverlayLayers[t.layerId]=n:this._activeBaseLayer=n:!t.checked&&this._map.hasLayer(n.layer)&&n.overlay&&delete this._activeOverlayLayers[t.layerId]}}),L.control.activeLayers=function(e,t,n){return new L.Control.ActiveLayers(e,t,n)};
|
||||
|
@ -1,91 +1 @@
|
||||
/*
|
||||
* LEAFLET.BOATMARKER
|
||||
* v1.0.0
|
||||
* Thomas Brüggemann
|
||||
*/
|
||||
|
||||
/* BOAT ICON */
|
||||
L.BoatIcon = L.Icon.extend({
|
||||
options: {
|
||||
iconSize: new L.Point(50, 50),
|
||||
className: "leaflet-boat-icon",
|
||||
course: 0,
|
||||
color: "#8ED6FF",
|
||||
labelAnchor: [25, 25],
|
||||
wind: false,
|
||||
windDirection: 0,
|
||||
windSpeed: 0
|
||||
},
|
||||
|
||||
x: 22,
|
||||
y: 38,
|
||||
x_fac: 0.09,
|
||||
y_fac: 0.09,
|
||||
ctx: null,
|
||||
lastHeading: 0,
|
||||
lastWindDirection: 0,
|
||||
|
||||
createIcon: function () {
|
||||
var e = document.createElement("canvas");
|
||||
this._setIconStyles(e, "icon");
|
||||
var s = this.options.iconSize;
|
||||
e.width = s.x;
|
||||
e.height = s.y;
|
||||
this.ctx = e.getContext("2d");
|
||||
this.draw(e.getContext("2d"), s.x, s.y);
|
||||
return e;
|
||||
},
|
||||
|
||||
createShadow: function () {
|
||||
return null;
|
||||
},
|
||||
|
||||
draw: function(ctx, w, h) {
|
||||
if(!ctx) return;
|
||||
var x = this.x;
|
||||
var y = this.y;
|
||||
|
||||
var x_fac = this.x_fac;
|
||||
var y_fac = this.y_fac;
|
||||
|
||||
ctx.clearRect(0, 0, w, h);
|
||||
|
||||
ctx.translate(w/2, h/2);
|
||||
ctx.rotate(this.options.course*Math.PI/180);
|
||||
ctx.translate(-w/2, -h/2);
|
||||
|
||||
//ctx.fillRect(0,0,w,h);
|
||||
|
||||
// draw boat
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, y);
|
||||
ctx.bezierCurveTo(x, y+(80*y_fac), x+(100*x_fac), y+(80*y_fac), x+(100*x_fac), y);
|
||||
ctx.quadraticCurveTo(x+(100*x_fac), y-(100*y_fac), x+(50*x_fac), y-(200*y_fac));
|
||||
ctx.quadraticCurveTo(x, y-(100*y_fac), x, y);
|
||||
ctx.fillStyle = this.options.color;
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
ctx.closePath();
|
||||
|
||||
},
|
||||
|
||||
setHeading: function(heading) {
|
||||
this.options.course = (heading % 360) - this.lastHeading;
|
||||
this.lastHeading = heading % 360;
|
||||
|
||||
var s = this.options.iconSize;
|
||||
this.draw(this.ctx, s.x, s.y);
|
||||
}
|
||||
});
|
||||
|
||||
L.BoatMarker = L.Marker.extend({
|
||||
setHeading: function(heading) {
|
||||
this.options.icon.setHeading(heading);
|
||||
}
|
||||
});
|
||||
|
||||
L.boatMarker = function(pos, options) {
|
||||
var c = ("color" in options) ? options.color : "#f1c40f";
|
||||
options.icon = new L.BoatIcon({ color: c});
|
||||
return new L.BoatMarker(pos, options);
|
||||
};
|
||||
L.BoatIcon=L.Icon.extend({options:{iconSize:new L.Point(150,150),className:"leaflet-boat-icon",course:0,speed:0,color:"#8ED6FF",labelAnchor:[23,0],wind:!1,windDirection:0,windSpeed:0,idleCircle:!1},x:66,y:85,x_fac:.18,y_fac:.18,ctx:null,lastHeading:0,lastWindDirection:0,createIcon:function(){var a=document.createElement("canvas");this._setIconStyles(a,"icon");var b=this.options.iconSize;return a.width=b.x,a.height=b.y,this.lastHeading=0,this.ctx=a.getContext("2d"),this.draw(this.ctx,b.x,b.y),a},draw:function(a,b,c){if(a){var d=this.x,e=this.y,f=this.x_fac,g=this.y_fac;if(a.clearRect(0,0,b,c),a.translate(b/2,c/2),a.rotate(this.options.course*Math.PI/180),a.translate(-b/2,-c/2),a.beginPath(),this.options.idleCircle===!0&&0===this.options.speed?a.arc(d+50*f,e-50*g,50*f,0,2*Math.PI):(a.moveTo(d,e),a.bezierCurveTo(d,e+80*g,d+100*f,e+80*g,d+100*f,e),a.quadraticCurveTo(d+100*f,e-100*g,d+50*f,e-200*g),a.quadraticCurveTo(d,e-100*g,d,e)),a.fillStyle=this.options.color,a.fill(),a.stroke(),a.closePath(),1==this.options.wind){a.translate(b/2,c/2),a.rotate(this.options.windDirection*Math.PI/180),a.translate(-b/2,-c/2),a.beginPath(),a.moveTo(b/2,e-45),a.lineTo(b/2,e-70);for(var h=b/2,i=5*Math.round(this.options.windSpeed/5),j=Math.floor(i/10),k=i%10>0,l=70,m=0;m<j;m++)a.moveTo(h,e-l),a.lineTo(h+8,e-l-8),l-=5;k&&(0==j&&(l-=5),a.moveTo(h,e-l),a.lineTo(h+5,e-l-5)),a.stroke()}}},setHeadingWind:function(a,b,c){this.options.wind=!0,this.options.course=a%360-this.lastHeading,this.lastHeading=a%360,this.options.windDirection=c%360-a%360,this.lastHeading+=this.options.windDirection,this.options.windSpeed=b;var d=this.options.iconSize;this.draw(this.ctx,d.x,d.y)},setHeading:function(a){this.options.course=a%360-this.lastHeading,this.lastHeading=a%360;var b=this.options.iconSize;this.draw(this.ctx,b.x,b.y)},setSpeed:function(a){this.options.speed=a;var b=this.options.iconSize;this.draw(this.ctx,b.x,b.y)}}),L.BoatMarker=L.Marker.extend({setHeadingWind:function(a,b,c){this.options.icon.setHeadingWind(a,b,c)},setHeading:function(a){this.options.icon.setHeading(a)},setSpeed:function(a){this.options.icon.setSpeed(a)}}),L.boatMarker=function(a,b){var c="color"in b?b.color:"#f1c40f",d="idleCircle"in b&&b.idleCircle;return b.icon=new L.BoatIcon({color:c,idleCircle:d}),new L.BoatMarker(a,b)};
|
||||
|
@ -1,16 +1,12 @@
|
||||
/* required styles */
|
||||
|
||||
.leaflet-map-pane,
|
||||
.leaflet-pane,
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-tile-pane,
|
||||
.leaflet-tile-container,
|
||||
.leaflet-overlay-pane,
|
||||
.leaflet-shadow-pane,
|
||||
.leaflet-marker-pane,
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-overlay-pane svg,
|
||||
.leaflet-pane > svg,
|
||||
.leaflet-pane > canvas,
|
||||
.leaflet-zoom-box,
|
||||
.leaflet-image-layer,
|
||||
.leaflet-layer {
|
||||
@ -20,8 +16,6 @@
|
||||
}
|
||||
.leaflet-container {
|
||||
overflow: hidden;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
}
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
@ -31,17 +25,51 @@
|
||||
user-select: none;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
|
||||
.leaflet-safari .leaflet-tile {
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
}
|
||||
/* hack that prevents hw layers "stretching" when loading new tiles */
|
||||
.leaflet-safari .leaflet-tile-container {
|
||||
width: 1600px;
|
||||
height: 1600px;
|
||||
-webkit-transform-origin: 0 0;
|
||||
}
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
display: block;
|
||||
}
|
||||
/* map is broken in FF if you have max-width: 100% on tiles */
|
||||
.leaflet-container img {
|
||||
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
|
||||
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
|
||||
.leaflet-container .leaflet-overlay-pane svg,
|
||||
.leaflet-container .leaflet-marker-pane img,
|
||||
.leaflet-container .leaflet-shadow-pane img,
|
||||
.leaflet-container .leaflet-tile-pane img,
|
||||
.leaflet-container img.leaflet-image-layer,
|
||||
.leaflet-container .leaflet-tile {
|
||||
max-width: none !important;
|
||||
max-height: none !important;
|
||||
}
|
||||
/* stupid Android 2 doesn't understand "max-width: none" properly */
|
||||
.leaflet-container img.leaflet-image-layer {
|
||||
max-width: 15000px !important;
|
||||
|
||||
.leaflet-container.leaflet-touch-zoom {
|
||||
-ms-touch-action: pan-x pan-y;
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
.leaflet-container.leaflet-touch-drag {
|
||||
-ms-touch-action: pinch-zoom;
|
||||
/* Fallback for FF which doesn't support pinch-zoom */
|
||||
touch-action: none;
|
||||
touch-action: pinch-zoom;
|
||||
}
|
||||
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
}
|
||||
.leaflet-container {
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.leaflet-container a {
|
||||
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
|
||||
}
|
||||
.leaflet-tile {
|
||||
filter: inherit;
|
||||
@ -53,18 +81,26 @@
|
||||
.leaflet-zoom-box {
|
||||
width: 0;
|
||||
height: 0;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
z-index: 800;
|
||||
}
|
||||
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
|
||||
.leaflet-overlay-pane svg {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
.leaflet-tile-pane { z-index: 2; }
|
||||
.leaflet-objects-pane { z-index: 3; }
|
||||
.leaflet-overlay-pane { z-index: 4; }
|
||||
.leaflet-shadow-pane { z-index: 5; }
|
||||
.leaflet-marker-pane { z-index: 6; }
|
||||
.leaflet-popup-pane { z-index: 7; }
|
||||
.leaflet-pane { z-index: 400; }
|
||||
|
||||
.leaflet-tile-pane { z-index: 200; }
|
||||
.leaflet-overlay-pane { z-index: 400; }
|
||||
.leaflet-shadow-pane { z-index: 500; }
|
||||
.leaflet-marker-pane { z-index: 600; }
|
||||
.leaflet-tooltip-pane { z-index: 650; }
|
||||
.leaflet-popup-pane { z-index: 700; }
|
||||
|
||||
.leaflet-map-pane canvas { z-index: 100; }
|
||||
.leaflet-map-pane svg { z-index: 200; }
|
||||
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
@ -81,7 +117,8 @@
|
||||
|
||||
.leaflet-control {
|
||||
position: relative;
|
||||
z-index: 7;
|
||||
z-index: 800;
|
||||
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-top,
|
||||
@ -125,31 +162,35 @@
|
||||
|
||||
/* zoom and fade animations */
|
||||
|
||||
.leaflet-fade-anim .leaflet-tile,
|
||||
.leaflet-fade-anim .leaflet-tile {
|
||||
will-change: opacity;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-popup {
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
-o-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-tile-loaded,
|
||||
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.leaflet-zoom-animated {
|
||||
-webkit-transform-origin: 0 0;
|
||||
-ms-transform-origin: 0 0;
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
.leaflet-zoom-anim .leaflet-zoom-animated {
|
||||
will-change: transform;
|
||||
}
|
||||
.leaflet-zoom-anim .leaflet-zoom-animated {
|
||||
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
-o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
}
|
||||
.leaflet-zoom-anim .leaflet-tile,
|
||||
.leaflet-pan-anim .leaflet-tile,
|
||||
.leaflet-touching .leaflet-zoom-animated {
|
||||
.leaflet-pan-anim .leaflet-tile {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
@ -160,24 +201,46 @@
|
||||
|
||||
/* cursors */
|
||||
|
||||
.leaflet-clickable {
|
||||
.leaflet-interactive {
|
||||
cursor: pointer;
|
||||
}
|
||||
.leaflet-container {
|
||||
.leaflet-grab {
|
||||
cursor: -webkit-grab;
|
||||
cursor: -moz-grab;
|
||||
cursor: grab;
|
||||
}
|
||||
.leaflet-crosshair,
|
||||
.leaflet-crosshair .leaflet-interactive {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-control {
|
||||
cursor: auto;
|
||||
}
|
||||
.leaflet-dragging .leaflet-container,
|
||||
.leaflet-dragging .leaflet-clickable {
|
||||
.leaflet-dragging .leaflet-grab,
|
||||
.leaflet-dragging .leaflet-grab .leaflet-interactive,
|
||||
.leaflet-dragging .leaflet-marker-draggable {
|
||||
cursor: move;
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* marker & overlays interactivity */
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-image-layer,
|
||||
.leaflet-pane > svg path,
|
||||
.leaflet-tile-container {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.leaflet-marker-icon.leaflet-interactive,
|
||||
.leaflet-image-layer.leaflet-interactive,
|
||||
.leaflet-pane > svg path.leaflet-interactive {
|
||||
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* visual tweaks */
|
||||
|
||||
@ -250,7 +313,14 @@
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-bar a:first-child {
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
}
|
||||
.leaflet-touch .leaflet-bar a:last-child {
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
/* zoom control */
|
||||
|
||||
@ -259,16 +329,10 @@
|
||||
font: bold 18px 'Lucida Console', Monaco, monospace;
|
||||
text-indent: 1px;
|
||||
}
|
||||
.leaflet-control-zoom-out {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-zoom-in {
|
||||
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
|
||||
font-size: 22px;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-zoom-out {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
|
||||
/* layers control */
|
||||
@ -304,6 +368,11 @@
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
.leaflet-control-layers-scrollbar {
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
padding-right: 5px;
|
||||
}
|
||||
.leaflet-control-layers-selector {
|
||||
margin-top: 2px;
|
||||
position: relative;
|
||||
@ -318,6 +387,11 @@
|
||||
margin: 5px -10px 5px -6px;
|
||||
}
|
||||
|
||||
/* Default icon URLs */
|
||||
.leaflet-default-icon-path {
|
||||
background-image: url(images/marker-icon.png);
|
||||
}
|
||||
|
||||
|
||||
/* attribution and scale controls */
|
||||
|
||||
@ -355,8 +429,8 @@
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
|
||||
background: #fff;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
@ -387,47 +461,53 @@
|
||||
.leaflet-popup {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
border-radius: 6px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
margin: 5px 8px;
|
||||
margin: 13px 19px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.leaflet-popup-content p {
|
||||
/* margin: 18px 0; */
|
||||
margin: 18px 0;
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
margin: 0 auto;
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-left: -20px;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.leaflet-popup-tip {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
padding: 1px;
|
||||
|
||||
margin: -10px auto 0;
|
||||
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
-o-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.leaflet-popup-content-wrapper,
|
||||
.leaflet-popup-tip {
|
||||
background: white;
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.4);
|
||||
color: #333;
|
||||
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 4px 4px 0 0;
|
||||
border: none;
|
||||
text-align: center;
|
||||
width: 18px;
|
||||
height: 14px;
|
||||
@ -474,3 +554,82 @@
|
||||
background: #fff;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
|
||||
/* Tooltip */
|
||||
/* Base styles for the element that has a tooltip */
|
||||
.leaflet-tooltip {
|
||||
position: absolute;
|
||||
padding: 6px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 3px;
|
||||
color: #222;
|
||||
white-space: nowrap;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
|
||||
}
|
||||
.leaflet-tooltip.leaflet-clickable {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-tooltip-top:before,
|
||||
.leaflet-tooltip-bottom:before,
|
||||
.leaflet-tooltip-left:before,
|
||||
.leaflet-tooltip-right:before {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border: 6px solid transparent;
|
||||
background: transparent;
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Directions */
|
||||
|
||||
.leaflet-tooltip-bottom {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.leaflet-tooltip-top {
|
||||
margin-top: -6px;
|
||||
}
|
||||
.leaflet-tooltip-bottom:before,
|
||||
.leaflet-tooltip-top:before {
|
||||
left: 50%;
|
||||
margin-left: -6px;
|
||||
}
|
||||
.leaflet-tooltip-top:before {
|
||||
bottom: 0;
|
||||
margin-bottom: -12px;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-bottom:before {
|
||||
top: 0;
|
||||
margin-top: -12px;
|
||||
margin-left: -6px;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-left {
|
||||
margin-left: -6px;
|
||||
}
|
||||
.leaflet-tooltip-right {
|
||||
margin-left: 6px;
|
||||
}
|
||||
.leaflet-tooltip-left:before,
|
||||
.leaflet-tooltip-right:before {
|
||||
top: 50%;
|
||||
margin-top: -6px;
|
||||
}
|
||||
.leaflet-tooltip-left:before {
|
||||
right: 0;
|
||||
margin-right: -12px;
|
||||
border-left-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-right:before {
|
||||
left: 0;
|
||||
margin-left: -12px;
|
||||
border-right-color: #fff;
|
||||
}
|
||||
|
1
worldmap/leaflet/leaflet.js.map
Normal file
@ -1,53 +0,0 @@
|
||||
.leaflet-label {
|
||||
background: rgba(250, 250, 250, 0.9);
|
||||
background-clip: padding-box;
|
||||
border-color: #888;
|
||||
border-color: rgba(0,0,0,0.25);
|
||||
border-radius: 3px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
color: #111;
|
||||
display: block;
|
||||
font: 12px/20px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
font-weight: 500;
|
||||
padding: 1px 6px;
|
||||
position: absolute;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
.leaflet-label.leaflet-clickable {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.leaflet-label:before,
|
||||
.leaflet-label:after {
|
||||
border-top: 6px solid transparent;
|
||||
border-bottom: 6px solid transparent;
|
||||
content: none;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.leaflet-label:before {
|
||||
border-right: 6px solid black;
|
||||
border-right-color: inherit;
|
||||
left: -10px;
|
||||
}
|
||||
|
||||
.leaflet-label:after {
|
||||
border-left: 6px solid black;
|
||||
border-left-color: inherit;
|
||||
right: -10px;
|
||||
}
|
||||
|
||||
.leaflet-label-right:before,
|
||||
.leaflet-label-left:after {
|
||||
content: "";
|
||||
}
|
@ -1,139 +1 @@
|
||||
L.Polyline.Measure = L.Draw.Polyline.extend({
|
||||
addHooks: function() {
|
||||
L.Draw.Polyline.prototype.addHooks.call(this);
|
||||
if (this._map) {
|
||||
this._markerGroup = new L.LayerGroup();
|
||||
this._map.addLayer(this._markerGroup);
|
||||
|
||||
this._markers = [];
|
||||
this._map.on('click', this._onClick, this);
|
||||
this._startShape();
|
||||
}
|
||||
},
|
||||
|
||||
removeHooks: function () {
|
||||
L.Draw.Polyline.prototype.removeHooks.call(this);
|
||||
|
||||
this._clearHideErrorTimeout();
|
||||
|
||||
//!\ Still useful when control is disabled before any drawing (refactor needed?)
|
||||
this._map.off('mousemove', this._onMouseMove);
|
||||
this._clearGuides();
|
||||
this._container.style.cursor = '';
|
||||
|
||||
this._removeShape();
|
||||
|
||||
this._map.off('click', this._onClick, this);
|
||||
},
|
||||
|
||||
_startShape: function() {
|
||||
this._drawing = true;
|
||||
this._poly = new L.Polyline([], this.options.shapeOptions);
|
||||
|
||||
this._container.style.cursor = 'crosshair';
|
||||
|
||||
this._updateTooltip();
|
||||
this._map.on('mousemove', this._onMouseMove, this);
|
||||
},
|
||||
|
||||
_finishShape: function () {
|
||||
this._drawing = false;
|
||||
|
||||
this._cleanUpShape();
|
||||
this._clearGuides();
|
||||
|
||||
this._updateTooltip();
|
||||
|
||||
this._map.off('mousemove', this._onMouseMove, this);
|
||||
this._container.style.cursor = '';
|
||||
},
|
||||
|
||||
_removeShape: function() {
|
||||
if (!this._poly)
|
||||
return;
|
||||
this._map.removeLayer(this._poly);
|
||||
delete this._poly;
|
||||
this._markers.splice(0);
|
||||
this._markerGroup.clearLayers();
|
||||
},
|
||||
|
||||
_onClick: function(e) {
|
||||
if (!this._drawing) {
|
||||
this._removeShape();
|
||||
this._startShape();
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
_getTooltipText: function() {
|
||||
var labelText = L.Draw.Polyline.prototype._getTooltipText.call(this);
|
||||
if (!this._drawing) {
|
||||
labelText.text = '';
|
||||
}
|
||||
return labelText;
|
||||
}
|
||||
});
|
||||
|
||||
L.Control.MeasureControl = L.Control.extend({
|
||||
|
||||
statics: {
|
||||
TITLE: 'Measure distances'
|
||||
},
|
||||
options: {
|
||||
position: 'topleft',
|
||||
handler: {}
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
if (this.handler.enabled()) {
|
||||
this.handler.disable.call(this.handler);
|
||||
} else {
|
||||
this.handler.enable.call(this.handler);
|
||||
}
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
var className = 'leaflet-control-draw';
|
||||
|
||||
this._container = L.DomUtil.create('div', 'leaflet-bar');
|
||||
|
||||
this.handler = new L.Polyline.Measure(map, this.options.handler);
|
||||
|
||||
this.handler.on('enabled', function () {
|
||||
L.DomUtil.addClass(this._container, 'enabled');
|
||||
}, this);
|
||||
|
||||
this.handler.on('disabled', function () {
|
||||
L.DomUtil.removeClass(this._container, 'enabled');
|
||||
}, this);
|
||||
|
||||
var link = L.DomUtil.create('a', className+'-measure', this._container);
|
||||
link.href = '#';
|
||||
link.title = L.Control.MeasureControl.TITLE;
|
||||
|
||||
L.DomEvent
|
||||
.addListener(link, 'click', L.DomEvent.stopPropagation)
|
||||
.addListener(link, 'click', L.DomEvent.preventDefault)
|
||||
.addListener(link, 'click', this.toggle, this);
|
||||
|
||||
return this._container;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
L.Map.mergeOptions({
|
||||
measureControl: false
|
||||
});
|
||||
|
||||
|
||||
L.Map.addInitHook(function () {
|
||||
if (this.options.measureControl) {
|
||||
this.measureControl = L.Control.measureControl().addTo(this);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
L.Control.measureControl = function (options) {
|
||||
return new L.Control.MeasureControl(options);
|
||||
};
|
||||
|
||||
(function(factory,window){if(typeof define==="function"&&define.amd){define(["leaflet"],function(L){factory(L,window.toGeoJSON)})}else if(typeof exports==="object"){module.exports=function(L){if(L===undefined){if(typeof window!=="undefined"){L=require("leaflet")}}factory(L);return L}}else if(typeof window!=="undefined"&&window.L){factory(window.L)}})(function(L){L.Polyline.Measure=L.Draw.Polyline.extend({addHooks:function(){L.Draw.Polyline.prototype.addHooks.call(this);if(this._map){this._markerGroup=new L.LayerGroup;this._map.addLayer(this._markerGroup);this._markers=[];this._map.on("click",this._onClick,this);this._startShape()}},removeHooks:function(){L.Draw.Polyline.prototype.removeHooks.call(this);this._clearHideErrorTimeout();this._map.off("pointermove",this._onMouseMove,this).off("mousemove",this._onMouseMove,this).off("click",this._onClick,this);this._clearGuides();this._container.style.cursor="";this._removeShape()},_startShape:function(){this._drawing=true;this._poly=new L.Polyline([],this.options.shapeOptions);this._poly._onClick=function(){};this._container.style.cursor="crosshair";this._updateTooltip();this._map.on("pointermove",this._onMouseMove,this).on("mousemove",this._onMouseMove,this)},_finishShape:function(){this._drawing=false;this._cleanUpShape();this._clearGuides();this._updateTooltip();this._map.off("pointermove",this._onMouseMove,this).off("mousemove",this._onMouseMove,this);this._container.style.cursor=""},_removeShape:function(){if(!this._poly)return;this._map.removeLayer(this._poly);delete this._poly;this._markers.splice(0);this._markerGroup.clearLayers()},_onClick:function(){if(!this._drawing){this._removeShape();this._startShape();return}},_getTooltipText:function(){var labelText=L.Draw.Polyline.prototype._getTooltipText.call(this);if(!this._drawing){labelText.text=""}return labelText}});L.Control.MeasureControl=L.Control.extend({statics:{TITLE:"Measure distances"},options:{position:"topleft",handler:{}},toggle:function(){if(this.handler.enabled()){this.handler.disable.call(this.handler)}else{this.handler.enable.call(this.handler)}},onAdd:function(map){var link=null;var className="leaflet-control-draw";this._container=L.DomUtil.create("div","leaflet-bar");this.handler=new L.Polyline.Measure(map,this.options.handler);this.handler.on("enabled",function(){this.enabled=true;L.DomUtil.addClass(this._container,"enabled")},this);this.handler.on("disabled",function(){delete this.enabled;L.DomUtil.removeClass(this._container,"enabled")},this);link=L.DomUtil.create("a",className+"-measure",this._container);link.href="#";link.title=L.Control.MeasureControl.TITLE;L.DomEvent.addListener(link,"click",L.DomEvent.stopPropagation).addListener(link,"click",L.DomEvent.preventDefault).addListener(link,"click",this.toggle,this);return this._container}});L.Map.mergeOptions({measureControl:false});L.Map.addInitHook(function(){if(this.options.measureControl){this.measureControl=L.Control.measureControl().addTo(this)}});L.Control.measureControl=function(options){return new L.Control.MeasureControl(options)}},window);
|
||||
|
@ -1,5 +1,5 @@
|
||||
CACHE MANIFEST
|
||||
# date: Mar 2nd 2019 - v1.5.30
|
||||
# date: Mar 11th 2019 - v2.0.0b
|
||||
|
||||
CACHE:
|
||||
index.html
|
||||
@ -39,8 +39,6 @@ leaflet/leaflet.draw.css
|
||||
leaflet/leaflet.draw.js
|
||||
leaflet/leaflet.fullscreen.css
|
||||
leaflet/leaflet.js
|
||||
leaflet/leaflet.label.css
|
||||
leaflet/leaflet.label.js
|
||||
leaflet/leaflet.markercluster.js
|
||||
leaflet/leaflet.markercluster.freezable-src.js
|
||||
leaflet/leaflet.measurecontrol.css
|
||||
|