Skip to content
Snippets Groups Projects
Commit aef1878f authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX #11183 TIME 3 fix init working area

parent b09bb1f5
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<app-sidebar [snavLeftComponent]="this.snav" [snavRightComponent]="this.snavRight"></app-sidebar> <app-sidebar [snavLeftComponent]="this.snav" [snavRightComponent]="this.snavRight"></app-sidebar>
</mat-sidenav> </mat-sidenav>
<mat-sidenav-content class="mainView"> <mat-sidenav-content class="mainView">
<div *ngIf="loadingDoc" <div *ngIf="signaturesService.mainLoading"
style="position: absolute;z-index: 2;display: flex;background: #fffc;width: 100%;height: 100%;justify-content: center;align-items: center;"> style="position: absolute;z-index: 2;display: flex;background: #fffc;width: 100%;height: 100%;justify-content: center;align-items: center;">
<mat-spinner></mat-spinner> <mat-spinner></mat-spinner>
</div> </div>
...@@ -63,9 +63,9 @@ ...@@ -63,9 +63,9 @@
<app-document-note-list (tap)="addAnnotation($event)" *ngIf="currentDoc == 0"> <app-document-note-list (tap)="addAnnotation($event)" *ngIf="currentDoc == 0">
</app-document-note-list> </app-document-note-list>
<app-document-sign-list *ngIf="currentDoc == 0"></app-document-sign-list> <app-document-sign-list *ngIf="currentDoc == 0"></app-document-sign-list>
<img *ngIf="!loadingDoc && !freezeSidenavClose" (tap)="addAnnotation($event)" id="snapshotPdf" <img *ngIf="!signaturesService.mainLoading && !freezeSidenavClose" (tap)="addAnnotation($event)" id="snapshotPdf"
[src]="sanitizer.bypassSecurityTrustUrl('data:image/png;base64, '+docList[currentDoc].imgContent[pageNum])" [src]="sanitizer.bypassSecurityTrustUrl('data:image/png;base64, '+docList[currentDoc].imgContent[pageNum])"
style="width:100%;" class="zoom" /> style="width:100%;" class="zoom" (load)="initWorkingArea()"/>
<app-document-note-pad (triggerEvent)="zoomForView()" #appDocumentNotePad *ngIf="currentDoc == 0"> <app-document-note-pad (triggerEvent)="zoomForView()" #appDocumentNotePad *ngIf="currentDoc == 0">
</app-document-note-pad> </app-document-note-pad>
</div> </div>
......
...@@ -75,30 +75,29 @@ export class DocumentComponent implements OnInit { ...@@ -75,30 +75,29 @@ export class DocumentComponent implements OnInit {
signaturesContent: any = []; signaturesContent: any = [];
totalPages: number; totalPages: number;
draggable: boolean; draggable: boolean;
loadingDoc: boolean = true;
currentDoc: number = 0; currentDoc: number = 0;
docList: any = []; docList: any = [];
actionsList: any = [ actionsList: any = [
{ {
id : 2, id: 2,
label : 'lang.reject', label: 'lang.reject',
color : '#e74c3c', color: '#e74c3c',
logo : 'fas fa-backspace', logo: 'fas fa-backspace',
event : 'refuseDocument' event: 'refuseDocument'
}, },
{ {
id : 3, id: 3,
label : 'lang.signatures', label: 'lang.signatures',
color : '#135F7F', color: '#135F7F',
logo : '', logo: '',
event : 'openDrawer' event: 'openDrawer'
}, },
{ {
id : 1, id: 1,
label : 'lang.validate', label: 'lang.validate',
color : '#2ecc71', color: '#2ecc71',
logo : 'fas fa-check-circle', logo: 'fas fa-check-circle',
event : 'validateDocument' event: 'validateDocument'
}, },
]; ];
pdfDataArr: any; pdfDataArr: any;
...@@ -110,8 +109,8 @@ export class DocumentComponent implements OnInit { ...@@ -110,8 +109,8 @@ export class DocumentComponent implements OnInit {
mainDocument: any = { mainDocument: any = {
id: 0, id: 0,
attachments : [], attachments: [],
workflow : [], workflow: [],
}; };
loadingUI: any = false; loadingUI: any = false;
...@@ -157,7 +156,7 @@ export class DocumentComponent implements OnInit { ...@@ -157,7 +156,7 @@ export class DocumentComponent implements OnInit {
}, 500); }, 500);
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
if (typeof params['id'] !== 'undefined') { if (typeof params['id'] !== 'undefined') {
this.loadingDoc = true; this.signaturesService.mainLoading = true;
this.signaturesService.renderingDoc = true; this.signaturesService.renderingDoc = true;
this.http.get('../rest/documents/' + params['id']) this.http.get('../rest/documents/' + params['id'])
.subscribe((data: any) => { .subscribe((data: any) => {
...@@ -194,13 +193,14 @@ export class DocumentComponent implements OnInit { ...@@ -194,13 +193,14 @@ export class DocumentComponent implements OnInit {
this.snav.open(); this.snav.open();
this.signaturesService.mainDocumentId = null; this.signaturesService.mainDocumentId = null;
this.freezeSidenavClose = true; this.freezeSidenavClose = true;
this.loadingDoc = false; this.signaturesService.mainLoading = false;
} }
}); });
} }
/*ngDoCheck() { /*ngDoCheck() {
if (this.signaturesService.workingAreaHeight !== $('#snapshotPdf').height() || this.signaturesService.workingAreaWidth !== $('#snapshotPdf').width()) { if (this.signaturesService.workingAreaHeight !== $('#snapshotPdf').height() || this.signaturesService.workingAreaWidth !== $('#snapshotPdf').width()) {
console.log('fuuu :' + this.signaturesService.workingAreaWidth);
this.signaturesService.workingAreaHeight = $('#snapshotPdf').height(); this.signaturesService.workingAreaHeight = $('#snapshotPdf').height();
this.signaturesService.workingAreaWidth = $('#snapshotPdf').width(); this.signaturesService.workingAreaWidth = $('#snapshotPdf').width();
} }
...@@ -208,26 +208,26 @@ export class DocumentComponent implements OnInit { ...@@ -208,26 +208,26 @@ export class DocumentComponent implements OnInit {
renderImage() { renderImage() {
if (this.docList[this.currentDoc].imgContent[this.pageNum] === undefined) { if (this.docList[this.currentDoc].imgContent[this.pageNum] === undefined) {
this.loadingDoc = true; this.signaturesService.mainLoading = true;
this.loadingUI = true; this.loadingUI = true;
if (this.currentDoc === 0) { if (this.currentDoc === 0) {
this.http.get('../rest/documents/' + this.docList[this.currentDoc].id + '/thumbnails/' + this.pageNum) this.http.get('../rest/documents/' + this.docList[this.currentDoc].id + '/thumbnails/' + this.pageNum)
.subscribe((data: any) => { .subscribe((data: any) => {
this.docList[this.currentDoc].imgContent[this.pageNum] = data.fileContent; this.docList[this.currentDoc].imgContent[this.pageNum] = data.fileContent;
this.loadingDoc = false; this.signaturesService.mainLoading = false;
setTimeout(() => { setTimeout(() => {
this.loadingUI = false; this.loadingUI = false;
}, 400); }, 400);
}); });
} else { } else {
this.http.get('../rest/attachments/' + this.docList[this.currentDoc].id + '/thumbnails/' + this.pageNum) this.http.get('../rest/attachments/' + this.docList[this.currentDoc].id + '/thumbnails/' + this.pageNum)
.subscribe((data: any) => { .subscribe((data: any) => {
this.docList[this.currentDoc].imgContent[this.pageNum] = data.fileContent; this.docList[this.currentDoc].imgContent[this.pageNum] = data.fileContent;
this.loadingDoc = false; this.signaturesService.mainLoading = false;
setTimeout(() => { setTimeout(() => {
this.loadingUI = false; this.loadingUI = false;
}, 400); }, 400);
}); });
} }
} }
} }
...@@ -282,6 +282,7 @@ export class DocumentComponent implements OnInit { ...@@ -282,6 +282,7 @@ export class DocumentComponent implements OnInit {
} }
zoomForView() { zoomForView() {
this.signaturesService.mainLoading = true;
// this.resetDragPosition(); // this.resetDragPosition();
this.resetDragPos = true; this.resetDragPos = true;
this.widthDoc = '100%'; this.widthDoc = '100%';
...@@ -291,6 +292,7 @@ export class DocumentComponent implements OnInit { ...@@ -291,6 +292,7 @@ export class DocumentComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
this.signaturesService.workingAreaHeight = $('#snapshotPdf').height(); this.signaturesService.workingAreaHeight = $('#snapshotPdf').height();
this.signaturesService.workingAreaWidth = $('#snapshotPdf').width(); this.signaturesService.workingAreaWidth = $('#snapshotPdf').width();
this.signaturesService.mainLoading = false;
}, 400); }, 400);
this.signaturesService.scale = 1; this.signaturesService.scale = 1;
...@@ -324,6 +326,14 @@ export class DocumentComponent implements OnInit { ...@@ -324,6 +326,14 @@ export class DocumentComponent implements OnInit {
this.renderImage(); this.renderImage();
} }
initWorkingArea() {
if ((typeof this.signaturesService.workingAreaHeight !== 'number' || this.signaturesService.workingAreaHeight === 0) && (typeof this.signaturesService.workingAreaWidth !== 'number' || this.signaturesService.workingAreaWidth === 0)) {
this.img = document.querySelector('img.zoom');
const rect = this.img.getBoundingClientRect();
this.signaturesService.workingAreaHeight = rect.height;
this.signaturesService.workingAreaWidth = rect.width;
}
}
addAnnotation(e: any) { addAnnotation(e: any) {
e.preventDefault(); e.preventDefault();
...@@ -342,7 +352,6 @@ export class DocumentComponent implements OnInit { ...@@ -342,7 +352,6 @@ export class DocumentComponent implements OnInit {
const posX = offsetX - this.signaturesService.x; const posX = offsetX - this.signaturesService.x;
const posY = offsetY - this.signaturesService.y; const posY = offsetY - this.signaturesService.y;
if (this.signaturesService.mobileMode) { if (this.signaturesService.mobileMode) {
this.signaturesService.x = -posX; this.signaturesService.x = -posX;
} else { } else {
...@@ -485,35 +494,35 @@ export class DocumentComponent implements OnInit { ...@@ -485,35 +494,35 @@ export class DocumentComponent implements OnInit {
openVisaWorkflow() { openVisaWorkflow() {
this.snavRight.open(); this.snavRight.open();
this.signaturesService.sideNavRigtDatas = { this.signaturesService.sideNavRigtDatas = {
mode : 'visaWorkflow', mode: 'visaWorkflow',
width : '450px', width: '450px',
locked : false, locked: false,
}; };
} }
openDocumentList() { openDocumentList() {
this.snavRight.open(); this.snavRight.open();
this.signaturesService.sideNavRigtDatas = { this.signaturesService.sideNavRigtDatas = {
mode : 'documentList', mode: 'documentList',
width : '450px', width: '450px',
locked : false, locked: false,
}; };
} }
openMainDocumentDetail() { openMainDocumentDetail() {
this.snavRight.open(); this.snavRight.open();
this.signaturesService.sideNavRigtDatas = { this.signaturesService.sideNavRigtDatas = {
mode : 'mainDocumentDetail', mode: 'mainDocumentDetail',
width : '450px', width: '450px',
locked : false, locked: false,
}; };
} }
backToDetails() { backToDetails() {
this.signaturesService.sideNavRigtDatas = { this.signaturesService.sideNavRigtDatas = {
mode : 'mainDocumentDetail', mode: 'mainDocumentDetail',
width : '450px', width: '450px',
locked : false, locked: false,
}; };
} }
...@@ -522,10 +531,10 @@ export class DocumentComponent implements OnInit { ...@@ -522,10 +531,10 @@ export class DocumentComponent implements OnInit {
if (r) { if (r) {
this.http.put('../rest/users/' + this.authService.user.id + '/substitute', { substitute: null }) this.http.put('../rest/users/' + this.authService.user.id + '/substitute', { substitute: null })
.subscribe(() => { .subscribe(() => {
this.authService.updateUserInfoWithTokenRefresh(); this.authService.updateUserInfoWithTokenRefresh();
this.notificationService.success('lang.substitutionDeleted'); this.notificationService.success('lang.substitutionDeleted');
}); });
} }
} }
} }
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
'pdf-page-canvas':!signaturesService.renderingDoc, 'pdf-page-canvas':!signaturesService.renderingDoc,
'pdf-page-canvas-loading-doc':signaturesService.renderingDoc 'pdf-page-canvas-loading-doc':signaturesService.renderingDoc
}"> }">
<img [style.width.px]="signaturesService.workingAreaWidth" [src]="sanitization.bypassSecurityTrustUrl(note.fullPath)"> <img [style.width.%]="100" [src]="sanitization.bypassSecurityTrustUrl(note.fullPath)">
</div> </div>
</ng-container> </ng-container>
\ No newline at end of file
...@@ -22,14 +22,16 @@ export class DocumentNotePadComponent implements OnInit { ...@@ -22,14 +22,16 @@ export class DocumentNotePadComponent implements OnInit {
ngOnInit(): void { } ngOnInit(): void { }
initPad() { initPad() {
console.log(this.signaturesService.workingAreaHeight);
console.log(this.signaturesService.workingAreaWidth);
setTimeout(() => { setTimeout(() => {
($('#myCanvas') as any).sign({ ($('#myCanvas') as any).sign({
mode: this.authService.user.preferences.writingMode, // direct or stylus mode: this.authService.user.preferences.writingMode, // direct or stylus
lineWidth: this.authService.user.preferences.writingSize, lineWidth: this.authService.user.preferences.writingSize,
changeColor: $('.radio'), changeColor: $('.radio'),
undo: $('.undo'), undo: $('.undo'),
height: this.signaturesService.workingAreaHeight * 2, height: this.signaturesService.workingAreaHeight,
width: this.signaturesService.workingAreaWidth * 2, width: this.signaturesService.workingAreaWidth,
fixHeight: this.signaturesService.y, fixHeight: this.signaturesService.y,
fixWidth: this.signaturesService.x, fixWidth: this.signaturesService.x,
mobileMode: this.signaturesService.mobileMode mobileMode: this.signaturesService.mobileMode
...@@ -39,15 +41,18 @@ export class DocumentNotePadComponent implements OnInit { ...@@ -39,15 +41,18 @@ export class DocumentNotePadComponent implements OnInit {
} }
cancelAnnotation() { cancelAnnotation() {
this.signaturesService.mainLoading = true;
setTimeout(() => { setTimeout(() => {
this.triggerEvent.emit(); this.triggerEvent.emit();
this.signaturesService.x = 0; this.signaturesService.x = 0;
this.signaturesService.y = 90; this.signaturesService.y = 90;
this.signaturesService.annotationMode = false; this.signaturesService.annotationMode = false;
this.signaturesService.mainLoading = false;
}, 200); }, 200);
} }
validateAnnotation() { validateAnnotation() {
this.signaturesService.mainLoading = true;
if (!this.signaturesService.notesContent[this.signaturesService.currentPage]) { if (!this.signaturesService.notesContent[this.signaturesService.currentPage]) {
this.signaturesService.notesContent[this.signaturesService.currentPage] = []; this.signaturesService.notesContent[this.signaturesService.currentPage] = [];
} }
......
...@@ -35,7 +35,8 @@ export class SignaturesContentService { ...@@ -35,7 +35,8 @@ export class SignaturesContentService {
mode = ''; mode = '';
scale = 1; scale = 1;
x = 0; x = 0;
y = 0; y = 90;
mainLoading = true;
constructor() { constructor() {
if (window.screen.width <= 360) { if (window.screen.width <= 360) {
......
...@@ -37,13 +37,8 @@ jQuery(document).ready(function (e) { ...@@ -37,13 +37,8 @@ jQuery(document).ready(function (e) {
var fixFingerPosition = 15; var fixFingerPosition = 15;
if (params.mobileMode === true) { canvas.attr("width", params.width);
canvas.attr("width", params.width / 2); canvas.attr("height", params.height);
canvas.attr("height", params.height / 2);
} else {
canvas.attr("width", params.width);
canvas.attr("height", params.height);
}
var points = []; var points = [];
var last = { var last = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment