fix my main fucking problem, the hiding/showing of screens

This commit is contained in:
Gerome Matilla 2020-06-04 14:55:08 +08:00
parent c041a059ac
commit fdd1f0296f
3 changed files with 54 additions and 7 deletions

View File

@ -24,16 +24,41 @@ const hideDashboard = () => {
const toggleDashboard = () => {
console.log('toggle dashboard');
if (rightDashboardVisibility) {
// Hide dashboard
hideDashboard();
} else {
// Show dashboard
showDashboard();
// If centered box is hidden, open it
if (centeredBox.classList.contains('hiddenBox')) {
console.log('centered box is hidden, reopening...');
// Rotate profile container
rotateProfile();
// Toggle center box
toggleCenteredBox();
}
}
console.log('toggle dashboard');
// Check if any of these are open, if yes, close it
if (weatherScreen.classList.contains('showWeatherScreen')) {
console.log('weather screen is open, closing...');
hideWeatherScreen();
return
} else if (webMenu.classList.contains('showWebMenu')) {
console.log('web menu is open, closing...');
hideWebMenu();
return;
}
}
dashboardOverlay.addEventListener(

View File

@ -239,6 +239,8 @@ const hideWeatherScreen = () => {
const toggleWeatherScreen = () => {
console.log('toggle weather screen');
// If profile anim is still running,
// Return to avoid spam
if (profileAnimRunning) return;
@ -255,8 +257,17 @@ const toggleWeatherScreen = () => {
showWeatherScreen();
}
// Check if any of these are open, if yes, close it
if (webMenu.classList.contains('showWebMenu')) {
console.log('web menu is open, closing...');
hideWebMenu();
return;
} else if (dashboard.classList.contains('showRightDashboard')) {
console.log('dashboard is open, closing...');
hideDashboard();
return;
}
// Toggle center box
toggleCenteredBox();
console.log('toggle weather screen');
}

View File

@ -200,6 +200,8 @@ const hideWebMenu = () => {
const toggleWebMenu = () => {
console.log('toggle web menu');
// If profile anim is still running,
// Return to avoid spam
if (profileAnimRunning) return;
@ -216,10 +218,19 @@ const toggleWebMenu = () => {
showWebMenu();
}
// Check if any of these are open, if yes, close it
if (weatherScreen.classList.contains('showWeatherScreen')) {
console.log('weather screen is open, closing...');
hideWeatherScreen();
return
} else if (dashboard.classList.contains('showRightDashboard')) {
console.log('dashboard is open, closing...');
hideDashboard();
return;
}
// Toggle center box
toggleCenteredBox();
console.log('toggle web menu');
toggleCenteredBox();
}
// Remove class to focused item