RED-5919 - WIP on "Tooltip for first annotation action shown without hovering"
This commit is contained in:
parent
ce89d53b27
commit
d6f3b86d3f
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Core } from '@pdftron/webviewer';
|
import { Core, WebViewerInstance } from '@pdftron/webviewer';
|
||||||
import type { List } from '@iqser/common-ui';
|
import type { List } from '@iqser/common-ui';
|
||||||
import { AnnotationPredicate, DeleteAnnotationsOptions } from '../utils/types';
|
import { AnnotationPredicate, DeleteAnnotationsOptions } from '../utils/types';
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
@ -16,6 +16,7 @@ export class REDAnnotationManager {
|
|||||||
readonly hidden = new Set<string>();
|
readonly hidden = new Set<string>();
|
||||||
|
|
||||||
#manager: AnnotationManager;
|
#manager: AnnotationManager;
|
||||||
|
#instance;
|
||||||
|
|
||||||
get selected() {
|
get selected() {
|
||||||
return this.#manager.getSelectedAnnotations();
|
return this.#manager.getSelectedAnnotations();
|
||||||
@ -27,13 +28,43 @@ export class REDAnnotationManager {
|
|||||||
|
|
||||||
get #annotationSelected$() {
|
get #annotationSelected$() {
|
||||||
const onSelect$ = fromEvent<[Annotation[], string]>(this.#manager, '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.#manager = annotationManager;
|
||||||
|
this.#instance = instance;
|
||||||
this.annotationSelected$ = this.#annotationSelected$;
|
this.annotationSelected$ = this.#annotationSelected$;
|
||||||
this.#autoSelectRectangleAfterCreation();
|
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) {
|
isHidden(annotationId: string) {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export class WebViewerLoadedGuard implements CanActivate {
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const instance = await this._pdf.init(document.getElementById('viewer'));
|
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._documentViewer.init(instance.Core.documentViewer);
|
||||||
this._viewerHeaderService.init();
|
this._viewerHeaderService.init();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user