diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/app.component.ts | 2 | ||||
-rw-r--r-- | client/src/app/core/menu/menu.service.ts | 19 | ||||
-rw-r--r-- | client/src/app/core/wrappers/screen.service.ts | 2 |
3 files changed, 11 insertions, 12 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 5b0439e6b..edec3216e 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -180,7 +180,7 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
180 | 180 | ||
181 | eventsObs.pipe( | 181 | eventsObs.pipe( |
182 | filter((e: Event): e is GuardsCheckStart => e instanceof GuardsCheckStart), | 182 | filter((e: Event): e is GuardsCheckStart => e instanceof GuardsCheckStart), |
183 | filter(() => this.screenService.isInSmallView() || !!this.screenService.isInTouchScreen()) | 183 | filter(() => this.screenService.isInSmallView() || this.screenService.isInTouchScreen()) |
184 | ).subscribe(() => this.menu.setMenuDisplay(false)) // User clicked on a link in the menu, change the page | 184 | ).subscribe(() => this.menu.setMenuDisplay(false)) // User clicked on a link in the menu, change the page |
185 | } | 185 | } |
186 | 186 | ||
diff --git a/client/src/app/core/menu/menu.service.ts b/client/src/app/core/menu/menu.service.ts index 671ee3e4f..9c0433bca 100644 --- a/client/src/app/core/menu/menu.service.ts +++ b/client/src/app/core/menu/menu.service.ts | |||
@@ -28,15 +28,16 @@ export class MenuService { | |||
28 | setMenuDisplay (display: boolean) { | 28 | setMenuDisplay (display: boolean) { |
29 | this.isMenuDisplayed = display | 29 | this.isMenuDisplayed = display |
30 | 30 | ||
31 | if (!this.screenService.isInTouchScreen()) return | ||
32 | |||
31 | // On touch screens, lock body scroll and display content overlay when memu is opened | 33 | // On touch screens, lock body scroll and display content overlay when memu is opened |
32 | if (this.screenService.isInTouchScreen()) { | 34 | if (this.isMenuDisplayed) { |
33 | if (this.isMenuDisplayed) { | 35 | document.body.classList.add('menu-open') |
34 | document.body.classList.add('menu-open') | 36 | this.screenService.onFingerSwipe('left', () => { this.setMenuDisplay(false) }) |
35 | this.screenService.onFingerSwipe('left', () => { this.setMenuDisplay(false) }) | 37 | return |
36 | } else { | ||
37 | document.body.classList.remove('menu-open') | ||
38 | } | ||
39 | } | 38 | } |
39 | |||
40 | document.body.classList.remove('menu-open') | ||
40 | } | 41 | } |
41 | 42 | ||
42 | onResize () { | 43 | onResize () { |
@@ -45,9 +46,7 @@ export class MenuService { | |||
45 | 46 | ||
46 | private handleWindowResize () { | 47 | private handleWindowResize () { |
47 | // On touch screens, do not handle window resize event since opened menu is handled with a content overlay | 48 | // On touch screens, do not handle window resize event since opened menu is handled with a content overlay |
48 | if (this.screenService.isInTouchScreen()) { | 49 | if (this.screenService.isInTouchScreen()) return |
49 | return | ||
50 | } | ||
51 | 50 | ||
52 | fromEvent(window, 'resize') | 51 | fromEvent(window, 'resize') |
53 | .pipe(debounceTime(200)) | 52 | .pipe(debounceTime(200)) |
diff --git a/client/src/app/core/wrappers/screen.service.ts b/client/src/app/core/wrappers/screen.service.ts index 88cf662b3..a085e5bdc 100644 --- a/client/src/app/core/wrappers/screen.service.ts +++ b/client/src/app/core/wrappers/screen.service.ts | |||
@@ -30,7 +30,7 @@ export class ScreenService { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | isInTouchScreen () { | 32 | isInTouchScreen () { |
33 | return 'ontouchstart' in window || navigator.msMaxTouchPoints | 33 | return !!('ontouchstart' in window || navigator.msMaxTouchPoints) |
34 | } | 34 | } |
35 | 35 | ||
36 | getNumberOfAvailableMiniatures () { | 36 | getNumberOfAvailableMiniatures () { |