Some code style fixes

This commit is contained in:
Chocobozzz 2020-08-17 10:19:45 +02:00
parent 245b9d27bc
commit 1bfc7b7379
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 12 deletions

View File

@ -180,7 +180,7 @@ export class AppComponent implements OnInit, AfterViewInit {
eventsObs.pipe(
filter((e: Event): e is GuardsCheckStart => e instanceof GuardsCheckStart),
filter(() => this.screenService.isInSmallView() || !!this.screenService.isInTouchScreen())
filter(() => this.screenService.isInSmallView() || this.screenService.isInTouchScreen())
).subscribe(() => this.menu.setMenuDisplay(false)) // User clicked on a link in the menu, change the page
}

View File

@ -28,15 +28,16 @@ export class MenuService {
setMenuDisplay (display: boolean) {
this.isMenuDisplayed = display
if (!this.screenService.isInTouchScreen()) return
// On touch screens, lock body scroll and display content overlay when memu is opened
if (this.screenService.isInTouchScreen()) {
if (this.isMenuDisplayed) {
document.body.classList.add('menu-open')
this.screenService.onFingerSwipe('left', () => { this.setMenuDisplay(false) })
} else {
document.body.classList.remove('menu-open')
}
if (this.isMenuDisplayed) {
document.body.classList.add('menu-open')
this.screenService.onFingerSwipe('left', () => { this.setMenuDisplay(false) })
return
}
document.body.classList.remove('menu-open')
}
onResize () {
@ -45,9 +46,7 @@ export class MenuService {
private handleWindowResize () {
// On touch screens, do not handle window resize event since opened menu is handled with a content overlay
if (this.screenService.isInTouchScreen()) {
return
}
if (this.screenService.isInTouchScreen()) return
fromEvent(window, 'resize')
.pipe(debounceTime(200))

View File

@ -30,7 +30,7 @@ export class ScreenService {
}
isInTouchScreen () {
return 'ontouchstart' in window || navigator.msMaxTouchPoints
return !!('ontouchstart' in window || navigator.msMaxTouchPoints)
}
getNumberOfAvailableMiniatures () {