From 4364272f671d063410cfb70d85b18f7e90fc9e7e Mon Sep 17 00:00:00 2001
From: Hamza HRAMCHI <hamza.hramchi@xelians.fr>
Date: Wed, 10 Nov 2021 12:10:40 +0100
Subject: [PATCH] FIX #18718 TIME 0:10 fix undefined path in firefox browser

---
 src/frontend/app/signatures/signatures.component.html |  4 ++--
 src/frontend/app/signatures/signatures.component.ts   | 11 ++---------
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/frontend/app/signatures/signatures.component.html b/src/frontend/app/signatures/signatures.component.html
index ad8e250901..4cafbdb0c4 100755
--- a/src/frontend/app/signatures/signatures.component.html
+++ b/src/frontend/app/signatures/signatures.component.html
@@ -14,12 +14,12 @@
             <ion-slide *ngFor="let slide of signaturesList;" style="display: grid;grid-template-columns: repeat(2, 1fr);">
                 <div style="display: contents;">
                     <ion-card *ngFor="let sign of slide; let i=index" class="sign-image">
-                        <img id="imgSign_{{i}}" (click)="setSignatureWidth($event); selectSignature(sign)" [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + sign.encodedSignature)"
+                        <img id="imgSign_{{i}}" (click)="selectSignature(sign)" [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + sign.encodedSignature)"
                             style="width: 190px;cursor: pointer;">
                         <ion-toolbar style="position: absolute;top: 0px;">
                             <ion-label color="secondary" *ngIf="sign.substituted">{{'lang.substitutedSignature' | translate}}</ion-label>
                             <ion-buttons slot="start">
-                                <ion-button size="small" color="primary" (click)="setSignatureWidth($event, sign); selectSignature(sign);" [title]="'lang.selectSignature' | translate">
+                                <ion-button size="small" color="primary" (click)="selectSignature(sign);" [title]="'lang.selectSignature' | translate">
                                     <ion-icon slot="icon-only" name="arrow-up-circle-outline"></ion-icon>
                                 </ion-button>
                             </ion-buttons>
diff --git a/src/frontend/app/signatures/signatures.component.ts b/src/frontend/app/signatures/signatures.component.ts
index 54f00943d9..a2735c28c4 100755
--- a/src/frontend/app/signatures/signatures.component.ts
+++ b/src/frontend/app/signatures/signatures.component.ts
@@ -121,6 +121,8 @@ export class SignaturesComponent implements OnInit {
     }
 
     selectSignature(signature: any) {
+        const sign: any = document.getElementById('imgSign_' + (this.signaturesList[0].indexOf(signature)).toString());
+        this.signatureWidth = sign.naturalWidth;
         let percentWidth: any = 25;
         this.signatureScaling = this.authService.user.preferences.signatureScaling === undefined ? false : this.authService.user.preferences.signatureScaling;
         const signatureWidth: number = this.signatureWidth >= this.documentWidth ? 100 : (this.signatureWidth * 100) / this.documentWidth;
@@ -340,13 +342,4 @@ export class SignaturesComponent implements OnInit {
         const dataView = new DataView(uint8.buffer);
         this.documentWidth = dataView.getInt32(0);
     }
-
-    setSignatureWidth(event: any, sign: any = null) {
-        if (sign !== null) {
-            const element: any = document.getElementById('imgSign_' + (this.signaturesList[0].indexOf(sign)).toString());
-            this.signatureWidth = element.naturalWidth;
-        } else {
-            this.signatureWidth = event.path[0].naturalWidth;
-        }
-    }
 }
-- 
GitLab