mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
JS - Add support for display property
- in annotation_layer, move common properties treatment in a common method instead having duplicated code in each widget.
This commit is contained in:
parent
afb8c4fd25
commit
af125cd299
6 changed files with 197 additions and 141 deletions
|
@ -439,13 +439,40 @@ class Annotation {
|
|||
);
|
||||
}
|
||||
|
||||
isHidden(annotationStorage) {
|
||||
/**
|
||||
* Check if the annotation must be displayed by taking into account
|
||||
* the value found in the annotationStorage which may have been set
|
||||
* through JS.
|
||||
*
|
||||
* @public
|
||||
* @memberof Annotation
|
||||
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation
|
||||
*/
|
||||
mustBeViewed(annotationStorage) {
|
||||
const storageEntry =
|
||||
annotationStorage && annotationStorage.get(this.data.id);
|
||||
if (storageEntry && storageEntry.hidden !== undefined) {
|
||||
return storageEntry.hidden;
|
||||
return !storageEntry.hidden;
|
||||
}
|
||||
return this._hasFlag(this.flags, AnnotationFlag.HIDDEN);
|
||||
return this.viewable && !this._hasFlag(this.flags, AnnotationFlag.HIDDEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the annotation must be printed by taking into account
|
||||
* the value found in the annotationStorage which may have been set
|
||||
* through JS.
|
||||
*
|
||||
* @public
|
||||
* @memberof Annotation
|
||||
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation
|
||||
*/
|
||||
mustBePrinted(annotationStorage) {
|
||||
const storageEntry =
|
||||
annotationStorage && annotationStorage.get(this.data.id);
|
||||
if (storageEntry && storageEntry.print !== undefined) {
|
||||
return storageEntry.print;
|
||||
}
|
||||
return this.printable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue