56 lines
1.2 KiB
JavaScript
56 lines
1.2 KiB
JavaScript
var podklady = MapovePodklady.vytvor();
|
|
var map = L.map('map', {
|
|
center: [50.853501146, 14.8425], // Hrádek
|
|
zoom: 13,
|
|
layers: [MapovePodklady.vychozi(podklady)]
|
|
});
|
|
|
|
var layerControl = L.control.layers(MapovePodklady.popisky(podklady)).addTo(map);
|
|
MapovePodklady.logo(map, podklady);
|
|
|
|
// futury:
|
|
function onEachFeature(feature, layer) {
|
|
// does this feature have a property named popupContent?
|
|
if (feature.properties && feature.properties.number) {
|
|
layer.bindPopup("Obvod č. "+feature.properties.number.toString());
|
|
}
|
|
layer.on({
|
|
mouseover: highlightFeature,
|
|
mouseout: resetHighlight,
|
|
click: zoomToFeature
|
|
});
|
|
}
|
|
|
|
// futury - interakce:
|
|
function style(feature) {
|
|
return {
|
|
fillColor: '#FD8D3C',
|
|
weight: 2,
|
|
opacity: 1,
|
|
color: 'blue',
|
|
dashArray: '3',
|
|
fillOpacity: 0.05
|
|
};
|
|
}
|
|
|
|
|
|
function highlightFeature(e) {
|
|
var layer = e.target;
|
|
|
|
layer.setStyle({
|
|
weight: 5,
|
|
color: '#666',
|
|
dashArray: '',
|
|
fillOpacity: 0.2
|
|
});
|
|
|
|
layer.bringToFront();
|
|
}
|
|
|
|
function resetHighlight(e) {
|
|
geojson.resetStyle(e.target);
|
|
}
|
|
|
|
function zoomToFeature(e) {
|
|
map.fitBounds(e.target.getBounds());
|
|
}
|