Info Texte über json Datei zentral gespeichert und nicht mehr hartgecodet

This commit is contained in:
2026-06-10 21:52:23 +02:00
parent d90aea0979
commit e26ebc2bf0
2 changed files with 33 additions and 17 deletions
+16 -17
View File
@@ -462,23 +462,19 @@ map.once('load', () => {
loadPointCloud(getPointCloudFiles()[selectBox.value]);
}
const pointCloudInfo = {
first: {
title: "1. Fläche unten",
text: "Dies ist die 1. Fläche (unten). Hier können Sie Informationen zur Scanfläche, dem Aufnahmedatum oder besonderen Merkmalen des Obernkirchener Sandsteins eintragen.",
images: ["stand1_1.jpeg", "stand1_2.jpeg"]
},
second: {
title: "2. Felswand",
text: "Dies ist die 2. Felswand. Hier können Sie Informationen zur Scanfläche, dem Aufnahmedatum oder besonderen Merkmalen des Obernkirchener Sandsteins eintragen.",
images: ["stand2_1.jpeg"]
},
third: {
title: "3. Fläche oben mit Spuren",
text: "Dies ist die 3. Fläche (oben) mit Spuren. Hier können Sie Informationen zur Scanfläche, dem Aufnahmedatum oder besonderen Merkmalen des Obernkirchener Sandsteins eintragen.",
images: ["stand3_1.jpeg", "stand3_2.jpeg"]
},
};
// Informationen über die Punktwolken zentral in einer JSON-Datei
const pointCloudInfoFile = "info.json";
let pointCloudInfo = {};
// die JSON-Datei laden
fetch(pointCloudInfoFile)
.then(response => response.json())
.then(data => {
pointCloudInfo = data;
})
.catch(error => console.error("Fehler beim Laden der JSON:", error));
const infoPanel = document.getElementById("info-panel");
const infoPanelTitle = document.getElementById("info-panel-title");
@@ -490,8 +486,11 @@ let currentImageIndex = 0;
function updateInfoPanel() {
const key = document.querySelector('select[name="pointcloud"]').value;
const info = pointCloudInfo[key];
currentImageIndex = 0;
if (info) {
infoPanelTitle.textContent = info.title;
infoPanelText.textContent = info.text;