diff --git a/src/frontend/app/app.component.ts b/src/frontend/app/app.component.ts index 632ea2176488be0bc5141f95adbea8230373ffc2..d3bb4a2be367b2be456001fad9d82b42254b4ac2 100755 --- a/src/frontend/app/app.component.ts +++ b/src/frontend/app/app.component.ts @@ -1,4 +1,4 @@ -import { Component, ViewEncapsulation } from '@angular/core'; +import { Component, HostListener, OnInit, ViewEncapsulation } from '@angular/core'; import { CookieService } from 'ngx-cookie-service'; import { SignaturesContentService } from './service/signatures.service'; import { HttpClient } from '@angular/common/http'; @@ -19,11 +19,12 @@ import { Platform } from '@ionic/angular'; styleUrls: ['app.component.scss'] }) -export class AppComponent { +export class AppComponent implements OnInit { isPortrait: boolean; debugMode: boolean; showLeftContent: boolean = false; showRightContent: boolean = false; + constructor(private translate: TranslateService, public http: HttpClient, public signaturesService: SignaturesContentService, @@ -53,8 +54,32 @@ export class AppComponent { } - test() { - return true; + // The event listens for window resize and checks if the device resolution has changed + @HostListener('window:resize', ['$event']) + onResize() { + if (window.matchMedia('(resolution: ' + window.devicePixelRatio + 'dppx)').matches) { + if (window.devicePixelRatio >= 1.25) { + this.signaturesService.mobileMode = true; + setTimeout(() => { + $('.right-menu-responsive').css('--max-width', 'none'); + }, 0); + } else { + this.signaturesService.mobileMode = false; + } + } + } + + ngOnInit(): void { + if (window.matchMedia('(resolution: ' + window.devicePixelRatio + 'dppx)').matches) { + if (window.devicePixelRatio >= 1.25) { + this.signaturesService.mobileMode = true; + setTimeout(() => { + $('.right-menu-responsive').css('--max-width', 'none'); + }, 0); + } else { + this.signaturesService.mobileMode = false; + } + } } allowedRoute() {