2020-06-09 04:02:03 +02:00
|
|
|
class SwipeEventCallbacks extends SwipeEventManager {
|
2020-06-09 12:13:12 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.swipeEvent = this.swipeEvent;
|
|
|
|
|
|
|
|
this._createSwipeEvents();
|
2020-06-04 06:59:50 +02:00
|
|
|
}
|
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
// Backgound body swipe callback
|
|
|
|
_bodyBackgroundSwipeEvent = (el, d) => {
|
2020-06-04 06:59:50 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
// Swipe left will open dashboard
|
|
|
|
if (d === 'left') {
|
|
|
|
dashboard.toggleDashboard();
|
|
|
|
} else if (d === 'down') {
|
|
|
|
// Swiping down will open search box
|
|
|
|
searchBoxShow.toggleSearchBox();
|
2020-06-09 06:26:02 +02:00
|
|
|
} else if (d === 'right') {
|
2020-06-09 04:02:03 +02:00
|
|
|
// Swiping right will open web menu
|
|
|
|
webMenu.toggleWebMenu();
|
2020-06-09 06:26:02 +02:00
|
|
|
} else if (d === 'up') {
|
2020-06-09 04:02:03 +02:00
|
|
|
// Swiping up will open weather screen
|
|
|
|
weatherScreen.toggleWeatherScreen();
|
|
|
|
}
|
2020-06-04 06:59:50 +02:00
|
|
|
}
|
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
// Dashboard swipe callback
|
|
|
|
_rightDashboardSwipeEvent = (el, d) => {
|
2020-06-04 06:59:50 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
// Swipe right will close dashboard
|
2020-06-09 09:55:50 +02:00
|
|
|
if (d === 'right') {
|
2020-06-09 04:02:03 +02:00
|
|
|
dashboard.toggleDashboard();
|
|
|
|
}
|
2020-06-04 06:59:50 +02:00
|
|
|
}
|
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
// Blur overlay swipe event
|
|
|
|
_centeredBoxOverlaySwipeEvent = (el, d) => {
|
2020-06-04 06:59:50 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
// Swiping up will close search box
|
|
|
|
if (d === 'up') {
|
|
|
|
searchBoxShow.toggleSearchBox();
|
|
|
|
}
|
2020-06-04 06:59:50 +02:00
|
|
|
}
|
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
// Web menu swipe event
|
|
|
|
_webMenuSwipeEvent = (el, d) => {
|
|
|
|
|
|
|
|
// Swiping left will close web menu
|
2020-06-09 06:26:02 +02:00
|
|
|
if (d === 'left') {
|
2020-06-09 04:02:03 +02:00
|
|
|
webMenu.toggleWebMenu();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Weather screen swipe event
|
|
|
|
_weatherScreenSwipeEvent = (el, d) => {
|
|
|
|
|
|
|
|
// Swiping left will the weather screem
|
2020-06-09 06:26:02 +02:00
|
|
|
if (d === 'left') {
|
2020-06-09 04:02:03 +02:00
|
|
|
weatherScreen.toggleWeatherScreen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assign swipe callback for each IDs
|
|
|
|
_createSwipeEvents = () => {
|
|
|
|
this.swipeEvent('bodyBackground', this._bodyBackgroundSwipeEvent);
|
|
|
|
|
|
|
|
this.swipeEvent('rightDashboard', this._rightDashboardSwipeEvent);
|
|
|
|
|
|
|
|
this.swipeEvent('centeredBoxOverlay', this._centeredBoxOverlaySwipeEvent);
|
|
|
|
|
|
|
|
this.swipeEvent('webMenu', this._webMenuSwipeEvent);
|
2020-06-04 06:59:50 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
this.swipeEvent('weatherScreen', this._weatherScreenSwipeEvent);
|
2020-06-04 06:59:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|