Move the Default{...}LayerFactory into a new web/default_factory.js file

This patch, first of all, removes circular dependencies in the TypeScript definitions. Secondly, it also moves `RenderingStates` into `web/ui_utils.js` to break another type-dependency and directly use the `XfaLayerBuilder` during XFA-printing.
Finally, note that this patch *slightly* reduces the size of the default viewer (e.g. in the `MOZCENTRAL` build) by not having to bundle code which is completely unused.
This commit is contained in:
Jonas Jenwald 2021-12-15 13:54:29 +01:00
parent e0dba504d2
commit e19020c028
21 changed files with 221 additions and 186 deletions

View file

@ -15,10 +15,8 @@
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
// eslint-disable-next-line max-len
/** @typedef {import("./interfaces").IPDFTextLayerFactory} IPDFTextLayerFactory */
/** @typedef {import("./event_utils").EventBus} EventBus */
/** @typedef {import("./text_highlighter").TextHighlighter} TextHighlighter */
/** @typedef {import("./ui_utils").EventBus} EventBus */
import { renderTextLayer } from "pdfjs-lib";
@ -221,36 +219,4 @@ class TextLayerBuilder {
}
}
/**
* @implements IPDFTextLayerFactory
*/
class DefaultTextLayerFactory {
/**
* @param {HTMLDivElement} textLayerDiv
* @param {number} pageIndex
* @param {PageViewport} viewport
* @param {boolean} enhanceTextSelection
* @param {EventBus} eventBus
* @param {TextHighlighter} highlighter
* @returns {TextLayerBuilder}
*/
createTextLayerBuilder(
textLayerDiv,
pageIndex,
viewport,
enhanceTextSelection = false,
eventBus,
highlighter
) {
return new TextLayerBuilder({
textLayerDiv,
pageIndex,
viewport,
enhanceTextSelection,
eventBus,
highlighter,
});
}
}
export { DefaultTextLayerFactory, TextLayerBuilder };
export { TextLayerBuilder };