chore: Änderungen commited
This commit is contained in:
@@ -182,6 +182,117 @@ async function loadMindmapData(nodeId = null) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementiert Zoomfunktionalität für die Mindmap
|
||||
* @param {Object} cy - Cytoscape-Instanz
|
||||
*/
|
||||
function implementZoomFunctions(cy) {
|
||||
if (!cy) {
|
||||
console.error('Cytoscape-Instanz nicht gefunden!');
|
||||
return;
|
||||
}
|
||||
|
||||
// Vergrößern-Button
|
||||
const zoomInButton = document.getElementById('zoomIn');
|
||||
if (zoomInButton) {
|
||||
zoomInButton.addEventListener('click', function() {
|
||||
cy.zoom(cy.zoom() * 1.2);
|
||||
cy.center();
|
||||
showUINotification('Ansicht vergrößert', 'info', 1500);
|
||||
});
|
||||
}
|
||||
|
||||
// Verkleinern-Button
|
||||
const zoomOutButton = document.getElementById('zoomOut');
|
||||
if (zoomOutButton) {
|
||||
zoomOutButton.addEventListener('click', function() {
|
||||
cy.zoom(cy.zoom() * 0.8);
|
||||
cy.center();
|
||||
showUINotification('Ansicht verkleinert', 'info', 1500);
|
||||
});
|
||||
}
|
||||
|
||||
// Zurücksetzen-Button
|
||||
const resetViewButton = document.getElementById('resetView');
|
||||
if (resetViewButton) {
|
||||
resetViewButton.addEventListener('click', function() {
|
||||
cy.fit();
|
||||
cy.center();
|
||||
showUINotification('Ansicht zurückgesetzt', 'info', 1500);
|
||||
});
|
||||
}
|
||||
|
||||
// Legende-Button
|
||||
const toggleLegendButton = document.getElementById('toggleLegend');
|
||||
const categoryLegend = document.getElementById('categoryLegend');
|
||||
|
||||
if (toggleLegendButton && categoryLegend) {
|
||||
toggleLegendButton.addEventListener('click', function() {
|
||||
if (categoryLegend.style.display === 'none') {
|
||||
categoryLegend.style.display = 'flex';
|
||||
showUINotification('Legende angezeigt', 'info', 1500);
|
||||
} else {
|
||||
categoryLegend.style.display = 'none';
|
||||
showUINotification('Legende ausgeblendet', 'info', 1500);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Funktion zum Starten der Mindmap-Anwendung
|
||||
*/
|
||||
async function startMindmapApp() {
|
||||
try {
|
||||
const loader = document.getElementById('loader');
|
||||
const statusMessage = document.getElementById('statusMessage');
|
||||
const cyContainer = document.getElementById('cy');
|
||||
|
||||
if (!cyContainer) {
|
||||
throw new Error('Cytoscape-Container nicht gefunden');
|
||||
}
|
||||
|
||||
// Anzeigen der Ladeanzeige
|
||||
if (loader) loader.style.display = 'block';
|
||||
if (statusMessage) {
|
||||
statusMessage.textContent = 'Lade Mindmap...';
|
||||
statusMessage.style.display = 'block';
|
||||
}
|
||||
|
||||
// Initialisieren der Mindmap
|
||||
const cy = await initializeMindmap();
|
||||
window.cy = cy; // Speichern für globalen Zugriff
|
||||
|
||||
// Zoom-Funktionen und Legendensteuerung implementieren
|
||||
implementZoomFunctions(cy);
|
||||
|
||||
// Verstecken der Ladeanzeige
|
||||
if (loader) loader.style.display = 'none';
|
||||
if (statusMessage) statusMessage.style.display = 'none';
|
||||
|
||||
return cy;
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Starten der Mindmap-Anwendung:', error);
|
||||
const statusMessage = document.getElementById('statusMessage');
|
||||
|
||||
if (statusMessage) {
|
||||
statusMessage.textContent = 'Fehler beim Laden der Mindmap: ' + error.message;
|
||||
statusMessage.style.display = 'block';
|
||||
}
|
||||
|
||||
const loader = document.getElementById('loader');
|
||||
if (loader) loader.style.display = 'none';
|
||||
|
||||
showUINotification('Fehler beim Laden der Mindmap: ' + error.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// Eventlistener für DOM-Ready
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('DOM vollständig geladen, starte Mindmap-Anwendung');
|
||||
startMindmapApp();
|
||||
});
|
||||
|
||||
// Funktion zum Initialisieren der Mindmap
|
||||
async function initializeMindmap() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user