1
0
forked from MTSR/mapserver
mapserver/server/static/js/CoordinatesDisplay.js
NatureFreshMilk 542c5653ce js org
2019-01-29 08:57:35 +01:00

31 lines
669 B
JavaScript

var CoordinatesDisplay = (function(){
'use strict';
// coord display
var CoordinatesDisplay = L.Control.extend({
onAdd: function(map) {
var div = L.DomUtil.create('div', 'leaflet-bar leaflet-custom-display');
function update(ev){
var latlng = ev.latlng;
div.innerHTML = "X:" + parseInt(latlng.lng) + " Z:" + parseInt(latlng.lat);
}
map.on('mousemove', update);
map.on('click', update);
map.on('touch', update);
return div;
},
onRemove: function(map) {
}
});
return {
create: function(opts){
return new CoordinatesDisplay(opts);
}
}
}())