Додана сторінка "історія служіння"

This commit is contained in:
2025-09-20 20:02:46 +03:00
parent ff393417a1
commit d75fb7ec3d
23 changed files with 3065 additions and 1078 deletions

View File

@@ -799,22 +799,37 @@ const Constructor = {
delete(house) {
// убрать слой с карты
if (Constructor.info.type === 'house') {
if (Editor.info.type === 'house') {
houseGroup.removeLayer(house);
} else if (Constructor.info.type === 'homestead') {
} else if (Editor.info.type === 'homestead') {
homesteadGroup.removeLayer(house);
}
// найти индекс полигона в points
const index = Constructor.info.points.findIndex(p => p === house.getLatLngs());
const target = house.getLatLngs()[0]; // вершины полигона
if (index !== -1) {
// удалить из points и points_number по индексу
Constructor.info.points.splice(index, 1);
Constructor.info.points_number.splice(index, 1);
const index = Editor.info.points.findIndex((p) => {
const copy = p.slice(); // делаем копию
copy[0].pop(); // убираем последний элемент
if (isSamePolygon(p, target)) return true; // проверка как есть
if (isSamePolygon(copy, target)) return true; // проверка без последнего
return false;
});
function isSamePolygon(a, b) {
if (a.length !== b.length) return false;
return a.every((pt, i) => pt.lat === b[i].lat && pt.lng === b[i].lng);
}
Constructor.osm.autoZoom(Constructor.info.points);
if (index) {
// удалить из points и points_number по индексу
Editor.info.points.splice(index, 1);
Editor.info.points_number.splice(index, 1);
}
Editor.osm.autoZoom(Editor.info.points);
},
async getOSM(wayId) {