Add zoom and device detection with warning component

Introduces DeviceDetectionService and ZoomDetectionService to detect mobile devices and browser zoom level. Adds ZoomWarningComponent to display warnings for unsupported mobile devices and non-optimal browser zoom, and integrates it into the app layout. Updates routing to allow mobile access for the 'poc-model' route.
This commit is contained in:
2025-11-18 23:00:18 +01:00
parent 78144d7447
commit f4eb700ab4
8 changed files with 261 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, fromEvent } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class ZoomDetectionService {
private zoomLevel$ = new BehaviorSubject<number>(this.getZoomLevel());
constructor() {
// Zoom-Änderungen überwachen
fromEvent(window, 'resize')
.pipe(debounceTime(200))
.subscribe(() => {
this.zoomLevel$.next(this.getZoomLevel());
});
}
getZoomLevel(): number {
const devicePixelRatio = window.devicePixelRatio || 1;
return devicePixelRatio;
}
getZoomLevel$() {
return this.zoomLevel$.asObservable();
}
isZoomOutOfRange(minZoom: number = 0.95, maxZoom: number = 1.05): boolean {
const currentZoom = this.getZoomLevel();
return currentZoom < minZoom || currentZoom > maxZoom;
}
}