Update BaseViewer.createAnnotationLayerBuilder
, and PDFPageView
, to accurately reflect IPDFAnnotationLayerFactory
(PR 12147 follow-up)
This commit is contained in:
parent
5e44b241b2
commit
a6c1ef82ae
@ -435,6 +435,8 @@ class BaseViewer {
|
|||||||
const pagesCount = pdfDocument.numPages;
|
const pagesCount = pdfDocument.numPages;
|
||||||
const firstPagePromise = pdfDocument.getPage(1);
|
const firstPagePromise = pdfDocument.getPage(1);
|
||||||
|
|
||||||
|
const annotationStorage = pdfDocument.annotationStorage;
|
||||||
|
|
||||||
this._pagesCapability.promise.then(() => {
|
this._pagesCapability.promise.then(() => {
|
||||||
this.eventBus.dispatch("pagesloaded", {
|
this.eventBus.dispatch("pagesloaded", {
|
||||||
source: this,
|
source: this,
|
||||||
@ -481,6 +483,7 @@ class BaseViewer {
|
|||||||
eventBus: this.eventBus,
|
eventBus: this.eventBus,
|
||||||
id: pageNum,
|
id: pageNum,
|
||||||
scale,
|
scale,
|
||||||
|
annotationStorage,
|
||||||
defaultViewport: viewport.clone(),
|
defaultViewport: viewport.clone(),
|
||||||
renderingQueue: this.renderingQueue,
|
renderingQueue: this.renderingQueue,
|
||||||
textLayerFactory,
|
textLayerFactory,
|
||||||
@ -1153,6 +1156,7 @@ class BaseViewer {
|
|||||||
createAnnotationLayerBuilder(
|
createAnnotationLayerBuilder(
|
||||||
pageDiv,
|
pageDiv,
|
||||||
pdfPage,
|
pdfPage,
|
||||||
|
annotationStorage = null,
|
||||||
imageResourcesPath = "",
|
imageResourcesPath = "",
|
||||||
renderInteractiveForms = false,
|
renderInteractiveForms = false,
|
||||||
l10n = NullL10n
|
l10n = NullL10n
|
||||||
@ -1160,11 +1164,11 @@ class BaseViewer {
|
|||||||
return new AnnotationLayerBuilder({
|
return new AnnotationLayerBuilder({
|
||||||
pageDiv,
|
pageDiv,
|
||||||
pdfPage,
|
pdfPage,
|
||||||
|
annotationStorage,
|
||||||
imageResourcesPath,
|
imageResourcesPath,
|
||||||
renderInteractiveForms,
|
renderInteractiveForms,
|
||||||
linkService: this.linkService,
|
linkService: this.linkService,
|
||||||
downloadManager: this.downloadManager,
|
downloadManager: this.downloadManager,
|
||||||
annotationStorage: this.pdfDocument.annotationStorage,
|
|
||||||
l10n,
|
l10n,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,8 @@ class IPDFAnnotationLayerFactory {
|
|||||||
/**
|
/**
|
||||||
* @param {HTMLDivElement} pageDiv
|
* @param {HTMLDivElement} pageDiv
|
||||||
* @param {PDFPage} pdfPage
|
* @param {PDFPage} pdfPage
|
||||||
* @param {AnnotationStorage} [annotationStorage]
|
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation
|
||||||
|
* data in forms.
|
||||||
* @param {string} [imageResourcesPath] - Path for image resources, mainly
|
* @param {string} [imageResourcesPath] - Path for image resources, mainly
|
||||||
* for annotation icons. Include trailing slash.
|
* for annotation icons. Include trailing slash.
|
||||||
* @param {boolean} renderInteractiveForms
|
* @param {boolean} renderInteractiveForms
|
||||||
|
@ -38,6 +38,8 @@ import { viewerCompatibilityParams } from "./viewer_compatibility.js";
|
|||||||
* @property {number} id - The page unique ID (normally its number).
|
* @property {number} id - The page unique ID (normally its number).
|
||||||
* @property {number} scale - The page scale display.
|
* @property {number} scale - The page scale display.
|
||||||
* @property {PageViewport} defaultViewport - The page viewport.
|
* @property {PageViewport} defaultViewport - The page viewport.
|
||||||
|
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
|
||||||
|
* data in forms. The default value is `null`.
|
||||||
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
||||||
* @property {IPDFTextLayerFactory} textLayerFactory
|
* @property {IPDFTextLayerFactory} textLayerFactory
|
||||||
* @property {number} [textLayerMode] - Controls if the text layer used for
|
* @property {number} [textLayerMode] - Controls if the text layer used for
|
||||||
@ -81,6 +83,7 @@ class PDFPageView {
|
|||||||
this.rotation = 0;
|
this.rotation = 0;
|
||||||
this.scale = options.scale || DEFAULT_SCALE;
|
this.scale = options.scale || DEFAULT_SCALE;
|
||||||
this.viewport = defaultViewport;
|
this.viewport = defaultViewport;
|
||||||
|
this._annotationStorage = options.annotationStorage || null;
|
||||||
this.pdfPageRotate = defaultViewport.rotation;
|
this.pdfPageRotate = defaultViewport.rotation;
|
||||||
this.hasRestrictedScaling = false;
|
this.hasRestrictedScaling = false;
|
||||||
this.textLayerMode = Number.isInteger(options.textLayerMode)
|
this.textLayerMode = Number.isInteger(options.textLayerMode)
|
||||||
@ -533,6 +536,7 @@ class PDFPageView {
|
|||||||
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(
|
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(
|
||||||
div,
|
div,
|
||||||
pdfPage,
|
pdfPage,
|
||||||
|
this._annotationStorage,
|
||||||
this.imageResourcesPath,
|
this.imageResourcesPath,
|
||||||
this.renderInteractiveForms,
|
this.renderInteractiveForms,
|
||||||
this.l10n
|
this.l10n
|
||||||
|
Loading…
Reference in New Issue
Block a user