1
0
Fork 0
forked from Simnation/Main

Update script.js

This commit is contained in:
Nordi98 2025-08-03 18:43:13 +02:00
parent b8a89fb177
commit 0abf56db79

View file

@ -1041,32 +1041,50 @@ function ejectDeck(deck) {
showNotification(`Deck ${deck} ejected`, 'info'); showNotification(`Deck ${deck} ejected`, 'info');
} }
// Interface Control Functions // Initialisiere Interface-Einstellungen
function initializeInterfaceSettings() { function initializeInterfaceSettings() {
console.log('Initializing interface settings');
// Setze Standardwerte
interfacePosition = {
x: (window.innerWidth - 1000) / 2,
y: (window.innerHeight - 700) / 2
};
interfaceSize = { width: 1000, height: 700 };
// Versuche gespeicherte Einstellungen zu laden // Versuche gespeicherte Einstellungen zu laden
const savedPosition = localStorage.getItem('djInterfacePosition'); try {
const savedSize = localStorage.getItem('djInterfaceSize'); const savedPosition = localStorage.getItem('djInterfacePosition');
const savedSize = localStorage.getItem('djInterfaceSize');
if (savedPosition) {
try { if (savedPosition) {
interfacePosition = JSON.parse(savedPosition); const parsedPosition = JSON.parse(savedPosition);
} catch (e) { // Prüfe ob die Position gültig ist
console.error('DJ System: Error parsing saved position', e); if (parsedPosition && typeof parsedPosition.x === 'number' && typeof parsedPosition.y === 'number') {
interfacePosition = parsedPosition;
}
} }
}
if (savedSize) {
if (savedSize) { const parsedSize = JSON.parse(savedSize);
try { // Prüfe ob die Größe gültig ist
interfaceSize = JSON.parse(savedSize); if (parsedSize && typeof parsedSize.width === 'number' && typeof parsedSize.height === 'number') {
} catch (e) { interfaceSize = parsedSize;
console.error('DJ System: Error parsing saved size', e); }
} }
} catch (e) {
console.error('DJ System: Error loading saved settings', e);
// Lösche ungültige Einstellungen
localStorage.removeItem('djInterfacePosition');
localStorage.removeItem('djInterfaceSize');
} }
// Wende Einstellungen an // Wende Einstellungen an
applyInterfaceSettings(); applyInterfaceSettings();
} }
function applyInterfaceSettings() { function applyInterfaceSettings() {
const djInterface = document.getElementById('dj-interface'); const djInterface = document.getElementById('dj-interface');
if (!djInterface) return; if (!djInterface) return;