Map is displayed and interactive

This commit is contained in:
Josh-Dev-Quest committed 2026-02-27 07:10:06 +01:00
1 parent 10a5db9d05
commit 99c22987e3
3 files changed
+109 -65

No files matched your search

+29 -2
View File
@@ -9,11 +9,11 @@ document.addEventListener('DOMContentLoaded', function() {
function switchMode(mode) {
if (mode === 'create') {
倉-> modeCreateBtn.classList.add('active');
modeCreateBtn.classList.add('active');
modeViewBtn.classList.remove('active');
createPanel.classList.add('active-panel');
viewPanel.classList.remove('active-panel');
//ҧ Enable marker adding
// Enable marker adding
window.isCreatingJourney = true;
} else { // view mode
modeCreateBtn.classList.remove('active');
@@ -40,6 +40,33 @@ document.addEventListener('DOMContentLoaded', function() {
window.currentJourney.name = title;
window.currentJourney.description = description;
// Add the current journey to the journeys array if not already added
const existingJourneyIndex = window.journeys.findIndex(j => j.id === window.currentJourney.id);
if (existingJourneyIndex === -1) {
window.journeys.push({
id: window.currentJourney.id,
name: window.currentJourney.name,
description: window.currentJourney.description,
markers: window.currentJourney.markers.map(marker => ({
id: marker.id,
lngLat: marker.getLngLat(),
content: marker.content
}))
});
} else {
window.journeys[existingJourneyIndex] = {
...window.journeys[existingJourneyIndex],
name: window.currentJourney.name,
description: window.currentJourney.description,
markers: window.currentJourney.markers.map(marker => ({
id: marker.id,
lngLat: marker.getLngLat(),
content: marker.content
}))
};
}
window.saveJourneyToLocalStorage();
// Show notification