Compare commits

...

1 Commits

Author SHA1 Message Date
Valentin Mihai
d6f3b86d3f RED-5919 - WIP on "Tooltip for first annotation action shown without hovering" 2023-02-06 11:36:03 +02:00
2 changed files with 35 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Core } from '@pdftron/webviewer';
import { Core, WebViewerInstance } from '@pdftron/webviewer';
import type { List } from '@iqser/common-ui';
import { AnnotationPredicate, DeleteAnnotationsOptions } from '../utils/types';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
@ -16,6 +16,7 @@ export class REDAnnotationManager {
readonly hidden = new Set<string>();
#manager: AnnotationManager;
#instance;
get selected() {
return this.#manager.getSelectedAnnotations();
@ -27,13 +28,43 @@ export class REDAnnotationManager {
get #annotationSelected$() {
const onSelect$ = fromEvent<[Annotation[], string]>(this.#manager, 'annotationSelected');
return onSelect$.pipe(tap(value => console.log('Annotation selected: ', value)));
// this.#instance.disableElements(['tooltip']);
// this.#instance.enableElements(['tooltip']);
// setTimeout(() => {
// this.#instance.enableElements(['tooltip']);
// }, 500);
return onSelect$.pipe(
tap(value => {
console.log('Annotation selected: ', value);
this.#instance.disableElements(['tooltip']);
// this.#instance.disableElements(['tooltip']);
// this.#instance.enableElements(['tooltip']);
setTimeout(() => {
this.#instance.enableElements(['tooltip']);
}, 500);
}),
);
}
init(annotationManager: AnnotationManager) {
init(annotationManager: AnnotationManager, instance: WebViewerInstance) {
this.#manager = annotationManager;
this.#instance = instance;
this.annotationSelected$ = this.#annotationSelected$;
this.#autoSelectRectangleAfterCreation();
// this.#manager.addEventListener('annotationSelected', (annotations, action) => {
// console.log('action: ', action);
// if (action === 'selected') {
// this.#instance.disableElements(['tooltip']);
// setTimeout(() => {
// this.#instance.enableElements(['tooltip']);
// }, 1000);
// }
// });
}
isHidden(annotationId: string) {

View File

@ -24,7 +24,7 @@ export class WebViewerLoadedGuard implements CanActivate {
this._loadingService.start();
const instance = await this._pdf.init(document.getElementById('viewer'));
this._annotationManager.init(instance.Core.annotationManager);
this._annotationManager.init(instance.Core.annotationManager, instance);
this._documentViewer.init(instance.Core.documentViewer);
this._viewerHeaderService.init();