viewer rotation

This commit is contained in:
Peter Maquiran
2024-02-22 11:40:06 +01:00
parent d0806455c9
commit 7583bf5306
39 changed files with 711 additions and 1312 deletions
+27 -3
View File
@@ -1,20 +1,44 @@
import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
// import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { ScreenOrientation, OrientationType } from '@capawesome/capacitor-screen-orientation';
@Injectable({
providedIn: 'root'
})
export class DeviceService {
constructor( private platform: Platform,) { }
currentOrientation: 'portrait' | 'landscape';
constructor( private platform: Platform) {
}
ngOnInit() {
this.detectOrientation();
}
isTableDivice() {
return false;
return this.platform.is("tablet");
}
isDesktop() {
return true;
return this.platform.is('desktop');
}
private detectOrientation() {
this.currentOrientation = this.platform.isPortrait() ? 'portrait' : 'landscape';
}
isTableLandscape() {
this.detectOrientation()
return this.isTableDivice() && this.currentOrientation == 'landscape' ;
}
get visionDesktop () {
return this.isDesktop() || this.isTableLandscape();
}
}