Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close #422 #430

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="flex-container">
<jhi-summary-template class="summary" [questions]="eventHandler.questions"></jhi-summary-template>
<jhi-summary-template (gotoQ)="goToQuestion($event)" class="summary" [questions]="eventHandler.questions"></jhi-summary-template>
<div class="canvas-wrapper foo">
<p-blockUI [blocked]="blocked">
<!--<i class="pi pi-lock" style="font-size: 3rem"></i>-->
Expand All @@ -8,17 +8,16 @@
<ngx-extended-pdf-viewer
[src]="content"
[useBrowserLocale]="true"
style="flex: 1 1 100%"
style="flex: 1 1 90%"
#viewer
[height]="'90vh'"
[height]="'89vh'"
[page]="1"
[handTool]="false"
[showHandToolButton]="false"
[textLayer]="false"
[(scrollMode)]="scrollMode"
[handTool]="false"
[showToolbar]="false"
[pageViewMode]="'infinite-scroll'"
[showSecondaryToolbarButton]="false"
[sidebarVisible]="false"
(pageRender)="blocked = true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.canvas-wrapper {
overflow-y: scroll;
overflow-y: hidden;
overflow-x: hidden;
width: 65vw;
height: 87vh;
height: 89vh;
}

.flex-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class FabricCanvasComponent implements OnInit {

public ngOnInit(): void {
this.eventHandler.reinit(this.exam, this.zones);

this.activatedRoute.paramMap.subscribe(params => {
this.examId = parseInt(params.get('examid') ?? '-1', 10);

Expand Down Expand Up @@ -178,13 +177,26 @@ export class FabricCanvasComponent implements OnInit {
}
});
}

if (this.pdfViewerService.isRenderQueueEmpty()) {
this.loadingPdfMetadata(evt.source.scale);

this.blocked = false;
}
}
}

goToQuestion(q: Question): void {
if (q.zoneDTO?.pageNumber && q.zoneDTO?.yInit && this.eventHandler.pages?.[1]) {
const p = q.zoneDTO.pageNumber;
const y = (q.zoneDTO.yInit * this.eventHandler.pages[1].pageViewer.canvas.clientHeight) / 100000;
this.scrollPageandTop(p, y);
}
}
scrollPageandTop(page: number, top: number): void {
this.pdfViewerService.scrollPageIntoView(page, { top, left: 0 });
}

public async loadingPdfMetadata(pdfScale: number): Promise<void> {
const rects = await this.getCustomPdfProperties();
const qs: Record<number, Array<Rect>> = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<h3 jhiTranslate="scanexam.resumebareme">Résumé du sujet</h3>
<hr />
<div *ngFor="let q of getSortedQuestions(); index as i">
<b>Q{{ q.numero }}</b>
<a (click)="goToQuestion(q)"
><b>Q{{ q.numero }}</b></a
>
<div *ngIf="isFollowingQuestion(i, q); then follow; else nofollow"></div>
<ng-template #follow>( <span jhiTranslate="scanexam.suite"></span> )</ng-template>
<ng-template #nofollow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Question } from 'app/entities/question/question.model';

@Component({
Expand All @@ -10,6 +10,9 @@ export class SummaryTemplateComponent {
@Input()
questions: Map<number, Question> = new Map();

@Output()
gotoQ: EventEmitter<Question> = new EventEmitter<Question>();

public getSortedQuestions(): Array<Question> {
return [...this.questions.values()].sort((a, b) => a.numero! - b.numero!);
}
Expand All @@ -31,4 +34,8 @@ export class SummaryTemplateComponent {
.filter(q2 => q2.numero === q.numero).length > 0
);
}

public goToQuestion(q: Question): void {
this.gotoQ.emit(q);
}
}