forked from Simnation/Main
Update script.js
This commit is contained in:
parent
b8a89fb177
commit
0abf56db79
1 changed files with 34 additions and 16 deletions
|
@ -1041,32 +1041,50 @@ function ejectDeck(deck) {
|
|||
showNotification(`Deck ${deck} ejected`, 'info');
|
||||
}
|
||||
|
||||
// Interface Control Functions
|
||||
// Initialisiere Interface-Einstellungen
|
||||
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
|
||||
const savedPosition = localStorage.getItem('djInterfacePosition');
|
||||
const savedSize = localStorage.getItem('djInterfaceSize');
|
||||
|
||||
if (savedPosition) {
|
||||
try {
|
||||
interfacePosition = JSON.parse(savedPosition);
|
||||
} catch (e) {
|
||||
console.error('DJ System: Error parsing saved position', e);
|
||||
try {
|
||||
const savedPosition = localStorage.getItem('djInterfacePosition');
|
||||
const savedSize = localStorage.getItem('djInterfaceSize');
|
||||
|
||||
if (savedPosition) {
|
||||
const parsedPosition = JSON.parse(savedPosition);
|
||||
// Prüfe ob die Position gültig ist
|
||||
if (parsedPosition && typeof parsedPosition.x === 'number' && typeof parsedPosition.y === 'number') {
|
||||
interfacePosition = parsedPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (savedSize) {
|
||||
try {
|
||||
interfaceSize = JSON.parse(savedSize);
|
||||
} catch (e) {
|
||||
console.error('DJ System: Error parsing saved size', e);
|
||||
|
||||
if (savedSize) {
|
||||
const parsedSize = JSON.parse(savedSize);
|
||||
// Prüfe ob die Größe gültig ist
|
||||
if (parsedSize && typeof parsedSize.width === 'number' && typeof parsedSize.height === 'number') {
|
||||
interfaceSize = parsedSize;
|
||||
}
|
||||
}
|
||||
} 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
|
||||
applyInterfaceSettings();
|
||||
}
|
||||
|
||||
|
||||
function applyInterfaceSettings() {
|
||||
const djInterface = document.getElementById('dj-interface');
|
||||
if (!djInterface) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue