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

View File

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

View File

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