fix searchbox not hiding if weatherscreen is opened, code clenaup

This commit is contained in:
Gerome Matilla 2020-06-09 15:55:50 +08:00
parent 5fae8e1656
commit 17b685c3ae
3 changed files with 8 additions and 9 deletions

View File

@ -4,7 +4,7 @@ class Dashboard {
this._dashboard = document.querySelector('#rightDashboard');
this._dashboardOverlay = document.querySelector('#dashboardOverlay');
this.rightDashboardVisibility = false;
this._rightDashboardVisibility = false;
this._dashboardOverlayMouseUpEvent = this._dashboardOverlayMouseUpEvent.bind(this);
@ -26,7 +26,7 @@ class Dashboard {
}
getRightDashboardVisibility = () => {
return this.rightDashboardVisibility;
return this._rightDashboardVisibility;
}
showDashboard = () => {
@ -38,7 +38,7 @@ class Dashboard {
// Enable Inputs
this._disableDashboardInputs(false);
this.rightDashboardVisibility = !this.rightDashboardVisibility;
this._rightDashboardVisibility = !this._rightDashboardVisibility;
}
hideDashboard = () => {
@ -51,14 +51,14 @@ class Dashboard {
// Hide overlay
this._dashboardOverlay.classList.remove('showDashboardOverlay');
this.rightDashboardVisibility = !this.rightDashboardVisibility;
this._rightDashboardVisibility = !this._rightDashboardVisibility;
}
toggleDashboard = () => {
console.log('toggle dashboard');
if (this.rightDashboardVisibility) {
if (this._rightDashboardVisibility) {
// Hide dashboard
this.hideDashboard();
@ -101,7 +101,7 @@ class Dashboard {
}
_dashboardOverlayMouseUpEvent = e => {
if (this.rightDashboardVisibility) {
if (this._rightDashboardVisibility) {
this.toggleDashboard();
}
console.log('dashboard overlay clicked...');

View File

@ -28,7 +28,7 @@ class SwipeEventCallbacks extends SwipeEventManager {
_rightDashboardSwipeEvent = (el, d) => {
// Swipe right will close dashboard
if (d === "right") {
if (d === 'right') {
dashboard.toggleDashboard();
}
}

View File

@ -273,12 +273,11 @@ class WeatherScreen {
} else if (this._searchBoxContainer.classList.contains('showSearchBox')) {
console.log('searchbox is open, closing...');
hideSearchBox();
searchBoxShow.hideSearchBox();
} else if (this._dashboard.classList.contains('showRightDashboard')) {
console.log('dashboard is open, closing...');
dashboard.hideDashboard();
// return;
}
// Toggle center box