Select annotation
This commit is contained in:
parent
e6db65da9d
commit
19a8ceca0f
@ -21,7 +21,9 @@
|
|||||||
<div class="left-container">
|
<div class="left-container">
|
||||||
<redaction-pdf-viewer [class.visible]="activeViewer === 'ANNOTATED'" [fileId]="fileId" fileType="ANNOTATED"
|
<redaction-pdf-viewer [class.visible]="activeViewer === 'ANNOTATED'" [fileId]="fileId" fileType="ANNOTATED"
|
||||||
[fileStatus]="appStateService.activeFile"
|
[fileStatus]="appStateService.activeFile"
|
||||||
(fileReady)="fileReady('ANNOTATED')" (annotationsAdded)="handleAnnotationsAdded($event)"></redaction-pdf-viewer>
|
(fileReady)="fileReady('ANNOTATED')"
|
||||||
|
(annotationSelected)="handleAnnotationSelected($event)"
|
||||||
|
(annotationsAdded)="handleAnnotationsAdded($event)"></redaction-pdf-viewer>
|
||||||
<redaction-pdf-viewer [class.visible]="activeViewer === 'REDACTED'" [fileId]="fileId" fileType="REDACTED"
|
<redaction-pdf-viewer [class.visible]="activeViewer === 'REDACTED'" [fileId]="fileId" fileType="REDACTED"
|
||||||
(fileReady)="fileReady('REDACTED')"></redaction-pdf-viewer>
|
(fileReady)="fileReady('REDACTED')"></redaction-pdf-viewer>
|
||||||
</div>
|
</div>
|
||||||
@ -47,8 +49,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-content" *ngIf="selectedTab === 'ANNOTATIONS'">
|
<div class="tab-content" *ngIf="selectedTab === 'ANNOTATIONS'">
|
||||||
<div *ngFor="let annotation of annotations">
|
<div *ngFor="let annotation of annotations"
|
||||||
{{annotation.Id+ ' '+annotation.getPageNumber() + ' content: ' + annotation.getContents() + 'status: '+annotation.getStatus()}}
|
class="annotation" (click)="selectAnnotation(annotation)"
|
||||||
|
[ngClass]="{ active: selectedAnnotation === annotation }">
|
||||||
|
<div>{{annotation.Id}}</div>
|
||||||
|
<div>Page {{annotation.getPageNumber()}}</div>
|
||||||
|
<div>{{annotation.getContents()}}</div>
|
||||||
|
<div>{{annotation.getStatus()}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-content" *ngIf="selectedTab === 'INFO'">
|
<div class="tab-content" *ngIf="selectedTab === 'INFO'">
|
||||||
|
|||||||
@ -17,6 +17,8 @@ redaction-pdf-viewer {
|
|||||||
|
|
||||||
.tabs-title-row {
|
.tabs-title-row {
|
||||||
border-bottom: 1px solid rgba(226,228,233,0.9);
|
border-bottom: 1px solid rgba(226,228,233,0.9);
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 45px;
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@ -40,8 +42,12 @@ redaction-pdf-viewer {
|
|||||||
.actions-row {
|
.actions-row {
|
||||||
margin: $right-container-padding $right-container-padding 0;
|
margin: $right-container-padding $right-container-padding 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-content {
|
.tab-content {
|
||||||
padding: $right-container-padding;
|
padding: $right-container-padding;
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
height: calc(100vh - 110px - 40px - 45px - 3*#{$right-container-padding});
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats-subtitle {
|
.stats-subtitle {
|
||||||
@ -55,4 +61,15 @@ redaction-pdf-viewer {
|
|||||||
|
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.annotation {
|
||||||
|
border: 1px solid $grey-2;
|
||||||
|
padding: 14px;
|
||||||
|
font-size: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
border-left: 2px solid $red-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
|
import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {FileUploadControllerService, ProjectControllerService, StatusControllerService} from '@redaction/red-ui-http';
|
import {FileUploadControllerService, ProjectControllerService, StatusControllerService} from '@redaction/red-ui-http';
|
||||||
import {TranslateService} from '@ngx-translate/core';
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
@ -8,6 +8,7 @@ import {AppStateService} from '../../../state/app-state.service';
|
|||||||
import {FileDetailsDialogComponent} from './file-details-dialog/file-details-dialog.component';
|
import {FileDetailsDialogComponent} from './file-details-dialog/file-details-dialog.component';
|
||||||
import {ViewerSyncService} from '../service/viwer-sync.service';
|
import {ViewerSyncService} from '../service/viwer-sync.service';
|
||||||
import {Annotations} from "@pdftron/webviewer";
|
import {Annotations} from "@pdftron/webviewer";
|
||||||
|
import { PdfViewerComponent } from '../pdf-viewer/pdf-viewer.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-file-preview-screen',
|
selector: 'redaction-file-preview-screen',
|
||||||
@ -18,9 +19,14 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
|
|
||||||
projectId: string;
|
projectId: string;
|
||||||
fileId: string;
|
fileId: string;
|
||||||
annotations: Annotations.Annotation[] = [];
|
public annotations: Annotations.Annotation[] = [];
|
||||||
public selectedTab: 'ANNOTATIONS' | 'INFO' = 'ANNOTATIONS';
|
public selectedTab: 'ANNOTATIONS' | 'INFO' = 'ANNOTATIONS';
|
||||||
private _readyViewers: string[] = [];
|
private _readyViewers: string[] = [];
|
||||||
|
public selectedAnnotation: Annotations.Annotation;
|
||||||
|
|
||||||
|
@ViewChild(PdfViewerComponent)
|
||||||
|
private _viewerComponent: PdfViewerComponent;
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public readonly appStateService: AppStateService,
|
public readonly appStateService: AppStateService,
|
||||||
@ -78,10 +84,18 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
|
|
||||||
handleAnnotationsAdded(annotations: Annotations.Annotation[]) {
|
handleAnnotationsAdded(annotations: Annotations.Annotation[]) {
|
||||||
this._changeDetectorRef.detectChanges();
|
this._changeDetectorRef.detectChanges();
|
||||||
for(let annotation of annotations){
|
for(const annotation of annotations){
|
||||||
if(annotation.Id.indexOf(':')>=0){
|
if(annotation.Id.indexOf(':')>=0){
|
||||||
this.annotations.push(annotation);
|
this.annotations.push(annotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public handleAnnotationSelected(annotation: Annotations.Annotation) {
|
||||||
|
this.selectedAnnotation = annotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public selectAnnotation(annotation: Annotations.Annotation) {
|
||||||
|
this._viewerComponent.selectAnnotation(annotation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
@Input() fileStatus: FileStatus;
|
@Input() fileStatus: FileStatus;
|
||||||
@Output() fileReady = new EventEmitter();
|
@Output() fileReady = new EventEmitter();
|
||||||
@Output() annotationsAdded = new EventEmitter<Annotations.Annotation[]>();
|
@Output() annotationsAdded = new EventEmitter<Annotations.Annotation[]>();
|
||||||
|
@Output() annotationSelected = new EventEmitter<Annotations.Annotation>();
|
||||||
|
|
||||||
@ViewChild('viewer', {static: true}) viewer: ElementRef;
|
@ViewChild('viewer', {static: true}) viewer: ElementRef;
|
||||||
wvInstance: WebViewerInstance;
|
wvInstance: WebViewerInstance;
|
||||||
@ -87,6 +88,14 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
instance.annotManager.on('annotationSelected', ((annotationList, action) => {
|
||||||
|
if (action === 'deselected') {
|
||||||
|
this.annotationSelected.emit(null);
|
||||||
|
} else {
|
||||||
|
this.annotationSelected.emit(annotationList[0]);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
instance.docViewer.on('documentLoaded', this.wvDocumentLoadedHandler)
|
instance.docViewer.on('documentLoaded', this.wvDocumentLoadedHandler)
|
||||||
instance.loadDocument(pdfBlob, {filename: this.fileStatus ? this.fileStatus.filename : 'file.pdf'});
|
instance.loadDocument(pdfBlob, {filename: this.fileStatus ? this.fileStatus.filename : 'file.pdf'});
|
||||||
});
|
});
|
||||||
@ -123,8 +132,8 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
'textSquigglyToolButton',
|
'textSquigglyToolButton',
|
||||||
'textStrikeoutToolButton',
|
'textStrikeoutToolButton',
|
||||||
'linkButton',
|
'linkButton',
|
||||||
// 'toggleNotesButton',
|
'toggleNotesButton',
|
||||||
// 'notesPanel'
|
'notesPanel'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.wvInstance.textPopup.add(<any>{
|
this.wvInstance.textPopup.add(<any>{
|
||||||
@ -147,5 +156,13 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this._viewerSyncService.deregisterInstance(this.fileType);
|
this._viewerSyncService.deregisterInstance(this.fileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public selectAnnotation(annotation: Annotations.Annotation) {
|
||||||
|
this.wvInstance.annotManager.deselectAllAnnotations();
|
||||||
|
this.wvInstance.annotManager.selectAnnotation(annotation);
|
||||||
|
this.wvInstance.docViewer.displayPageLocation(
|
||||||
|
annotation.getPageNumber(),
|
||||||
|
0,
|
||||||
|
annotation.getY() - 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ html, body {
|
|||||||
|
|
||||||
.actions-row {
|
.actions-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user