add function to check for window width and use that throughout the app for more convenient future use

This commit is contained in:
Robin Scholtes 2023-05-12 17:50:46 +12:00
parent 6a1514db30
commit df781bec00
6 changed files with 11 additions and 8 deletions

View file

@ -50,6 +50,9 @@ class App {
this.breakpoint = 768;
}
isMobileView() {
return window.innerWidth < this.breakpoint;
}
/**
* This function sets up the stage and creates listeners for all events.
@ -297,7 +300,7 @@ class App {
* @param {boolean} [minimise=false] - Set this flag if attempting to minimise frames to 0 width
*/
initialiseUI() {
if (window.innerWidth < this.breakpoint) {
if (this.isMobileView()) {
this.setMobileUI();
} else {
this.setDesktopUI(false);