Some code style fixes
This commit is contained in:
parent
245b9d27bc
commit
1bfc7b7379
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -30,7 +30,7 @@ export class ScreenService {
|
|||
}
|
||||
|
||||
isInTouchScreen () {
|
||||
return 'ontouchstart' in window || navigator.msMaxTouchPoints
|
||||
return !!('ontouchstart' in window || navigator.msMaxTouchPoints)
|
||||
}
|
||||
|
||||
getNumberOfAvailableMiniatures () {
|
||||
|
|
Loading…
Reference in New Issue