diff --git a/packages/geo/src/lib/print/print-form/print-form.component.html b/packages/geo/src/lib/print/print-form/print-form.component.html index 5f0632dc68..0c648f5c3c 100644 --- a/packages/geo/src/lib/print/print-form/print-form.component.html +++ b/packages/geo/src/lib/print/print-form/print-form.component.html @@ -190,11 +190,8 @@ formControlName="resolution" placeholder="{{ 'igo.geo.printForm.resolution' | translate }}" > - - {{ resolution.value }} + + {{ resolution }} diff --git a/packages/geo/src/lib/print/print-form/print-form.component.ts b/packages/geo/src/lib/print/print-form/print-form.component.ts index 33bb75594d..e37477248d 100644 --- a/packages/geo/src/lib/print/print-form/print-form.component.ts +++ b/packages/geo/src/lib/print/print-form/print-form.component.ts @@ -6,6 +6,8 @@ import { Validators } from '@angular/forms'; +import { MediaService } from '@igo2/core'; + import { BehaviorSubject } from 'rxjs'; import { PrintOptions } from '../shared/print.interface'; @@ -28,7 +30,7 @@ export class PrintFormComponent implements OnInit { public outputFormats = PrintOutputFormat; public paperFormats = PrintPaperFormat; public orientations = PrintOrientation; - public resolutions = PrintResolution; + public resolutions = [...PrintResolution]; public imageFormats = PrintSaveImageFormat; public legendPositions = PrintLegendPosition; public isPrintService = true; @@ -80,7 +82,7 @@ export class PrintFormComponent implements OnInit { return this.resolutionField.value; } set resolution(value: PrintResolution) { - this.resolutionField.setValue(value || PrintResolution['96'], { + this.resolutionField.setValue(value || ('96' satisfies PrintResolution), { onlySelf: true }); } @@ -202,7 +204,10 @@ export class PrintFormComponent implements OnInit { maxLength: number = 180; - constructor(private formBuilder: UntypedFormBuilder) { + constructor( + private formBuilder: UntypedFormBuilder, + private mediaService: MediaService + ) { this.form = this.formBuilder.group({ title: ['', [Validators.minLength(0), Validators.maxLength(130)]], subtitle: ['', [Validators.minLength(0), Validators.maxLength(120)]], @@ -225,6 +230,11 @@ export class PrintFormComponent implements OnInit { ngOnInit() { this.doZipFileField.setValue(false); + if (this.mediaService.isMobile()) { + this.resolutions = this.resolutions.filter( + (resolution) => resolution !== '300' + ); + } } handleFormSubmit(data: PrintOptions, isValid: boolean) { diff --git a/packages/geo/src/lib/print/shared/print.type.ts b/packages/geo/src/lib/print/shared/print.type.ts index bed6449870..b0c8279928 100644 --- a/packages/geo/src/lib/print/shared/print.type.ts +++ b/packages/geo/src/lib/print/shared/print.type.ts @@ -19,8 +19,8 @@ export type PrintPaperFormat = keyof typeof PrintPaperFormat; export const PrintOrientation = strEnum(['landscape', 'portrait']); export type PrintOrientation = keyof typeof PrintOrientation; -export const PrintResolution = strEnum(['72', '96', '150']); // For now, we remove the 300 dpi because there is too much instability on iOS and slow device. -export type PrintResolution = keyof typeof PrintResolution; +export const PrintResolution = ['72', '96', '150', '300'] as const; +export type PrintResolution = (typeof PrintResolution)[number]; export const PrintSaveImageFormat = strEnum([ 'Bmp',