mapserver/server/static/js/CoordinatesDisplay.js

23 lines
542 B
JavaScript
Raw Normal View History

2019-02-01 14:58:26 +03:00
'use strict';
2019-01-29 10:36:46 +03:00
2019-02-01 14:58:26 +03:00
// 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);
}
2019-01-29 10:36:46 +03:00
2019-02-07 10:05:05 +03:00
//TODO: x: 1 z: 2 (selected: x:1 z:3)
2019-02-01 14:58:26 +03:00
map.on('mousemove', update);
map.on('click', update);
map.on('touch', update);
2019-01-29 10:36:46 +03:00
2019-02-01 14:58:26 +03:00
return div;
},
2019-01-29 10:36:46 +03:00
2019-02-01 14:58:26 +03:00
onRemove: function(map) {
2019-01-29 10:57:35 +03:00
}
2019-02-01 14:58:26 +03:00
});