v7: увеличен зум, навигация через findVillageData
This commit is contained in:
parent
655784582f
commit
a2d748e985
15
js/app.js
15
js/app.js
@ -179,7 +179,7 @@ function initSelectors() {
|
||||
rayonSel.value = found.rayon;
|
||||
updateVillages();
|
||||
villageSel.value = found.village;
|
||||
map.setView(found.center, 13);
|
||||
map.setView(found.center, 15);
|
||||
L.popup()
|
||||
.setLatLng(found.center)
|
||||
.setContent(`<b>${found.village}</b><br>${found.oblast}, ${found.rayon}`)
|
||||
@ -200,15 +200,10 @@ function initSelectors() {
|
||||
villageSel.addEventListener("change", function () {
|
||||
const name = this.value;
|
||||
if (!name) return;
|
||||
const oblast = KZ_DATA.find((o) => o.oblast === oblastSel.value);
|
||||
if (!oblast) return;
|
||||
const rayon = oblast.rayons.find((r) => r.rayon === rayonSel.value);
|
||||
if (!rayon) return;
|
||||
const village = rayon.villages.find((v) => (typeof v === "string" ? v : v.name) === name);
|
||||
const center = getVillageCenter(village) || (rayon ? rayon.center : null) || oblast.center;
|
||||
if (center) {
|
||||
map.setView(center, 14);
|
||||
L.popup().setLatLng(center).setContent(`<b>${name}</b><br>${oblast.oblast}, ${rayon.rayon}`).openOn(map);
|
||||
const found = findVillageData(name);
|
||||
if (found && found.center) {
|
||||
map.setView(found.center, 15);
|
||||
L.popup().setLatLng(found.center).setContent(`<b>${found.village}</b><br>${found.oblast}, ${found.rayon}`).openOn(map);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user