Map is displayed and interactive
This commit is contained in:
3 files changed
+109
-65
No files matched your search
+29
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user