pdf.js update
This commit is contained in:
parent
9e464a1d63
commit
8b60075f39
13 changed files with 611 additions and 652 deletions
|
@ -448,8 +448,8 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||||
<button id="documentPropertiesClose" class="dialogButton"><span data-l10n-id="pdfjs-document-properties-close-button">Close</span></button>
|
<button id="documentPropertiesClose" class="dialogButton"><span data-l10n-id="pdfjs-document-properties-close-button">Close</span></button>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
<dialog id="altTextDialog" aria-labelledby="dialogLabel" aria-describedby="dialogDescription">
|
<dialog class="dialog altText" id="altTextDialog" aria-labelledby="dialogLabel" aria-describedby="dialogDescription">
|
||||||
<div id="altTextContainer">
|
<div id="altTextContainer" class="mainContainer">
|
||||||
<div id="overallDescription">
|
<div id="overallDescription">
|
||||||
<span id="dialogLabel" data-l10n-id="pdfjs-editor-alt-text-dialog-label" class="title">Choose an option</span>
|
<span id="dialogLabel" data-l10n-id="pdfjs-editor-alt-text-dialog-label" class="title">Choose an option</span>
|
||||||
<span id="dialogDescription" data-l10n-id="pdfjs-editor-alt-text-dialog-description">
|
<span id="dialogDescription" data-l10n-id="pdfjs-editor-alt-text-dialog-description">
|
||||||
|
@ -486,8 +486,8 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="buttons">
|
<div id="buttons">
|
||||||
<button id="altTextCancel" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-cancel-button">Cancel</span></button>
|
<button id="altTextCancel" class="secondaryButton" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-cancel-button">Cancel</span></button>
|
||||||
<button id="altTextSave" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-save-button">Save</span></button>
|
<button id="altTextSave" class="primaryButton" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-save-button">Save</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
|
@ -51,12 +51,6 @@ pdfjs-download-button-label = Discargar
|
||||||
pdfjs-bookmark-button =
|
pdfjs-bookmark-button =
|
||||||
.title = Pagina actual (vide le URL del pagina actual)
|
.title = Pagina actual (vide le URL del pagina actual)
|
||||||
pdfjs-bookmark-button-label = Pagina actual
|
pdfjs-bookmark-button-label = Pagina actual
|
||||||
# Used in Firefox for Android.
|
|
||||||
pdfjs-open-in-app-button =
|
|
||||||
.title = Aperir in app
|
|
||||||
# Used in Firefox for Android.
|
|
||||||
# Length of the translation matters since we are in a mobile context, with limited screen estate.
|
|
||||||
pdfjs-open-in-app-button-label = Aperir in app
|
|
||||||
|
|
||||||
## Secondary toolbar and context menu
|
## Secondary toolbar and context menu
|
||||||
|
|
||||||
|
@ -67,8 +61,8 @@ pdfjs-first-page-button =
|
||||||
.title = Ir al prime pagina
|
.title = Ir al prime pagina
|
||||||
pdfjs-first-page-button-label = Ir al prime pagina
|
pdfjs-first-page-button-label = Ir al prime pagina
|
||||||
pdfjs-last-page-button =
|
pdfjs-last-page-button =
|
||||||
.title = Ir al prime pagina
|
.title = Ir al ultime pagina
|
||||||
pdfjs-last-page-button-label = Ir al prime pagina
|
pdfjs-last-page-button-label = Ir al ultime pagina
|
||||||
pdfjs-page-rotate-cw-button =
|
pdfjs-page-rotate-cw-button =
|
||||||
.title = Rotar in senso horari
|
.title = Rotar in senso horari
|
||||||
pdfjs-page-rotate-cw-button-label = Rotar in senso horari
|
pdfjs-page-rotate-cw-button-label = Rotar in senso horari
|
||||||
|
@ -304,8 +298,6 @@ pdfjs-editor-stamp-button-label = Adder o rediger imagines
|
||||||
pdfjs-editor-highlight-button =
|
pdfjs-editor-highlight-button =
|
||||||
.title = Evidentia
|
.title = Evidentia
|
||||||
pdfjs-editor-highlight-button-label = Evidentia
|
pdfjs-editor-highlight-button-label = Evidentia
|
||||||
pdfjs-highlight-floating-button =
|
|
||||||
.title = Evidentiar
|
|
||||||
pdfjs-highlight-floating-button1 =
|
pdfjs-highlight-floating-button1 =
|
||||||
.title = Evidentiar
|
.title = Evidentiar
|
||||||
.aria-label = Evidentiar
|
.aria-label = Evidentiar
|
||||||
|
|
|
@ -298,8 +298,6 @@ pdfjs-editor-stamp-button-label = 画像を追加または編集
|
||||||
pdfjs-editor-highlight-button =
|
pdfjs-editor-highlight-button =
|
||||||
.title = 強調します
|
.title = 強調します
|
||||||
pdfjs-editor-highlight-button-label = 強調
|
pdfjs-editor-highlight-button-label = 強調
|
||||||
pdfjs-highlight-floating-button =
|
|
||||||
.title = 強調
|
|
||||||
pdfjs-highlight-floating-button1 =
|
pdfjs-highlight-floating-button1 =
|
||||||
.title = 強調
|
.title = 強調
|
||||||
.aria-label = 強調します
|
.aria-label = 強調します
|
||||||
|
|
|
@ -51,12 +51,6 @@ pdfjs-download-button-label = Last ned
|
||||||
pdfjs-bookmark-button =
|
pdfjs-bookmark-button =
|
||||||
.title = Gjeldande side (sjå URL frå gjeldande side)
|
.title = Gjeldande side (sjå URL frå gjeldande side)
|
||||||
pdfjs-bookmark-button-label = Gjeldande side
|
pdfjs-bookmark-button-label = Gjeldande side
|
||||||
# Used in Firefox for Android.
|
|
||||||
pdfjs-open-in-app-button =
|
|
||||||
.title = Opne i app
|
|
||||||
# Used in Firefox for Android.
|
|
||||||
# Length of the translation matters since we are in a mobile context, with limited screen estate.
|
|
||||||
pdfjs-open-in-app-button-label = Opne i app
|
|
||||||
|
|
||||||
## Secondary toolbar and context menu
|
## Secondary toolbar and context menu
|
||||||
|
|
||||||
|
@ -301,9 +295,24 @@ pdfjs-editor-ink-button-label = Teikne
|
||||||
pdfjs-editor-stamp-button =
|
pdfjs-editor-stamp-button =
|
||||||
.title = Legg til eller rediger bilde
|
.title = Legg til eller rediger bilde
|
||||||
pdfjs-editor-stamp-button-label = Legg til eller rediger bilde
|
pdfjs-editor-stamp-button-label = Legg til eller rediger bilde
|
||||||
|
pdfjs-editor-highlight-button =
|
||||||
|
.title = Markere
|
||||||
|
pdfjs-editor-highlight-button-label = Markere
|
||||||
|
pdfjs-highlight-floating-button1 =
|
||||||
|
.title = Markere
|
||||||
|
.aria-label = Markere
|
||||||
|
pdfjs-highlight-floating-button-label = Markere
|
||||||
|
|
||||||
## Remove button for the various kind of editor.
|
## Remove button for the various kind of editor.
|
||||||
|
|
||||||
|
pdfjs-editor-remove-ink-button =
|
||||||
|
.title = Fjern teikninga
|
||||||
|
pdfjs-editor-remove-freetext-button =
|
||||||
|
.title = Fjern tekst
|
||||||
|
pdfjs-editor-remove-stamp-button =
|
||||||
|
.title = Fjern bildet
|
||||||
|
pdfjs-editor-remove-highlight-button =
|
||||||
|
.title = Fjern utheving
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -316,6 +325,8 @@ pdfjs-editor-ink-opacity-input = Ugjennomskinleg
|
||||||
pdfjs-editor-stamp-add-image-button =
|
pdfjs-editor-stamp-add-image-button =
|
||||||
.title = Legg til bilde
|
.title = Legg til bilde
|
||||||
pdfjs-editor-stamp-add-image-button-label = Legg til bilde
|
pdfjs-editor-stamp-add-image-button-label = Legg til bilde
|
||||||
|
# This refers to the thickness of the line used for free highlighting (not bound to text)
|
||||||
|
pdfjs-editor-free-highlight-thickness-input = Tjukkleik
|
||||||
pdfjs-free-text =
|
pdfjs-free-text =
|
||||||
.aria-label = Tekstredigering
|
.aria-label = Tekstredigering
|
||||||
pdfjs-free-text-default-content = Byrje å skrive…
|
pdfjs-free-text-default-content = Byrje å skrive…
|
||||||
|
@ -348,6 +359,10 @@ pdfjs-editor-alt-text-textarea =
|
||||||
|
|
||||||
## Color picker
|
## Color picker
|
||||||
|
|
||||||
|
pdfjs-editor-colorpicker-button =
|
||||||
|
.title = Endre farge
|
||||||
|
pdfjs-editor-colorpicker-dropdown =
|
||||||
|
.aria-label = Fargeval
|
||||||
pdfjs-editor-colorpicker-yellow =
|
pdfjs-editor-colorpicker-yellow =
|
||||||
.title = Gul
|
.title = Gul
|
||||||
pdfjs-editor-colorpicker-green =
|
pdfjs-editor-colorpicker-green =
|
||||||
|
@ -358,3 +373,10 @@ pdfjs-editor-colorpicker-pink =
|
||||||
.title = Rosa
|
.title = Rosa
|
||||||
pdfjs-editor-colorpicker-red =
|
pdfjs-editor-colorpicker-red =
|
||||||
.title = Raud
|
.title = Raud
|
||||||
|
|
||||||
|
## Show all highlights
|
||||||
|
## This is a toggle button to show/hide all the highlights.
|
||||||
|
|
||||||
|
pdfjs-editor-highlight-show-all-button-label = Vis alle
|
||||||
|
pdfjs-editor-highlight-show-all-button =
|
||||||
|
.title = Vis alle
|
||||||
|
|
|
@ -302,6 +302,10 @@ pdfjs-editor-stamp-button-label = Dodajanje ali urejanje slik
|
||||||
pdfjs-editor-highlight-button =
|
pdfjs-editor-highlight-button =
|
||||||
.title = Označevalnik
|
.title = Označevalnik
|
||||||
pdfjs-editor-highlight-button-label = Označevalnik
|
pdfjs-editor-highlight-button-label = Označevalnik
|
||||||
|
pdfjs-highlight-floating-button1 =
|
||||||
|
.title = Označi
|
||||||
|
.aria-label = Označi
|
||||||
|
pdfjs-highlight-floating-button-label = Označi
|
||||||
|
|
||||||
## Remove button for the various kind of editor.
|
## Remove button for the various kind of editor.
|
||||||
|
|
||||||
|
|
|
@ -10217,7 +10217,7 @@ class TextLayer {
|
||||||
#textDivProperties = new WeakMap();
|
#textDivProperties = new WeakMap();
|
||||||
#transform = null;
|
#transform = null;
|
||||||
static #ascentCache = new Map();
|
static #ascentCache = new Map();
|
||||||
static #canvasCtx = null;
|
static #canvasContexts = new Map();
|
||||||
static #pendingTextLayers = new Set();
|
static #pendingTextLayers = new Set();
|
||||||
constructor({
|
constructor({
|
||||||
textContentSource,
|
textContentSource,
|
||||||
|
@ -10256,7 +10256,6 @@ class TextLayer {
|
||||||
this.#pageWidth = pageWidth;
|
this.#pageWidth = pageWidth;
|
||||||
this.#pageHeight = pageHeight;
|
this.#pageHeight = pageHeight;
|
||||||
setLayerDimensions(container, viewport);
|
setLayerDimensions(container, viewport);
|
||||||
TextLayer.#pendingTextLayers.add(this);
|
|
||||||
this.#capability.promise.catch(() => {}).then(() => {
|
this.#capability.promise.catch(() => {}).then(() => {
|
||||||
TextLayer.#pendingTextLayers.delete(this);
|
TextLayer.#pendingTextLayers.delete(this);
|
||||||
this.#layoutTextParams = null;
|
this.#layoutTextParams = null;
|
||||||
|
@ -10280,6 +10279,7 @@ class TextLayer {
|
||||||
}, this.#capability.reject);
|
}, this.#capability.reject);
|
||||||
};
|
};
|
||||||
this.#reader = this.#textContentSource.getReader();
|
this.#reader = this.#textContentSource.getReader();
|
||||||
|
TextLayer.#pendingTextLayers.add(this);
|
||||||
pump();
|
pump();
|
||||||
return this.#capability.promise;
|
return this.#capability.promise;
|
||||||
}
|
}
|
||||||
|
@ -10474,19 +10474,26 @@ class TextLayer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.#ascentCache.clear();
|
this.#ascentCache.clear();
|
||||||
this.#canvasCtx?.canvas.remove();
|
for (const {
|
||||||
this.#canvasCtx = null;
|
canvas
|
||||||
|
} of this.#canvasContexts.values()) {
|
||||||
|
canvas.remove();
|
||||||
|
}
|
||||||
|
this.#canvasContexts.clear();
|
||||||
}
|
}
|
||||||
static #getCtx(lang = null) {
|
static #getCtx(lang = null) {
|
||||||
if (!this.#canvasCtx) {
|
let canvasContext = this.#canvasContexts.get(lang ||= "");
|
||||||
|
if (!canvasContext) {
|
||||||
const canvas = document.createElement("canvas");
|
const canvas = document.createElement("canvas");
|
||||||
canvas.className = "hiddenCanvasElement";
|
canvas.className = "hiddenCanvasElement";
|
||||||
|
canvas.lang = lang;
|
||||||
document.body.append(canvas);
|
document.body.append(canvas);
|
||||||
this.#canvasCtx = canvas.getContext("2d", {
|
canvasContext = canvas.getContext("2d", {
|
||||||
alpha: false
|
alpha: false
|
||||||
});
|
});
|
||||||
|
this.#canvasContexts.set(lang, canvasContext);
|
||||||
}
|
}
|
||||||
return this.#canvasCtx;
|
return canvasContext;
|
||||||
}
|
}
|
||||||
static #getAscent(fontFamily, lang) {
|
static #getAscent(fontFamily, lang) {
|
||||||
const cachedAscent = this.#ascentCache.get(fontFamily);
|
const cachedAscent = this.#ascentCache.get(fontFamily);
|
||||||
|
@ -10717,7 +10724,7 @@ function getDocument(src) {
|
||||||
}
|
}
|
||||||
const docParams = {
|
const docParams = {
|
||||||
docId,
|
docId,
|
||||||
apiVersion: "4.3.98",
|
apiVersion: "4.4.11",
|
||||||
data,
|
data,
|
||||||
password,
|
password,
|
||||||
disableAutoFetch,
|
disableAutoFetch,
|
||||||
|
@ -10741,11 +10748,13 @@ function getDocument(src) {
|
||||||
const transportParams = {
|
const transportParams = {
|
||||||
disableFontFace,
|
disableFontFace,
|
||||||
fontExtraProperties,
|
fontExtraProperties,
|
||||||
enableXfa,
|
|
||||||
ownerDocument,
|
ownerDocument,
|
||||||
disableAutoFetch,
|
|
||||||
pdfBug,
|
pdfBug,
|
||||||
styleElement
|
styleElement,
|
||||||
|
loadingParams: {
|
||||||
|
disableAutoFetch,
|
||||||
|
enableXfa
|
||||||
|
}
|
||||||
};
|
};
|
||||||
worker.promise.then(function () {
|
worker.promise.then(function () {
|
||||||
if (task.destroyed) {
|
if (task.destroyed) {
|
||||||
|
@ -11729,6 +11738,7 @@ class WorkerTransport {
|
||||||
ownerDocument: params.ownerDocument,
|
ownerDocument: params.ownerDocument,
|
||||||
styleElement: params.styleElement
|
styleElement: params.styleElement
|
||||||
});
|
});
|
||||||
|
this.loadingParams = params.loadingParams;
|
||||||
this._params = params;
|
this._params = params;
|
||||||
this.canvasFactory = factory.canvasFactory;
|
this.canvasFactory = factory.canvasFactory;
|
||||||
this.filterFactory = factory.filterFactory;
|
this.filterFactory = factory.filterFactory;
|
||||||
|
@ -12270,16 +12280,6 @@ class WorkerTransport {
|
||||||
const refStr = ref.gen === 0 ? `${ref.num}R` : `${ref.num}R${ref.gen}`;
|
const refStr = ref.gen === 0 ? `${ref.num}R` : `${ref.num}R${ref.gen}`;
|
||||||
return this.#pageRefCache.get(refStr) ?? null;
|
return this.#pageRefCache.get(refStr) ?? null;
|
||||||
}
|
}
|
||||||
get loadingParams() {
|
|
||||||
const {
|
|
||||||
disableAutoFetch,
|
|
||||||
enableXfa
|
|
||||||
} = this._params;
|
|
||||||
return shadow(this, "loadingParams", {
|
|
||||||
disableAutoFetch,
|
|
||||||
enableXfa
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const INITIAL_DATA = Symbol("INITIAL_DATA");
|
const INITIAL_DATA = Symbol("INITIAL_DATA");
|
||||||
class PDFObjects {
|
class PDFObjects {
|
||||||
|
@ -12491,8 +12491,8 @@ class InternalRenderTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const version = "4.3.98";
|
const version = "4.4.11";
|
||||||
const build = "8dba041e6";
|
const build = "d76501a0c";
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./src/shared/scripting_utils.js
|
;// CONCATENATED MODULE: ./src/shared/scripting_utils.js
|
||||||
function makeColorComp(n) {
|
function makeColorComp(n) {
|
||||||
|
@ -13175,15 +13175,9 @@ class AnnotationElement {
|
||||||
if (!quadPoints) {
|
if (!quadPoints) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect;
|
const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect.map(x => Math.fround(x));
|
||||||
if (quadPoints.length === 1) {
|
if (quadPoints.length === 8) {
|
||||||
const [, {
|
const [trX, trY, blX, blY] = quadPoints.subarray(2, 6);
|
||||||
x: trX,
|
|
||||||
y: trY
|
|
||||||
}, {
|
|
||||||
x: blX,
|
|
||||||
y: blY
|
|
||||||
}] = quadPoints[0];
|
|
||||||
if (rectTrX === trX && rectTrY === trY && rectBlX === blX && rectBlY === blY) {
|
if (rectTrX === trX && rectTrY === trY && rectBlX === blX && rectBlY === blY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13217,13 +13211,11 @@ class AnnotationElement {
|
||||||
clipPath.setAttribute("id", id);
|
clipPath.setAttribute("id", id);
|
||||||
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
|
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
|
||||||
defs.append(clipPath);
|
defs.append(clipPath);
|
||||||
for (const [, {
|
for (let i = 2, ii = quadPoints.length; i < ii; i += 8) {
|
||||||
x: trX,
|
const trX = quadPoints[i];
|
||||||
y: trY
|
const trY = quadPoints[i + 1];
|
||||||
}, {
|
const blX = quadPoints[i + 2];
|
||||||
x: blX,
|
const blY = quadPoints[i + 3];
|
||||||
y: blY
|
|
||||||
}] of quadPoints) {
|
|
||||||
const rect = svgFactory.createElement("rect");
|
const rect = svgFactory.createElement("rect");
|
||||||
const x = (blX - rectBlX) / width;
|
const x = (blX - rectBlX) / width;
|
||||||
const y = (rectTrY - trY) / height;
|
const y = (rectTrY - trY) / height;
|
||||||
|
@ -14936,27 +14928,37 @@ class PolylineAnnotationElement extends AnnotationElement {
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
this.container.classList.add(this.containerClassName);
|
this.container.classList.add(this.containerClassName);
|
||||||
const data = this.data;
|
const {
|
||||||
|
data: {
|
||||||
|
rect,
|
||||||
|
vertices,
|
||||||
|
borderStyle,
|
||||||
|
popupRef
|
||||||
|
}
|
||||||
|
} = this;
|
||||||
|
if (!vertices) {
|
||||||
|
return this.container;
|
||||||
|
}
|
||||||
const {
|
const {
|
||||||
width,
|
width,
|
||||||
height
|
height
|
||||||
} = getRectDims(data.rect);
|
} = getRectDims(rect);
|
||||||
const svg = this.svgFactory.create(width, height, true);
|
const svg = this.svgFactory.create(width, height, true);
|
||||||
let points = [];
|
let points = [];
|
||||||
for (const coordinate of data.vertices) {
|
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
|
||||||
const x = coordinate.x - data.rect[0];
|
const x = vertices[i] - rect[0];
|
||||||
const y = data.rect[3] - coordinate.y;
|
const y = rect[3] - vertices[i + 1];
|
||||||
points.push(x + "," + y);
|
points.push(`${x},${y}`);
|
||||||
}
|
}
|
||||||
points = points.join(" ");
|
points = points.join(" ");
|
||||||
const polyline = this.#polyline = this.svgFactory.createElement(this.svgElementName);
|
const polyline = this.#polyline = this.svgFactory.createElement(this.svgElementName);
|
||||||
polyline.setAttribute("points", points);
|
polyline.setAttribute("points", points);
|
||||||
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
|
polyline.setAttribute("stroke-width", borderStyle.width || 1);
|
||||||
polyline.setAttribute("stroke", "transparent");
|
polyline.setAttribute("stroke", "transparent");
|
||||||
polyline.setAttribute("fill", "transparent");
|
polyline.setAttribute("fill", "transparent");
|
||||||
svg.append(polyline);
|
svg.append(polyline);
|
||||||
this.container.append(svg);
|
this.container.append(svg);
|
||||||
if (!data.popupRef && this.hasPopupData) {
|
if (!popupRef && this.hasPopupData) {
|
||||||
this._createPopup();
|
this._createPopup();
|
||||||
}
|
}
|
||||||
return this.container;
|
return this.container;
|
||||||
|
@ -15003,27 +15005,34 @@ class InkAnnotationElement extends AnnotationElement {
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
this.container.classList.add(this.containerClassName);
|
this.container.classList.add(this.containerClassName);
|
||||||
const data = this.data;
|
const {
|
||||||
|
data: {
|
||||||
|
rect,
|
||||||
|
inkLists,
|
||||||
|
borderStyle,
|
||||||
|
popupRef
|
||||||
|
}
|
||||||
|
} = this;
|
||||||
const {
|
const {
|
||||||
width,
|
width,
|
||||||
height
|
height
|
||||||
} = getRectDims(data.rect);
|
} = getRectDims(rect);
|
||||||
const svg = this.svgFactory.create(width, height, true);
|
const svg = this.svgFactory.create(width, height, true);
|
||||||
for (const inkList of data.inkLists) {
|
for (const inkList of inkLists) {
|
||||||
let points = [];
|
let points = [];
|
||||||
for (const coordinate of inkList) {
|
for (let i = 0, ii = inkList.length; i < ii; i += 2) {
|
||||||
const x = coordinate.x - data.rect[0];
|
const x = inkList[i] - rect[0];
|
||||||
const y = data.rect[3] - coordinate.y;
|
const y = rect[3] - inkList[i + 1];
|
||||||
points.push(`${x},${y}`);
|
points.push(`${x},${y}`);
|
||||||
}
|
}
|
||||||
points = points.join(" ");
|
points = points.join(" ");
|
||||||
const polyline = this.svgFactory.createElement(this.svgElementName);
|
const polyline = this.svgFactory.createElement(this.svgElementName);
|
||||||
this.#polylines.push(polyline);
|
this.#polylines.push(polyline);
|
||||||
polyline.setAttribute("points", points);
|
polyline.setAttribute("points", points);
|
||||||
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
|
polyline.setAttribute("stroke-width", borderStyle.width || 1);
|
||||||
polyline.setAttribute("stroke", "transparent");
|
polyline.setAttribute("stroke", "transparent");
|
||||||
polyline.setAttribute("fill", "transparent");
|
polyline.setAttribute("fill", "transparent");
|
||||||
if (!data.popupRef && this.hasPopupData) {
|
if (!popupRef && this.hasPopupData) {
|
||||||
this._createPopup();
|
this._createPopup();
|
||||||
}
|
}
|
||||||
svg.append(polyline);
|
svg.append(polyline);
|
||||||
|
@ -17225,7 +17234,7 @@ class HighlightEditor extends AnnotationEditor {
|
||||||
}
|
}
|
||||||
const [pageWidth, pageHeight] = this.pageDimensions;
|
const [pageWidth, pageHeight] = this.pageDimensions;
|
||||||
const boxes = this.#boxes;
|
const boxes = this.#boxes;
|
||||||
const quadPoints = new Array(boxes.length * 8);
|
const quadPoints = new Float32Array(boxes.length * 8);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (const {
|
for (const {
|
||||||
x,
|
x,
|
||||||
|
@ -19367,8 +19376,8 @@ class DrawLayer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const pdfjsVersion = "4.3.98";
|
const pdfjsVersion = "4.4.11";
|
||||||
const pdfjsBuild = "8dba041e6";
|
const pdfjsBuild = "d76501a0c";
|
||||||
|
|
||||||
var __webpack_exports__AbortException = __webpack_exports__.AbortException;
|
var __webpack_exports__AbortException = __webpack_exports__.AbortException;
|
||||||
var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;
|
var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -8930,11 +8930,10 @@ class Parser {
|
||||||
if (this.tryShift() && isCmd(this.buf2, "endstream")) {
|
if (this.tryShift() && isCmd(this.buf2, "endstream")) {
|
||||||
this.shift();
|
this.shift();
|
||||||
} else {
|
} else {
|
||||||
const actualLength = this.#findStreamLength(startPos);
|
length = this.#findStreamLength(startPos);
|
||||||
if (actualLength < 0) {
|
if (length < 0) {
|
||||||
throw new FormatError("Missing endstream command.");
|
throw new FormatError("Missing endstream command.");
|
||||||
}
|
}
|
||||||
length = actualLength;
|
|
||||||
lexer.nextChar();
|
lexer.nextChar();
|
||||||
this.shift();
|
this.shift();
|
||||||
this.shift();
|
this.shift();
|
||||||
|
@ -29696,7 +29695,7 @@ class PartialEvaluator {
|
||||||
this.globalImageCache = globalImageCache;
|
this.globalImageCache = globalImageCache;
|
||||||
this.systemFontCache = systemFontCache;
|
this.systemFontCache = systemFontCache;
|
||||||
this.options = options || DefaultPartialEvaluatorOptions;
|
this.options = options || DefaultPartialEvaluatorOptions;
|
||||||
this.parsingType3Font = false;
|
this.type3FontRefs = null;
|
||||||
this._regionalImageCache = new RegionalImageCache();
|
this._regionalImageCache = new RegionalImageCache();
|
||||||
this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
|
this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
|
||||||
ImageResizer.setMaxArea(this.options.canvasMaxAreaInBytes);
|
ImageResizer.setMaxArea(this.options.canvasMaxAreaInBytes);
|
||||||
|
@ -29708,6 +29707,9 @@ class PartialEvaluator {
|
||||||
});
|
});
|
||||||
return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
|
return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
|
||||||
}
|
}
|
||||||
|
get parsingType3Font() {
|
||||||
|
return !!this.type3FontRefs;
|
||||||
|
}
|
||||||
clone(newOptions = null) {
|
clone(newOptions = null) {
|
||||||
const newEvaluator = Object.create(this);
|
const newEvaluator = Object.create(this);
|
||||||
newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
|
newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
|
||||||
|
@ -30396,13 +30398,17 @@ class PartialEvaluator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fontRef) {
|
if (fontRef) {
|
||||||
if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
|
if (this.type3FontRefs?.has(fontRef)) {
|
||||||
return errorFont();
|
return errorFont();
|
||||||
}
|
}
|
||||||
if (this.fontCache.has(fontRef)) {
|
if (this.fontCache.has(fontRef)) {
|
||||||
return this.fontCache.get(fontRef);
|
return this.fontCache.get(fontRef);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
font = this.xref.fetchIfRef(fontRef);
|
font = this.xref.fetchIfRef(fontRef);
|
||||||
|
} catch (ex) {
|
||||||
|
warn(`loadFont - lookup failed: "${ex}".`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!(font instanceof Dict)) {
|
if (!(font instanceof Dict)) {
|
||||||
if (!this.options.ignoreErrors && !this.parsingType3Font) {
|
if (!this.options.ignoreErrors && !this.parsingType3Font) {
|
||||||
|
@ -32827,7 +32833,6 @@ class TranslatedFont {
|
||||||
const type3Evaluator = evaluator.clone({
|
const type3Evaluator = evaluator.clone({
|
||||||
ignoreErrors: false
|
ignoreErrors: false
|
||||||
});
|
});
|
||||||
type3Evaluator.parsingType3Font = true;
|
|
||||||
const type3FontRefs = new RefSet(evaluator.type3FontRefs);
|
const type3FontRefs = new RefSet(evaluator.type3FontRefs);
|
||||||
if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
|
if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
|
||||||
type3FontRefs.put(this.dict.objId);
|
type3FontRefs.put(this.dict.objId);
|
||||||
|
@ -49607,38 +49612,19 @@ function getQuadPoints(dict, rect) {
|
||||||
if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
|
if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const quadPointsLists = [];
|
const newQuadPoints = new Float32Array(quadPoints.length);
|
||||||
for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
|
for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
|
||||||
let minX = Infinity,
|
const [x1, y1, x2, y2, x3, y3, x4, y4] = quadPoints.slice(i, i + 8);
|
||||||
maxX = -Infinity,
|
const minX = Math.min(x1, x2, x3, x4);
|
||||||
minY = Infinity,
|
const maxX = Math.max(x1, x2, x3, x4);
|
||||||
maxY = -Infinity;
|
const minY = Math.min(y1, y2, y3, y4);
|
||||||
for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
|
const maxY = Math.max(y1, y2, y3, y4);
|
||||||
const x = quadPoints[j];
|
|
||||||
const y = quadPoints[j + 1];
|
|
||||||
minX = Math.min(x, minX);
|
|
||||||
maxX = Math.max(x, maxX);
|
|
||||||
minY = Math.min(y, minY);
|
|
||||||
maxY = Math.max(y, maxY);
|
|
||||||
}
|
|
||||||
if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
|
if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
quadPointsLists.push([{
|
newQuadPoints.set([minX, maxY, maxX, maxY, minX, minY, maxX, minY], i);
|
||||||
x: minX,
|
|
||||||
y: maxY
|
|
||||||
}, {
|
|
||||||
x: maxX,
|
|
||||||
y: maxY
|
|
||||||
}, {
|
|
||||||
x: minX,
|
|
||||||
y: minY
|
|
||||||
}, {
|
|
||||||
x: maxX,
|
|
||||||
y: minY
|
|
||||||
}]);
|
|
||||||
}
|
}
|
||||||
return quadPointsLists;
|
return newQuadPoints;
|
||||||
}
|
}
|
||||||
function getTransformMatrix(rect, bbox, matrix) {
|
function getTransformMatrix(rect, bbox, matrix) {
|
||||||
const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox(bbox, matrix);
|
const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox(bbox, matrix);
|
||||||
|
@ -50264,22 +50250,10 @@ class MarkupAnnotation extends Annotation {
|
||||||
}
|
}
|
||||||
let pointsArray = this.data.quadPoints;
|
let pointsArray = this.data.quadPoints;
|
||||||
if (!pointsArray) {
|
if (!pointsArray) {
|
||||||
pointsArray = [[{
|
pointsArray = Float32Array.from([this.rectangle[0], this.rectangle[3], this.rectangle[2], this.rectangle[3], this.rectangle[0], this.rectangle[1], this.rectangle[2], this.rectangle[1]]);
|
||||||
x: this.rectangle[0],
|
|
||||||
y: this.rectangle[3]
|
|
||||||
}, {
|
|
||||||
x: this.rectangle[2],
|
|
||||||
y: this.rectangle[3]
|
|
||||||
}, {
|
|
||||||
x: this.rectangle[0],
|
|
||||||
y: this.rectangle[1]
|
|
||||||
}, {
|
|
||||||
x: this.rectangle[2],
|
|
||||||
y: this.rectangle[1]
|
|
||||||
}]];
|
|
||||||
}
|
}
|
||||||
for (const points of pointsArray) {
|
for (let i = 0, ii = pointsArray.length; i < ii; i += 8) {
|
||||||
const [mX, MX, mY, MY] = pointsCallback(buffer, points);
|
const [mX, MX, mY, MY] = pointsCallback(buffer, pointsArray.subarray(i, i + 8));
|
||||||
minX = Math.min(minX, mX);
|
minX = Math.min(minX, mX);
|
||||||
maxX = Math.max(maxX, MX);
|
maxX = Math.max(maxX, MX);
|
||||||
minY = Math.min(minY, mY);
|
minY = Math.min(minY, mY);
|
||||||
|
@ -51930,7 +51904,7 @@ class LineAnnotation extends MarkupAnnotation {
|
||||||
fillAlpha,
|
fillAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
|
buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
|
||||||
return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
|
return [points[0] - borderWidth, points[2] + borderWidth, points[7] - borderWidth, points[3] + borderWidth];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -51963,17 +51937,17 @@ class SquareAnnotation extends MarkupAnnotation {
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
fillAlpha,
|
fillAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
const x = points[2].x + this.borderStyle.width / 2;
|
const x = points[4] + this.borderStyle.width / 2;
|
||||||
const y = points[2].y + this.borderStyle.width / 2;
|
const y = points[5] + this.borderStyle.width / 2;
|
||||||
const width = points[3].x - points[2].x - this.borderStyle.width;
|
const width = points[6] - points[4] - this.borderStyle.width;
|
||||||
const height = points[1].y - points[3].y - this.borderStyle.width;
|
const height = points[3] - points[7] - this.borderStyle.width;
|
||||||
buffer.push(`${x} ${y} ${width} ${height} re`);
|
buffer.push(`${x} ${y} ${width} ${height} re`);
|
||||||
if (fillColor) {
|
if (fillColor) {
|
||||||
buffer.push("B");
|
buffer.push("B");
|
||||||
} else {
|
} else {
|
||||||
buffer.push("S");
|
buffer.push("S");
|
||||||
}
|
}
|
||||||
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
return [points[0], points[2], points[7], points[3]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52005,10 +51979,10 @@ class CircleAnnotation extends MarkupAnnotation {
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
fillAlpha,
|
fillAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
const x0 = points[0].x + this.borderStyle.width / 2;
|
const x0 = points[0] + this.borderStyle.width / 2;
|
||||||
const y0 = points[0].y - this.borderStyle.width / 2;
|
const y0 = points[1] - this.borderStyle.width / 2;
|
||||||
const x1 = points[3].x - this.borderStyle.width / 2;
|
const x1 = points[6] - this.borderStyle.width / 2;
|
||||||
const y1 = points[3].y + this.borderStyle.width / 2;
|
const y1 = points[7] + this.borderStyle.width / 2;
|
||||||
const xMid = x0 + (x1 - x0) / 2;
|
const xMid = x0 + (x1 - x0) / 2;
|
||||||
const yMid = y0 + (y1 - y0) / 2;
|
const yMid = y0 + (y1 - y0) / 2;
|
||||||
const xOffset = (x1 - x0) / 2 * controlPointsDistance;
|
const xOffset = (x1 - x0) / 2 * controlPointsDistance;
|
||||||
|
@ -52019,7 +51993,7 @@ class CircleAnnotation extends MarkupAnnotation {
|
||||||
} else {
|
} else {
|
||||||
buffer.push("S");
|
buffer.push("S");
|
||||||
}
|
}
|
||||||
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
return [points[0], points[2], points[7], points[3]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52035,7 +52009,7 @@ class PolylineAnnotation extends MarkupAnnotation {
|
||||||
this.data.annotationType = AnnotationType.POLYLINE;
|
this.data.annotationType = AnnotationType.POLYLINE;
|
||||||
this.data.hasOwnCanvas = this.data.noRotate;
|
this.data.hasOwnCanvas = this.data.noRotate;
|
||||||
this.data.noHTML = false;
|
this.data.noHTML = false;
|
||||||
this.data.vertices = [];
|
this.data.vertices = null;
|
||||||
if (!(this instanceof PolygonAnnotation)) {
|
if (!(this instanceof PolygonAnnotation)) {
|
||||||
this.setLineEndings(dict.getArray("LE"));
|
this.setLineEndings(dict.getArray("LE"));
|
||||||
this.data.lineEndings = this.lineEndings;
|
this.data.lineEndings = this.lineEndings;
|
||||||
|
@ -52044,23 +52018,18 @@ class PolylineAnnotation extends MarkupAnnotation {
|
||||||
if (!isNumberArray(rawVertices, null)) {
|
if (!isNumberArray(rawVertices, null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
|
const vertices = this.data.vertices = Float32Array.from(rawVertices);
|
||||||
this.data.vertices.push({
|
|
||||||
x: rawVertices[i],
|
|
||||||
y: rawVertices[i + 1]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!this.appearance) {
|
if (!this.appearance) {
|
||||||
const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
|
const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
|
||||||
const strokeAlpha = dict.get("CA");
|
const strokeAlpha = dict.get("CA");
|
||||||
const borderWidth = this.borderStyle.width || 1,
|
const borderWidth = this.borderStyle.width || 1,
|
||||||
borderAdjust = 2 * borderWidth;
|
borderAdjust = 2 * borderWidth;
|
||||||
const bbox = [Infinity, Infinity, -Infinity, -Infinity];
|
const bbox = [Infinity, Infinity, -Infinity, -Infinity];
|
||||||
for (const vertex of this.data.vertices) {
|
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
|
||||||
bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
|
bbox[0] = Math.min(bbox[0], vertices[i] - borderAdjust);
|
||||||
bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
|
bbox[1] = Math.min(bbox[1], vertices[i + 1] - borderAdjust);
|
||||||
bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
|
bbox[2] = Math.max(bbox[2], vertices[i] + borderAdjust);
|
||||||
bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
|
bbox[3] = Math.max(bbox[3], vertices[i + 1] + borderAdjust);
|
||||||
}
|
}
|
||||||
if (!Util.intersect(this.rectangle, bbox)) {
|
if (!Util.intersect(this.rectangle, bbox)) {
|
||||||
this.rectangle = bbox;
|
this.rectangle = bbox;
|
||||||
|
@ -52071,12 +52040,11 @@ class PolylineAnnotation extends MarkupAnnotation {
|
||||||
strokeColor,
|
strokeColor,
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
const vertices = this.data.vertices;
|
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
|
||||||
for (let i = 0, ii = vertices.length; i < ii; i++) {
|
buffer.push(`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`);
|
||||||
buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
|
|
||||||
}
|
}
|
||||||
buffer.push("S");
|
buffer.push("S");
|
||||||
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
return [points[0], points[2], points[7], points[3]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52110,18 +52078,17 @@ class InkAnnotation extends MarkupAnnotation {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
|
for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
|
||||||
this.data.inkLists.push([]);
|
|
||||||
if (!Array.isArray(rawInkLists[i])) {
|
if (!Array.isArray(rawInkLists[i])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const inkList = new Float32Array(rawInkLists[i].length);
|
||||||
|
this.data.inkLists.push(inkList);
|
||||||
for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
|
for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
|
||||||
const x = xref.fetchIfRef(rawInkLists[i][j]),
|
const x = xref.fetchIfRef(rawInkLists[i][j]),
|
||||||
y = xref.fetchIfRef(rawInkLists[i][j + 1]);
|
y = xref.fetchIfRef(rawInkLists[i][j + 1]);
|
||||||
if (typeof x === "number" && typeof y === "number") {
|
if (typeof x === "number" && typeof y === "number") {
|
||||||
this.data.inkLists[i].push({
|
inkList[j] = x;
|
||||||
x,
|
inkList[j + 1] = y;
|
||||||
y
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52131,12 +52098,12 @@ class InkAnnotation extends MarkupAnnotation {
|
||||||
const borderWidth = this.borderStyle.width || 1,
|
const borderWidth = this.borderStyle.width || 1,
|
||||||
borderAdjust = 2 * borderWidth;
|
borderAdjust = 2 * borderWidth;
|
||||||
const bbox = [Infinity, Infinity, -Infinity, -Infinity];
|
const bbox = [Infinity, Infinity, -Infinity, -Infinity];
|
||||||
for (const inkLists of this.data.inkLists) {
|
for (const inkList of this.data.inkLists) {
|
||||||
for (const vertex of inkLists) {
|
for (let i = 0, ii = inkList.length; i < ii; i += 2) {
|
||||||
bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
|
bbox[0] = Math.min(bbox[0], inkList[i] - borderAdjust);
|
||||||
bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
|
bbox[1] = Math.min(bbox[1], inkList[i + 1] - borderAdjust);
|
||||||
bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
|
bbox[2] = Math.max(bbox[2], inkList[i] + borderAdjust);
|
||||||
bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
|
bbox[3] = Math.max(bbox[3], inkList[i + 1] + borderAdjust);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Util.intersect(this.rectangle, bbox)) {
|
if (!Util.intersect(this.rectangle, bbox)) {
|
||||||
|
@ -52149,12 +52116,12 @@ class InkAnnotation extends MarkupAnnotation {
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
for (const inkList of this.data.inkLists) {
|
for (const inkList of this.data.inkLists) {
|
||||||
for (let i = 0, ii = inkList.length; i < ii; i++) {
|
for (let i = 0, ii = inkList.length; i < ii; i += 2) {
|
||||||
buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
|
buffer.push(`${inkList[i]} ${inkList[i + 1]} ${i === 0 ? "m" : "l"}`);
|
||||||
}
|
}
|
||||||
buffer.push("S");
|
buffer.push("S");
|
||||||
}
|
}
|
||||||
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
return [points[0], points[2], points[7], points[3]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52316,8 +52283,8 @@ class HighlightAnnotation extends MarkupAnnotation {
|
||||||
blendMode: "Multiply",
|
blendMode: "Multiply",
|
||||||
fillAlpha,
|
fillAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
buffer.push(`${points[0].x} ${points[0].y} m`, `${points[1].x} ${points[1].y} l`, `${points[3].x} ${points[3].y} l`, `${points[2].x} ${points[2].y} l`, "f");
|
buffer.push(`${points[0]} ${points[1]} m`, `${points[2]} ${points[3]} l`, `${points[6]} ${points[7]} l`, `${points[4]} ${points[5]} l`, "f");
|
||||||
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
return [points[0], points[2], points[7], points[3]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52419,8 +52386,8 @@ class UnderlineAnnotation extends MarkupAnnotation {
|
||||||
strokeColor,
|
strokeColor,
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
buffer.push(`${points[2].x} ${points[2].y + 1.3} m`, `${points[3].x} ${points[3].y + 1.3} l`, "S");
|
buffer.push(`${points[4]} ${points[5] + 1.3} m`, `${points[6]} ${points[7] + 1.3} l`, "S");
|
||||||
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
return [points[0], points[2], points[7], points[3]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52448,11 +52415,11 @@ class SquigglyAnnotation extends MarkupAnnotation {
|
||||||
strokeColor,
|
strokeColor,
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
const dy = (points[0].y - points[2].y) / 6;
|
const dy = (points[1] - points[5]) / 6;
|
||||||
let shift = dy;
|
let shift = dy;
|
||||||
let x = points[2].x;
|
let x = points[4];
|
||||||
const y = points[2].y;
|
const y = points[5];
|
||||||
const xEnd = points[3].x;
|
const xEnd = points[6];
|
||||||
buffer.push(`${x} ${y + shift} m`);
|
buffer.push(`${x} ${y + shift} m`);
|
||||||
do {
|
do {
|
||||||
x += 2;
|
x += 2;
|
||||||
|
@ -52460,7 +52427,7 @@ class SquigglyAnnotation extends MarkupAnnotation {
|
||||||
buffer.push(`${x} ${y + shift} l`);
|
buffer.push(`${x} ${y + shift} l`);
|
||||||
} while (x < xEnd);
|
} while (x < xEnd);
|
||||||
buffer.push("S");
|
buffer.push("S");
|
||||||
return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
|
return [points[4], xEnd, y - 2 * dy, y + 2 * dy];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52488,8 +52455,8 @@ class StrikeOutAnnotation extends MarkupAnnotation {
|
||||||
strokeColor,
|
strokeColor,
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S");
|
buffer.push(`${(points[0] + points[4]) / 2} ` + `${(points[1] + points[5]) / 2} m`, `${(points[2] + points[6]) / 2} ` + `${(points[3] + points[7]) / 2} l`, "S");
|
||||||
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
return [points[0], points[2], points[7], points[3]];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -53718,19 +53685,18 @@ class Page {
|
||||||
systemFontCache: this.systemFontCache,
|
systemFontCache: this.systemFontCache,
|
||||||
options: this.evaluatorOptions
|
options: this.evaluatorOptions
|
||||||
});
|
});
|
||||||
const newAnnotationsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
|
const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
|
||||||
let deletedAnnotations = null;
|
const newAnnots = newAnnotsByPage?.get(this.pageIndex);
|
||||||
let newAnnotationsPromise = Promise.resolve(null);
|
let newAnnotationsPromise = Promise.resolve(null);
|
||||||
if (newAnnotationsByPage) {
|
let deletedAnnotations = null;
|
||||||
const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
|
if (newAnnots) {
|
||||||
if (newAnnotations) {
|
|
||||||
const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
|
const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
|
||||||
let imagePromises;
|
let imagePromises;
|
||||||
const missingBitmaps = new Set();
|
const missingBitmaps = new Set();
|
||||||
for (const {
|
for (const {
|
||||||
bitmapId,
|
bitmapId,
|
||||||
bitmap
|
bitmap
|
||||||
} of newAnnotations) {
|
} of newAnnots) {
|
||||||
if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
|
if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
|
||||||
missingBitmaps.add(bitmapId);
|
missingBitmaps.add(bitmapId);
|
||||||
}
|
}
|
||||||
|
@ -53739,7 +53705,7 @@ class Page {
|
||||||
isOffscreenCanvasSupported
|
isOffscreenCanvasSupported
|
||||||
} = this.evaluatorOptions;
|
} = this.evaluatorOptions;
|
||||||
if (missingBitmaps.size > 0) {
|
if (missingBitmaps.size > 0) {
|
||||||
const annotationWithBitmaps = newAnnotations.slice();
|
const annotationWithBitmaps = newAnnots.slice();
|
||||||
for (const [key, annotation] of annotationStorage) {
|
for (const [key, annotation] of annotationStorage) {
|
||||||
if (!key.startsWith(AnnotationEditorPrefix)) {
|
if (!key.startsWith(AnnotationEditorPrefix)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -53750,20 +53716,18 @@ class Page {
|
||||||
}
|
}
|
||||||
imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
|
imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
|
||||||
} else {
|
} else {
|
||||||
imagePromises = AnnotationFactory.generateImages(newAnnotations, this.xref, isOffscreenCanvasSupported);
|
imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported);
|
||||||
}
|
}
|
||||||
deletedAnnotations = new RefSet();
|
deletedAnnotations = new RefSet();
|
||||||
this.#replaceIdByRef(newAnnotations, deletedAnnotations, null);
|
this.#replaceIdByRef(newAnnots, deletedAnnotations, null);
|
||||||
newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => {
|
newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => {
|
||||||
if (!annotationGlobals) {
|
if (!annotationGlobals) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnotations, imagePromises);
|
return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(([contentStream]) => {
|
||||||
const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
|
|
||||||
const pageListPromise = dataPromises.then(([contentStream]) => {
|
|
||||||
const opList = new OperatorList(intent, sink);
|
const opList = new OperatorList(intent, sink);
|
||||||
handler.send("StartRenderPage", {
|
handler.send("StartRenderPage", {
|
||||||
transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
|
transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
|
||||||
|
@ -54550,7 +54514,7 @@ class PDFDocument {
|
||||||
if (type instanceof Ref) {
|
if (type instanceof Ref) {
|
||||||
type = await xref.fetchAsync(type);
|
type = await xref.fetchAsync(type);
|
||||||
}
|
}
|
||||||
if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
|
if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids") && obj.has("Contents")) {
|
||||||
if (!catalog.pageKidsCountCache.has(ref)) {
|
if (!catalog.pageKidsCountCache.has(ref)) {
|
||||||
catalog.pageKidsCountCache.put(ref, 1);
|
catalog.pageKidsCountCache.put(ref, 1);
|
||||||
}
|
}
|
||||||
|
@ -55528,7 +55492,7 @@ class WorkerMessageHandler {
|
||||||
docId,
|
docId,
|
||||||
apiVersion
|
apiVersion
|
||||||
} = docParams;
|
} = docParams;
|
||||||
const workerVersion = "4.3.98";
|
const workerVersion = "4.4.11";
|
||||||
if (apiVersion !== workerVersion) {
|
if (apiVersion !== workerVersion) {
|
||||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||||
}
|
}
|
||||||
|
@ -56098,8 +56062,8 @@ if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" &&
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./src/pdf.worker.js
|
;// CONCATENATED MODULE: ./src/pdf.worker.js
|
||||||
|
|
||||||
const pdfjsVersion = "4.3.98";
|
const pdfjsVersion = "4.4.11";
|
||||||
const pdfjsBuild = "8dba041e6";
|
const pdfjsBuild = "d76501a0c";
|
||||||
|
|
||||||
var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
|
var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
|
||||||
export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };
|
export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,6 +13,242 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.dialog{
|
||||||
|
--dialog-bg-color:white;
|
||||||
|
--dialog-border-color:white;
|
||||||
|
--dialog-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2);
|
||||||
|
--text-primary-color:#15141a;
|
||||||
|
--text-secondary-color:#5b5b66;
|
||||||
|
--hover-filter:brightness(0.9);
|
||||||
|
--focus-ring-color:#0060df;
|
||||||
|
--focus-ring-outline:2px solid var(--focus-ring-color);
|
||||||
|
|
||||||
|
--textarea-border-color:#8f8f9d;
|
||||||
|
--textarea-bg-color:white;
|
||||||
|
--textarea-fg-color:var(--text-secondary-color);
|
||||||
|
|
||||||
|
--radio-bg-color:#f0f0f4;
|
||||||
|
--radio-checked-bg-color:#fbfbfe;
|
||||||
|
--radio-border-color:#8f8f9d;
|
||||||
|
--radio-checked-border-color:#0060df;
|
||||||
|
|
||||||
|
--button-secondary-bg-color:#f0f0f4;
|
||||||
|
--button-secondary-fg-color:var(--text-primary-color);
|
||||||
|
--button-secondary-border-color:var(--button-secondary-bg-color);
|
||||||
|
--button-secondary-hover-bg-color:var(--button-secondary-bg-color);
|
||||||
|
--button-secondary-hover-fg-color:var(--button-secondary-fg-color);
|
||||||
|
--button-secondary-hover-border-color:var(--button-secondary-hover-bg-color);
|
||||||
|
|
||||||
|
--button-primary-bg-color:#0060df;
|
||||||
|
--button-primary-fg-color:#fbfbfe;
|
||||||
|
--button-primary-hover-bg-color:var(--button-primary-bg-color);
|
||||||
|
--button-primary-hover-fg-color:var(--button-primary-fg-color);
|
||||||
|
--button-primary-hover-border-color:var(--button-primary-hover-bg-color);
|
||||||
|
|
||||||
|
font:message-box;
|
||||||
|
font-size:13px;
|
||||||
|
font-weight:400;
|
||||||
|
line-height:150%;
|
||||||
|
border-radius:4px;
|
||||||
|
padding:12px 16px;
|
||||||
|
border:1px solid var(--dialog-border-color);
|
||||||
|
background:var(--dialog-bg-color);
|
||||||
|
color:var(--text-primary-color);
|
||||||
|
box-shadow:var(--dialog-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark){
|
||||||
|
|
||||||
|
:where(html:not(.is-light)) .dialog{
|
||||||
|
--dialog-bg-color:#1c1b22;
|
||||||
|
--dialog-border-color:#1c1b22;
|
||||||
|
--dialog-shadow:0 2px 14px 0 #15141a;
|
||||||
|
--text-primary-color:#fbfbfe;
|
||||||
|
--text-secondary-color:#cfcfd8;
|
||||||
|
--focus-ring-color:#0df;
|
||||||
|
--hover-filter:brightness(1.4);
|
||||||
|
|
||||||
|
--textarea-bg-color:#42414d;
|
||||||
|
|
||||||
|
--radio-bg-color:#2b2a33;
|
||||||
|
--radio-checked-bg-color:#15141a;
|
||||||
|
--radio-checked-border-color:#0df;
|
||||||
|
|
||||||
|
--button-secondary-bg-color:#2b2a33;
|
||||||
|
--button-primary-bg-color:#0df;
|
||||||
|
--button-primary-fg-color:#15141a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:where(html.is-dark) .dialog{
|
||||||
|
--dialog-bg-color:#1c1b22;
|
||||||
|
--dialog-border-color:#1c1b22;
|
||||||
|
--dialog-shadow:0 2px 14px 0 #15141a;
|
||||||
|
--text-primary-color:#fbfbfe;
|
||||||
|
--text-secondary-color:#cfcfd8;
|
||||||
|
--focus-ring-color:#0df;
|
||||||
|
--hover-filter:brightness(1.4);
|
||||||
|
|
||||||
|
--textarea-bg-color:#42414d;
|
||||||
|
|
||||||
|
--radio-bg-color:#2b2a33;
|
||||||
|
--radio-checked-bg-color:#15141a;
|
||||||
|
--radio-checked-border-color:#0df;
|
||||||
|
|
||||||
|
--button-secondary-bg-color:#2b2a33;
|
||||||
|
--button-primary-bg-color:#0df;
|
||||||
|
--button-primary-fg-color:#15141a;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (forced-colors: active){
|
||||||
|
|
||||||
|
.dialog{
|
||||||
|
--dialog-bg-color:Canvas;
|
||||||
|
--dialog-border-color:CanvasText;
|
||||||
|
--dialog-shadow:none;
|
||||||
|
--text-primary-color:CanvasText;
|
||||||
|
--text-secondary-color:CanvasText;
|
||||||
|
--hover-filter:none;
|
||||||
|
--focus-ring-color:ButtonBorder;
|
||||||
|
|
||||||
|
--textarea-border-color:ButtonBorder;
|
||||||
|
--textarea-bg-color:Field;
|
||||||
|
--textarea-fg-color:ButtonText;
|
||||||
|
|
||||||
|
--radio-bg-color:ButtonFace;
|
||||||
|
--radio-checked-bg-color:ButtonFace;
|
||||||
|
--radio-border-color:ButtonText;
|
||||||
|
--radio-checked-border-color:ButtonText;
|
||||||
|
|
||||||
|
--button-secondary-bg-color:ButtonFace;
|
||||||
|
--button-secondary-fg-color:ButtonText;
|
||||||
|
--button-secondary-border-color:ButtonText;
|
||||||
|
--button-secondary-hover-bg-color:AccentColor;
|
||||||
|
--button-secondary-hover-fg-color:AccentColorText;
|
||||||
|
|
||||||
|
--button-primary-bg-color:ButtonText;
|
||||||
|
--button-primary-fg-color:ButtonFace;
|
||||||
|
--button-primary-hover-bg-color:AccentColor;
|
||||||
|
--button-primary-hover-fg-color:AccentColorText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer *:focus-visible{
|
||||||
|
outline:var(--focus-ring-outline);
|
||||||
|
outline-offset:2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer .radio{
|
||||||
|
display:flex;
|
||||||
|
flex-direction:column;
|
||||||
|
align-items:flex-start;
|
||||||
|
gap:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer .radio > .radioButton{
|
||||||
|
display:flex;
|
||||||
|
gap:8px;
|
||||||
|
align-self:stretch;
|
||||||
|
align-items:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer .radio > .radioButton input{
|
||||||
|
-webkit-appearance:none;
|
||||||
|
-moz-appearance:none;
|
||||||
|
appearance:none;
|
||||||
|
box-sizing:border-box;
|
||||||
|
width:16px;
|
||||||
|
height:16px;
|
||||||
|
border-radius:50%;
|
||||||
|
background-color:var(--radio-bg-color);
|
||||||
|
border:1px solid var(--radio-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer .radio > .radioButton input:hover{
|
||||||
|
filter:var(--hover-filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer .radio > .radioButton input:checked{
|
||||||
|
background-color:var(--radio-checked-bg-color);
|
||||||
|
border:4px solid var(--radio-checked-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer .radio > .radioLabel{
|
||||||
|
display:flex;
|
||||||
|
padding-inline-start:24px;
|
||||||
|
align-items:flex-start;
|
||||||
|
gap:10px;
|
||||||
|
align-self:stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer .radio > .radioLabel > span{
|
||||||
|
flex:1 0 0;
|
||||||
|
font-size:11px;
|
||||||
|
color:var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer button{
|
||||||
|
border-radius:4px;
|
||||||
|
border:1px solid;
|
||||||
|
font:menu;
|
||||||
|
font-weight:600;
|
||||||
|
padding:4px 16px;
|
||||||
|
width:auto;
|
||||||
|
height:32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer button:hover{
|
||||||
|
cursor:pointer;
|
||||||
|
filter:var(--hover-filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer button.secondaryButton{
|
||||||
|
color:var(--button-secondary-fg-color);
|
||||||
|
background-color:var(--button-secondary-bg-color);
|
||||||
|
border-color:var(--button-secondary-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer button.secondaryButton:hover{
|
||||||
|
color:var(--button-secondary-hover-fg-color);
|
||||||
|
background-color:var(--button-secondary-hover-bg-color);
|
||||||
|
border-color:var(--button-secondary-hover-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer button.primaryButton{
|
||||||
|
color:var(--button-primary-hover-fg-color);
|
||||||
|
background-color:var(--button-primary-hover-bg-color);
|
||||||
|
border-color:var(--button-primary-hover-border-color);
|
||||||
|
opacity:1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer button.primaryButton:hover{
|
||||||
|
color:var(--button-primary-hover-fg-color);
|
||||||
|
background-color:var(--button-primary-hover-bg-color);
|
||||||
|
border-color:var(--button-primary-hover-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer textarea{
|
||||||
|
font:inherit;
|
||||||
|
padding:8px;
|
||||||
|
resize:none;
|
||||||
|
margin:0;
|
||||||
|
box-sizing:border-box;
|
||||||
|
border-radius:4px;
|
||||||
|
border:1px solid var(--textarea-border-color);
|
||||||
|
background:var(--textarea-bg-color);
|
||||||
|
color:var(--textarea-fg-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer textarea:focus{
|
||||||
|
outline-offset:0;
|
||||||
|
border-color:transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog .mainContainer textarea:disabled{
|
||||||
|
pointer-events:none;
|
||||||
|
opacity:0.4;
|
||||||
|
}
|
||||||
|
|
||||||
.textLayer{
|
.textLayer{
|
||||||
position:absolute;
|
position:absolute;
|
||||||
text-align:initial;
|
text-align:initial;
|
||||||
|
@ -1946,136 +2182,16 @@
|
||||||
inset-block-start:0;
|
inset-block-start:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog{
|
.dialog.altText::backdrop{
|
||||||
--dialog-bg-color:white;
|
|
||||||
--dialog-border-color:white;
|
|
||||||
--dialog-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2);
|
|
||||||
--text-primary-color:#15141a;
|
|
||||||
--text-secondary-color:#5b5b66;
|
|
||||||
--hover-filter:brightness(0.9);
|
|
||||||
--focus-ring-color:#0060df;
|
|
||||||
--focus-ring-outline:2px solid var(--focus-ring-color);
|
|
||||||
|
|
||||||
--textarea-border-color:#8f8f9d;
|
|
||||||
--textarea-bg-color:white;
|
|
||||||
--textarea-fg-color:var(--text-secondary-color);
|
|
||||||
|
|
||||||
--radio-bg-color:#f0f0f4;
|
|
||||||
--radio-checked-bg-color:#fbfbfe;
|
|
||||||
--radio-border-color:#8f8f9d;
|
|
||||||
--radio-checked-border-color:#0060df;
|
|
||||||
|
|
||||||
--button-cancel-bg-color:#f0f0f4;
|
|
||||||
--button-cancel-fg-color:var(--text-primary-color);
|
|
||||||
--button-cancel-border-color:var(--button-cancel-bg-color);
|
|
||||||
--button-cancel-hover-bg-color:var(--button-cancel-bg-color);
|
|
||||||
--button-cancel-hover-fg-color:var(--button-cancel-fg-color);
|
|
||||||
--button-cancel-hover-border-color:var(--button-cancel-hover-bg-color);
|
|
||||||
|
|
||||||
--button-save-bg-color:#0060df;
|
|
||||||
--button-save-fg-color:#fbfbfe;
|
|
||||||
--button-save-hover-bg-color:var(--button-save-bg-color);
|
|
||||||
--button-save-hover-fg-color:var(--button-save-fg-color);
|
|
||||||
--button-save-hover-border-color:var(--button-save-hover-bg-color);
|
|
||||||
|
|
||||||
font:message-box;
|
|
||||||
font-size:13px;
|
|
||||||
font-weight:400;
|
|
||||||
line-height:150%;
|
|
||||||
border-radius:4px;
|
|
||||||
padding:12px 16px;
|
|
||||||
border:1px solid var(--dialog-border-color);
|
|
||||||
background:var(--dialog-bg-color);
|
|
||||||
color:var(--text-primary-color);
|
|
||||||
box-shadow:var(--dialog-shadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark){
|
|
||||||
|
|
||||||
:where(html:not(.is-light)) #altTextDialog{
|
|
||||||
--dialog-bg-color:#1c1b22;
|
|
||||||
--dialog-border-color:#1c1b22;
|
|
||||||
--dialog-shadow:0 2px 14px 0 #15141a;
|
|
||||||
--text-primary-color:#fbfbfe;
|
|
||||||
--text-secondary-color:#cfcfd8;
|
|
||||||
--focus-ring-color:#0df;
|
|
||||||
--hover-filter:brightness(1.4);
|
|
||||||
|
|
||||||
--textarea-bg-color:#42414d;
|
|
||||||
|
|
||||||
--radio-bg-color:#2b2a33;
|
|
||||||
--radio-checked-bg-color:#15141a;
|
|
||||||
--radio-checked-border-color:#0df;
|
|
||||||
|
|
||||||
--button-cancel-bg-color:#2b2a33;
|
|
||||||
--button-save-bg-color:#0df;
|
|
||||||
--button-save-fg-color:#15141a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:where(html.is-dark) #altTextDialog{
|
|
||||||
--dialog-bg-color:#1c1b22;
|
|
||||||
--dialog-border-color:#1c1b22;
|
|
||||||
--dialog-shadow:0 2px 14px 0 #15141a;
|
|
||||||
--text-primary-color:#fbfbfe;
|
|
||||||
--text-secondary-color:#cfcfd8;
|
|
||||||
--focus-ring-color:#0df;
|
|
||||||
--hover-filter:brightness(1.4);
|
|
||||||
|
|
||||||
--textarea-bg-color:#42414d;
|
|
||||||
|
|
||||||
--radio-bg-color:#2b2a33;
|
|
||||||
--radio-checked-bg-color:#15141a;
|
|
||||||
--radio-checked-border-color:#0df;
|
|
||||||
|
|
||||||
--button-cancel-bg-color:#2b2a33;
|
|
||||||
--button-save-bg-color:#0df;
|
|
||||||
--button-save-fg-color:#15141a;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (forced-colors: active){
|
|
||||||
|
|
||||||
#altTextDialog{
|
|
||||||
--dialog-bg-color:Canvas;
|
|
||||||
--dialog-border-color:CanvasText;
|
|
||||||
--dialog-shadow:none;
|
|
||||||
--text-primary-color:CanvasText;
|
|
||||||
--text-secondary-color:CanvasText;
|
|
||||||
--hover-filter:none;
|
|
||||||
--focus-ring-color:ButtonBorder;
|
|
||||||
|
|
||||||
--textarea-border-color:ButtonBorder;
|
|
||||||
--textarea-bg-color:Field;
|
|
||||||
--textarea-fg-color:ButtonText;
|
|
||||||
|
|
||||||
--radio-bg-color:ButtonFace;
|
|
||||||
--radio-checked-bg-color:ButtonFace;
|
|
||||||
--radio-border-color:ButtonText;
|
|
||||||
--radio-checked-border-color:ButtonText;
|
|
||||||
|
|
||||||
--button-cancel-bg-color:ButtonFace;
|
|
||||||
--button-cancel-fg-color:ButtonText;
|
|
||||||
--button-cancel-border-color:ButtonText;
|
|
||||||
--button-cancel-hover-bg-color:AccentColor;
|
|
||||||
--button-cancel-hover-fg-color:AccentColorText;
|
|
||||||
|
|
||||||
--button-save-bg-color:ButtonText;
|
|
||||||
--button-save-fg-color:ButtonFace;
|
|
||||||
--button-save-hover-bg-color:AccentColor;
|
|
||||||
--button-save-hover-fg-color:AccentColorText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog::backdrop{
|
|
||||||
-webkit-mask:url(#alttext-manager-mask);
|
-webkit-mask:url(#alttext-manager-mask);
|
||||||
mask:url(#alttext-manager-mask);
|
mask:url(#alttext-manager-mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog.positioned{
|
.dialog.altText.positioned{
|
||||||
margin:0;
|
margin:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer{
|
.dialog.altText #altTextContainer{
|
||||||
width:300px;
|
width:300px;
|
||||||
height:-moz-fit-content;
|
height:-moz-fit-content;
|
||||||
height:fit-content;
|
height:fit-content;
|
||||||
|
@ -2085,61 +2201,7 @@
|
||||||
gap:16px;
|
gap:16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer *:focus-visible{
|
.dialog.altText #altTextContainer #overallDescription{
|
||||||
outline:var(--focus-ring-outline);
|
|
||||||
outline-offset:2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer .radio{
|
|
||||||
display:flex;
|
|
||||||
flex-direction:column;
|
|
||||||
align-items:flex-start;
|
|
||||||
gap:4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer .radio .radioButton{
|
|
||||||
display:flex;
|
|
||||||
gap:8px;
|
|
||||||
align-self:stretch;
|
|
||||||
align-items:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer .radio .radioButton input{
|
|
||||||
-webkit-appearance:none;
|
|
||||||
-moz-appearance:none;
|
|
||||||
appearance:none;
|
|
||||||
box-sizing:border-box;
|
|
||||||
width:16px;
|
|
||||||
height:16px;
|
|
||||||
border-radius:50%;
|
|
||||||
background-color:var(--radio-bg-color);
|
|
||||||
border:1px solid var(--radio-border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer .radio .radioButton input:hover{
|
|
||||||
filter:var(--hover-filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer .radio .radioButton input:checked{
|
|
||||||
background-color:var(--radio-checked-bg-color);
|
|
||||||
border:4px solid var(--radio-checked-border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer .radio .radioLabel{
|
|
||||||
display:flex;
|
|
||||||
padding-inline-start:24px;
|
|
||||||
align-items:flex-start;
|
|
||||||
gap:10px;
|
|
||||||
align-self:stretch;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer .radio .radioLabel span{
|
|
||||||
flex:1 0 0;
|
|
||||||
font-size:11px;
|
|
||||||
color:var(--text-secondary-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #overallDescription{
|
|
||||||
display:flex;
|
display:flex;
|
||||||
flex-direction:column;
|
flex-direction:column;
|
||||||
align-items:flex-start;
|
align-items:flex-start;
|
||||||
|
@ -2147,53 +2209,34 @@
|
||||||
align-self:stretch;
|
align-self:stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #overallDescription span{
|
.dialog.altText #altTextContainer #overallDescription span{
|
||||||
align-self:stretch;
|
align-self:stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #overallDescription .title{
|
.dialog.altText #altTextContainer #overallDescription .title{
|
||||||
font-size:13px;
|
font-size:13px;
|
||||||
font-style:normal;
|
font-style:normal;
|
||||||
font-weight:590;
|
font-weight:590;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #addDescription{
|
.dialog.altText #altTextContainer #addDescription{
|
||||||
display:flex;
|
display:flex;
|
||||||
flex-direction:column;
|
flex-direction:column;
|
||||||
align-items:stretch;
|
align-items:stretch;
|
||||||
gap:8px;
|
gap:8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #addDescription .descriptionArea{
|
.dialog.altText #altTextContainer #addDescription .descriptionArea{
|
||||||
flex:1;
|
flex:1;
|
||||||
padding-inline:24px 10px;
|
padding-inline:24px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #addDescription .descriptionArea textarea{
|
.dialog.altText #altTextContainer #addDescription .descriptionArea textarea{
|
||||||
font:inherit;
|
|
||||||
width:100%;
|
width:100%;
|
||||||
min-height:75px;
|
min-height:75px;
|
||||||
padding:8px;
|
|
||||||
resize:none;
|
|
||||||
margin:0;
|
|
||||||
box-sizing:border-box;
|
|
||||||
border-radius:4px;
|
|
||||||
border:1px solid var(--textarea-border-color);
|
|
||||||
background:var(--textarea-bg-color);
|
|
||||||
color:var(--textarea-fg-color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #addDescription .descriptionArea textarea:focus{
|
.dialog.altText #altTextContainer #buttons{
|
||||||
outline-offset:0;
|
|
||||||
border-color:transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #addDescription .descriptionArea textarea:disabled{
|
|
||||||
pointer-events:none;
|
|
||||||
opacity:0.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #buttons{
|
|
||||||
display:flex;
|
display:flex;
|
||||||
justify-content:flex-end;
|
justify-content:flex-end;
|
||||||
align-items:flex-start;
|
align-items:flex-start;
|
||||||
|
@ -2201,46 +2244,6 @@
|
||||||
align-self:stretch;
|
align-self:stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #buttons button{
|
|
||||||
border-radius:4px;
|
|
||||||
border:1px solid;
|
|
||||||
font:menu;
|
|
||||||
font-weight:600;
|
|
||||||
padding:4px 16px;
|
|
||||||
width:auto;
|
|
||||||
height:32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #buttons button:hover{
|
|
||||||
cursor:pointer;
|
|
||||||
filter:var(--hover-filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #buttons button#altTextCancel{
|
|
||||||
color:var(--button-cancel-fg-color);
|
|
||||||
background-color:var(--button-cancel-bg-color);
|
|
||||||
border-color:var(--button-cancel-border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #buttons button#altTextCancel:hover{
|
|
||||||
color:var(--button-cancel-hover-fg-color);
|
|
||||||
background-color:var(--button-cancel-hover-bg-color);
|
|
||||||
border-color:var(--button-cancel-hover-border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #buttons button#altTextSave{
|
|
||||||
color:var(--button-save-hover-fg-color);
|
|
||||||
background-color:var(--button-save-hover-bg-color);
|
|
||||||
border-color:var(--button-save-hover-border-color);
|
|
||||||
opacity:1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#altTextDialog #altTextContainer #buttons button#altTextSave:hover{
|
|
||||||
color:var(--button-save-hover-fg-color);
|
|
||||||
background-color:var(--button-save-hover-bg-color);
|
|
||||||
border-color:var(--button-save-hover-border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.colorPicker{
|
.colorPicker{
|
||||||
--hover-outline-color:#0250bb;
|
--hover-outline-color:#0250bb;
|
||||||
--selected-outline-color:#0060df;
|
--selected-outline-color:#0060df;
|
||||||
|
|
|
@ -142,7 +142,7 @@ function scrollIntoView(element, spot, scrollMatches = false) {
|
||||||
}
|
}
|
||||||
parent.scrollTop = offsetY;
|
parent.scrollTop = offsetY;
|
||||||
}
|
}
|
||||||
function watchScroll(viewAreaElement, callback) {
|
function watchScroll(viewAreaElement, callback, abortSignal = undefined) {
|
||||||
const debounceScroll = function (evt) {
|
const debounceScroll = function (evt) {
|
||||||
if (rAF) {
|
if (rAF) {
|
||||||
return;
|
return;
|
||||||
|
@ -172,7 +172,10 @@ function watchScroll(viewAreaElement, callback) {
|
||||||
_eventHandler: debounceScroll
|
_eventHandler: debounceScroll
|
||||||
};
|
};
|
||||||
let rAF = null;
|
let rAF = null;
|
||||||
viewAreaElement.addEventListener("scroll", debounceScroll, true);
|
viewAreaElement.addEventListener("scroll", debounceScroll, {
|
||||||
|
useCapture: true,
|
||||||
|
signal: abortSignal
|
||||||
|
});
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
function parseQueryString(query) {
|
function parseQueryString(query) {
|
||||||
|
@ -7974,14 +7977,15 @@ class PDFThumbnailViewer {
|
||||||
eventBus,
|
eventBus,
|
||||||
linkService,
|
linkService,
|
||||||
renderingQueue,
|
renderingQueue,
|
||||||
pageColors
|
pageColors,
|
||||||
|
abortSignal
|
||||||
}) {
|
}) {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.linkService = linkService;
|
this.linkService = linkService;
|
||||||
this.renderingQueue = renderingQueue;
|
this.renderingQueue = renderingQueue;
|
||||||
this.pageColors = pageColors || null;
|
this.pageColors = pageColors || null;
|
||||||
this.scroll = watchScroll(this.container, this.#scrollUpdated.bind(this));
|
this.scroll = watchScroll(this.container, this.#scrollUpdated.bind(this), abortSignal);
|
||||||
this.#resetView();
|
this.#resetView();
|
||||||
}
|
}
|
||||||
#scrollUpdated() {
|
#scrollUpdated() {
|
||||||
|
@ -8912,17 +8916,18 @@ class TextHighlighter {
|
||||||
class TextLayerBuilder {
|
class TextLayerBuilder {
|
||||||
#enablePermissions = false;
|
#enablePermissions = false;
|
||||||
#onAppend = null;
|
#onAppend = null;
|
||||||
#textContentSource = null;
|
#renderingDone = false;
|
||||||
#textLayer = null;
|
#textLayer = null;
|
||||||
static #textLayers = new Map();
|
static #textLayers = new Map();
|
||||||
static #selectionChangeAbortController = null;
|
static #selectionChangeAbortController = null;
|
||||||
constructor({
|
constructor({
|
||||||
|
pdfPage,
|
||||||
highlighter = null,
|
highlighter = null,
|
||||||
accessibilityManager = null,
|
accessibilityManager = null,
|
||||||
enablePermissions = false,
|
enablePermissions = false,
|
||||||
onAppend = null
|
onAppend = null
|
||||||
}) {
|
}) {
|
||||||
this.renderingDone = false;
|
this.pdfPage = pdfPage;
|
||||||
this.highlighter = highlighter;
|
this.highlighter = highlighter;
|
||||||
this.accessibilityManager = accessibilityManager;
|
this.accessibilityManager = accessibilityManager;
|
||||||
this.#enablePermissions = enablePermissions === true;
|
this.#enablePermissions = enablePermissions === true;
|
||||||
|
@ -8932,17 +8937,14 @@ class TextLayerBuilder {
|
||||||
this.div.className = "textLayer";
|
this.div.className = "textLayer";
|
||||||
}
|
}
|
||||||
#finishRendering() {
|
#finishRendering() {
|
||||||
this.renderingDone = true;
|
this.#renderingDone = true;
|
||||||
const endOfContent = document.createElement("div");
|
const endOfContent = document.createElement("div");
|
||||||
endOfContent.className = "endOfContent";
|
endOfContent.className = "endOfContent";
|
||||||
this.div.append(endOfContent);
|
this.div.append(endOfContent);
|
||||||
this.#bindMouse(endOfContent);
|
this.#bindMouse(endOfContent);
|
||||||
}
|
}
|
||||||
async render(viewport) {
|
async render(viewport, textContentParams = null) {
|
||||||
if (!this.#textContentSource) {
|
if (this.#renderingDone && this.#textLayer) {
|
||||||
throw new Error('No "textContentSource" parameter specified.');
|
|
||||||
}
|
|
||||||
if (this.renderingDone && this.#textLayer) {
|
|
||||||
this.#textLayer.update({
|
this.#textLayer.update({
|
||||||
viewport,
|
viewport,
|
||||||
onBefore: this.hide.bind(this)
|
onBefore: this.hide.bind(this)
|
||||||
|
@ -8952,7 +8954,10 @@ class TextLayerBuilder {
|
||||||
}
|
}
|
||||||
this.cancel();
|
this.cancel();
|
||||||
this.#textLayer = new TextLayer({
|
this.#textLayer = new TextLayer({
|
||||||
textContentSource: this.#textContentSource,
|
textContentSource: this.pdfPage.streamTextContent(textContentParams || {
|
||||||
|
includeMarkedContent: true,
|
||||||
|
disableNormalization: true
|
||||||
|
}),
|
||||||
container: this.div,
|
container: this.div,
|
||||||
viewport
|
viewport
|
||||||
});
|
});
|
||||||
|
@ -8969,13 +8974,13 @@ class TextLayerBuilder {
|
||||||
this.accessibilityManager?.enable();
|
this.accessibilityManager?.enable();
|
||||||
}
|
}
|
||||||
hide() {
|
hide() {
|
||||||
if (!this.div.hidden && this.renderingDone) {
|
if (!this.div.hidden && this.#renderingDone) {
|
||||||
this.highlighter?.disable();
|
this.highlighter?.disable();
|
||||||
this.div.hidden = true;
|
this.div.hidden = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show() {
|
show() {
|
||||||
if (this.div.hidden && this.renderingDone) {
|
if (this.div.hidden && this.#renderingDone) {
|
||||||
this.div.hidden = false;
|
this.div.hidden = false;
|
||||||
this.highlighter?.enable();
|
this.highlighter?.enable();
|
||||||
}
|
}
|
||||||
|
@ -8987,10 +8992,6 @@ class TextLayerBuilder {
|
||||||
this.accessibilityManager?.disable();
|
this.accessibilityManager?.disable();
|
||||||
TextLayerBuilder.#removeGlobalSelectionListener(this.div);
|
TextLayerBuilder.#removeGlobalSelectionListener(this.div);
|
||||||
}
|
}
|
||||||
setTextContentSource(source) {
|
|
||||||
this.cancel();
|
|
||||||
this.#textContentSource = source;
|
|
||||||
}
|
|
||||||
#bindMouse(end) {
|
#bindMouse(end) {
|
||||||
const {
|
const {
|
||||||
div
|
div
|
||||||
|
@ -9017,10 +9018,13 @@ class TextLayerBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static #enableGlobalSelectionListener() {
|
static #enableGlobalSelectionListener() {
|
||||||
if (TextLayerBuilder.#selectionChangeAbortController) {
|
if (this.#selectionChangeAbortController) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TextLayerBuilder.#selectionChangeAbortController = new AbortController();
|
this.#selectionChangeAbortController = new AbortController();
|
||||||
|
const {
|
||||||
|
signal
|
||||||
|
} = this.#selectionChangeAbortController;
|
||||||
const reset = (end, textLayer) => {
|
const reset = (end, textLayer) => {
|
||||||
textLayer.append(end);
|
textLayer.append(end);
|
||||||
end.style.width = "";
|
end.style.width = "";
|
||||||
|
@ -9028,35 +9032,37 @@ class TextLayerBuilder {
|
||||||
end.classList.remove("active");
|
end.classList.remove("active");
|
||||||
};
|
};
|
||||||
document.addEventListener("pointerup", () => {
|
document.addEventListener("pointerup", () => {
|
||||||
TextLayerBuilder.#textLayers.forEach(reset);
|
this.#textLayers.forEach(reset);
|
||||||
}, {
|
}, {
|
||||||
signal: TextLayerBuilder.#selectionChangeAbortController.signal
|
signal
|
||||||
});
|
});
|
||||||
var isFirefox, prevRange;
|
var isFirefox, prevRange;
|
||||||
document.addEventListener("selectionchange", () => {
|
document.addEventListener("selectionchange", () => {
|
||||||
const selection = document.getSelection();
|
const selection = document.getSelection();
|
||||||
if (selection.rangeCount === 0) {
|
if (selection.rangeCount === 0) {
|
||||||
TextLayerBuilder.#textLayers.forEach(reset);
|
this.#textLayers.forEach(reset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const activeTextLayers = new Set();
|
const activeTextLayers = new Set();
|
||||||
for (let i = 0; i < selection.rangeCount; i++) {
|
for (let i = 0; i < selection.rangeCount; i++) {
|
||||||
const range = selection.getRangeAt(i);
|
const range = selection.getRangeAt(i);
|
||||||
for (const textLayerDiv of TextLayerBuilder.#textLayers.keys()) {
|
for (const textLayerDiv of this.#textLayers.keys()) {
|
||||||
if (!activeTextLayers.has(textLayerDiv) && range.intersectsNode(textLayerDiv)) {
|
if (!activeTextLayers.has(textLayerDiv) && range.intersectsNode(textLayerDiv)) {
|
||||||
activeTextLayers.add(textLayerDiv);
|
activeTextLayers.add(textLayerDiv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const [textLayerDiv, endDiv] of TextLayerBuilder.#textLayers) {
|
for (const [textLayerDiv, endDiv] of this.#textLayers) {
|
||||||
if (activeTextLayers.has(textLayerDiv)) {
|
if (activeTextLayers.has(textLayerDiv)) {
|
||||||
endDiv.classList.add("active");
|
endDiv.classList.add("active");
|
||||||
} else {
|
} else {
|
||||||
reset(endDiv, textLayerDiv);
|
reset(endDiv, textLayerDiv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isFirefox ??= getComputedStyle(TextLayerBuilder.#textLayers.values().next().value).getPropertyValue("-moz-user-select") === "none";
|
isFirefox ??= getComputedStyle(this.#textLayers.values().next().value).getPropertyValue("-moz-user-select") === "none";
|
||||||
if (!isFirefox) {
|
if (isFirefox) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const range = selection.getRangeAt(0);
|
const range = selection.getRangeAt(0);
|
||||||
const modifyStart = prevRange && (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 || range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);
|
const modifyStart = prevRange && (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 || range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);
|
||||||
let anchor = modifyStart ? range.startContainer : range.endContainer;
|
let anchor = modifyStart ? range.startContainer : range.endContainer;
|
||||||
|
@ -9064,16 +9070,15 @@ class TextLayerBuilder {
|
||||||
anchor = anchor.parentNode;
|
anchor = anchor.parentNode;
|
||||||
}
|
}
|
||||||
const parentTextLayer = anchor.parentElement.closest(".textLayer");
|
const parentTextLayer = anchor.parentElement.closest(".textLayer");
|
||||||
const endDiv = TextLayerBuilder.#textLayers.get(parentTextLayer);
|
const endDiv = this.#textLayers.get(parentTextLayer);
|
||||||
if (endDiv) {
|
if (endDiv) {
|
||||||
endDiv.style.width = parentTextLayer.style.width;
|
endDiv.style.width = parentTextLayer.style.width;
|
||||||
endDiv.style.height = parentTextLayer.style.height;
|
endDiv.style.height = parentTextLayer.style.height;
|
||||||
anchor.parentElement.insertBefore(endDiv, modifyStart ? anchor : anchor.nextSibling);
|
anchor.parentElement.insertBefore(endDiv, modifyStart ? anchor : anchor.nextSibling);
|
||||||
}
|
}
|
||||||
prevRange = range.cloneRange();
|
prevRange = range.cloneRange();
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
signal: TextLayerBuilder.#selectionChangeAbortController.signal
|
signal
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9257,6 +9262,13 @@ class PDFPageView {
|
||||||
findController: this.#layerProperties.findController
|
findController: this.#layerProperties.findController
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
#dispatchLayerRendered(name, error) {
|
||||||
|
this.eventBus.dispatch(name, {
|
||||||
|
source: this,
|
||||||
|
pageNumber: this.id,
|
||||||
|
error
|
||||||
|
});
|
||||||
|
}
|
||||||
async #renderAnnotationLayer() {
|
async #renderAnnotationLayer() {
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
|
@ -9265,11 +9277,7 @@ class PDFPageView {
|
||||||
console.error(`#renderAnnotationLayer: "${ex}".`);
|
console.error(`#renderAnnotationLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("annotationlayerrendered", {
|
this.#dispatchLayerRendered("annotationlayerrendered", error);
|
||||||
source: this,
|
|
||||||
pageNumber: this.id,
|
|
||||||
error
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async #renderAnnotationEditorLayer() {
|
async #renderAnnotationEditorLayer() {
|
||||||
|
@ -9280,11 +9288,7 @@ class PDFPageView {
|
||||||
console.error(`#renderAnnotationEditorLayer: "${ex}".`);
|
console.error(`#renderAnnotationEditorLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("annotationeditorlayerrendered", {
|
this.#dispatchLayerRendered("annotationeditorlayerrendered", error);
|
||||||
source: this,
|
|
||||||
pageNumber: this.id,
|
|
||||||
error
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async #renderDrawLayer() {
|
async #renderDrawLayer() {
|
||||||
|
@ -9310,32 +9314,16 @@ class PDFPageView {
|
||||||
this.#addLayer(this.xfaLayer.div, "xfaLayer");
|
this.#addLayer(this.xfaLayer.div, "xfaLayer");
|
||||||
this.l10n.resume();
|
this.l10n.resume();
|
||||||
}
|
}
|
||||||
this.eventBus.dispatch("xfalayerrendered", {
|
this.#dispatchLayerRendered("xfalayerrendered", error);
|
||||||
source: this,
|
|
||||||
pageNumber: this.id,
|
|
||||||
error
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async #renderTextLayer() {
|
async #renderTextLayer() {
|
||||||
const {
|
if (!this.textLayer) {
|
||||||
pdfPage,
|
|
||||||
textLayer,
|
|
||||||
viewport
|
|
||||||
} = this;
|
|
||||||
if (!textLayer) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
if (!textLayer.renderingDone) {
|
await this.textLayer.render(this.viewport);
|
||||||
const readableStream = pdfPage.streamTextContent({
|
|
||||||
includeMarkedContent: true,
|
|
||||||
disableNormalization: true
|
|
||||||
});
|
|
||||||
textLayer.setTextContentSource(readableStream);
|
|
||||||
}
|
|
||||||
await textLayer.render(viewport);
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex instanceof AbortException) {
|
if (ex instanceof AbortException) {
|
||||||
return;
|
return;
|
||||||
|
@ -9343,11 +9331,7 @@ class PDFPageView {
|
||||||
console.error(`#renderTextLayer: "${ex}".`);
|
console.error(`#renderTextLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
}
|
}
|
||||||
this.eventBus.dispatch("textlayerrendered", {
|
this.#dispatchLayerRendered("textlayerrendered", error);
|
||||||
source: this,
|
|
||||||
pageNumber: this.id,
|
|
||||||
error
|
|
||||||
});
|
|
||||||
this.#renderStructTreeLayer();
|
this.#renderStructTreeLayer();
|
||||||
}
|
}
|
||||||
async #renderStructTreeLayer() {
|
async #renderStructTreeLayer() {
|
||||||
|
@ -9690,6 +9674,7 @@ class PDFPageView {
|
||||||
if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
|
if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
|
||||||
this._accessibilityManager ||= new TextAccessibilityManager();
|
this._accessibilityManager ||= new TextAccessibilityManager();
|
||||||
this.textLayer = new TextLayerBuilder({
|
this.textLayer = new TextLayerBuilder({
|
||||||
|
pdfPage,
|
||||||
highlighter: this._textHighlighter,
|
highlighter: this._textHighlighter,
|
||||||
accessibilityManager: this._accessibilityManager,
|
accessibilityManager: this._accessibilityManager,
|
||||||
enablePermissions: this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,
|
enablePermissions: this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,
|
||||||
|
@ -9797,7 +9782,7 @@ class PDFPageView {
|
||||||
annotationCanvasMap: this._annotationCanvasMap,
|
annotationCanvasMap: this._annotationCanvasMap,
|
||||||
pageColors
|
pageColors
|
||||||
};
|
};
|
||||||
const renderTask = this.renderTask = this.pdfPage.render(renderContext);
|
const renderTask = this.renderTask = pdfPage.render(renderContext);
|
||||||
renderTask.onContinue = renderContinueCallback;
|
renderTask.onContinue = renderContinueCallback;
|
||||||
const resultPromise = renderTask.promise.then(async () => {
|
const resultPromise = renderTask.promise.then(async () => {
|
||||||
showCanvas?.(true);
|
showCanvas?.(true);
|
||||||
|
@ -9889,8 +9874,8 @@ class PDFPageView {
|
||||||
|
|
||||||
const DEFAULT_CACHE_SIZE = 10;
|
const DEFAULT_CACHE_SIZE = 10;
|
||||||
const PagesCountLimit = {
|
const PagesCountLimit = {
|
||||||
FORCE_SCROLL_MODE_PAGE: 15000,
|
FORCE_SCROLL_MODE_PAGE: 10000,
|
||||||
FORCE_LAZY_PAGE_INIT: 7500,
|
FORCE_LAZY_PAGE_INIT: 5000,
|
||||||
PAUSE_EAGER_PAGE_INIT: 250
|
PAUSE_EAGER_PAGE_INIT: 250
|
||||||
};
|
};
|
||||||
function isValidAnnotationEditorMode(mode) {
|
function isValidAnnotationEditorMode(mode) {
|
||||||
|
@ -9965,7 +9950,7 @@ class PDFViewer {
|
||||||
#scaleTimeoutId = null;
|
#scaleTimeoutId = null;
|
||||||
#textLayerMode = TextLayerMode.ENABLE;
|
#textLayerMode = TextLayerMode.ENABLE;
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
const viewerVersion = "4.3.98";
|
const viewerVersion = "4.4.11";
|
||||||
if (version !== viewerVersion) {
|
if (version !== viewerVersion) {
|
||||||
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
|
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
|
||||||
}
|
}
|
||||||
|
@ -10008,7 +9993,16 @@ class PDFViewer {
|
||||||
} else {
|
} else {
|
||||||
this.renderingQueue = options.renderingQueue;
|
this.renderingQueue = options.renderingQueue;
|
||||||
}
|
}
|
||||||
this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));
|
const {
|
||||||
|
abortSignal
|
||||||
|
} = options;
|
||||||
|
abortSignal?.addEventListener("abort", () => {
|
||||||
|
this.#resizeObserver.disconnect();
|
||||||
|
this.#resizeObserver = null;
|
||||||
|
}, {
|
||||||
|
once: true
|
||||||
|
});
|
||||||
|
this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this), abortSignal);
|
||||||
this.presentationModeState = PresentationModeState.UNKNOWN;
|
this.presentationModeState = PresentationModeState.UNKNOWN;
|
||||||
this._resetView();
|
this._resetView();
|
||||||
if (this.removePageBorders) {
|
if (this.removePageBorders) {
|
||||||
|
@ -10630,7 +10624,8 @@ class PDFViewer {
|
||||||
#setScaleUpdatePages(newScale, newValue, {
|
#setScaleUpdatePages(newScale, newValue, {
|
||||||
noScroll = false,
|
noScroll = false,
|
||||||
preset = false,
|
preset = false,
|
||||||
drawingDelay = -1
|
drawingDelay = -1,
|
||||||
|
origin = null
|
||||||
}) {
|
}) {
|
||||||
this._currentScaleValue = newValue.toString();
|
this._currentScaleValue = newValue.toString();
|
||||||
if (this.#isSameScale(newScale)) {
|
if (this.#isSameScale(newScale)) {
|
||||||
|
@ -10655,6 +10650,7 @@ class PDFViewer {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}, drawingDelay);
|
}, drawingDelay);
|
||||||
}
|
}
|
||||||
|
const previousScale = this._currentScale;
|
||||||
this._currentScale = newScale;
|
this._currentScale = newScale;
|
||||||
if (!noScroll) {
|
if (!noScroll) {
|
||||||
let page = this._currentPageNumber,
|
let page = this._currentPageNumber,
|
||||||
|
@ -10670,6 +10666,12 @@ class PDFViewer {
|
||||||
destArray: dest,
|
destArray: dest,
|
||||||
allowNegativeOffset: true
|
allowNegativeOffset: true
|
||||||
});
|
});
|
||||||
|
if (Array.isArray(origin)) {
|
||||||
|
const scaleDiff = newScale / previousScale - 1;
|
||||||
|
const [top, left] = this.containerTopLeft;
|
||||||
|
this.container.scrollLeft += (origin[0] - left) * scaleDiff;
|
||||||
|
this.container.scrollTop += (origin[1] - top) * scaleDiff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.eventBus.dispatch("scalechanging", {
|
this.eventBus.dispatch("scalechanging", {
|
||||||
source: this,
|
source: this,
|
||||||
|
@ -11277,48 +11279,46 @@ class PDFViewer {
|
||||||
this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
|
this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
increaseScale({
|
updateScale({
|
||||||
drawingDelay,
|
drawingDelay,
|
||||||
scaleFactor,
|
scaleFactor = null,
|
||||||
steps
|
steps = null,
|
||||||
} = {}) {
|
origin
|
||||||
|
}) {
|
||||||
|
if (steps === null && scaleFactor === null) {
|
||||||
|
throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");
|
||||||
|
}
|
||||||
if (!this.pdfDocument) {
|
if (!this.pdfDocument) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let newScale = this._currentScale;
|
let newScale = this._currentScale;
|
||||||
if (scaleFactor > 1) {
|
if (scaleFactor > 0 && scaleFactor !== 1) {
|
||||||
newScale = Math.round(newScale * scaleFactor * 100) / 100;
|
newScale = Math.round(newScale * scaleFactor * 100) / 100;
|
||||||
} else {
|
} else if (steps) {
|
||||||
steps ??= 1;
|
const delta = steps > 0 ? DEFAULT_SCALE_DELTA : 1 / DEFAULT_SCALE_DELTA;
|
||||||
|
const round = steps > 0 ? Math.ceil : Math.floor;
|
||||||
|
steps = Math.abs(steps);
|
||||||
do {
|
do {
|
||||||
newScale = Math.ceil((newScale * DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
|
newScale = round((newScale * delta).toFixed(2) * 10) / 10;
|
||||||
} while (--steps > 0 && newScale < MAX_SCALE);
|
} while (--steps > 0);
|
||||||
}
|
}
|
||||||
this.#setScale(Math.min(MAX_SCALE, newScale), {
|
newScale = Math.max(MIN_SCALE, Math.min(MAX_SCALE, newScale));
|
||||||
|
this.#setScale(newScale, {
|
||||||
noScroll: false,
|
noScroll: false,
|
||||||
drawingDelay
|
drawingDelay,
|
||||||
|
origin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
decreaseScale({
|
increaseScale(options = {}) {
|
||||||
drawingDelay,
|
this.updateScale({
|
||||||
scaleFactor,
|
...options,
|
||||||
steps
|
steps: options.steps ?? 1
|
||||||
} = {}) {
|
});
|
||||||
if (!this.pdfDocument) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
let newScale = this._currentScale;
|
decreaseScale(options = {}) {
|
||||||
if (scaleFactor > 0 && scaleFactor < 1) {
|
this.updateScale({
|
||||||
newScale = Math.round(newScale * scaleFactor * 100) / 100;
|
...options,
|
||||||
} else {
|
steps: -(options.steps ?? 1)
|
||||||
steps ??= 1;
|
|
||||||
do {
|
|
||||||
newScale = Math.floor((newScale / DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
|
|
||||||
} while (--steps > 0 && newScale > MIN_SCALE);
|
|
||||||
}
|
|
||||||
this.#setScale(Math.max(MIN_SCALE, newScale), {
|
|
||||||
noScroll: false,
|
|
||||||
drawingDelay
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#updateContainerHeightCss(height = this.container.clientHeight) {
|
#updateContainerHeightCss(height = this.container.clientHeight) {
|
||||||
|
@ -12071,6 +12071,7 @@ const PDFViewerApplication = {
|
||||||
_downloadUrl: "",
|
_downloadUrl: "",
|
||||||
_eventBusAbortController: null,
|
_eventBusAbortController: null,
|
||||||
_windowAbortController: null,
|
_windowAbortController: null,
|
||||||
|
_globalAbortController: new AbortController(),
|
||||||
documentInfo: null,
|
documentInfo: null,
|
||||||
metadata: null,
|
metadata: null,
|
||||||
_contentDispositionFilename: null,
|
_contentDispositionFilename: null,
|
||||||
|
@ -12266,7 +12267,8 @@ const PDFViewerApplication = {
|
||||||
maxCanvasPixels: AppOptions.get("maxCanvasPixels"),
|
maxCanvasPixels: AppOptions.get("maxCanvasPixels"),
|
||||||
enablePermissions: AppOptions.get("enablePermissions"),
|
enablePermissions: AppOptions.get("enablePermissions"),
|
||||||
pageColors,
|
pageColors,
|
||||||
mlManager: this.mlManager
|
mlManager: this.mlManager,
|
||||||
|
abortSignal: this._globalAbortController.signal
|
||||||
});
|
});
|
||||||
this.pdfViewer = pdfViewer;
|
this.pdfViewer = pdfViewer;
|
||||||
pdfRenderingQueue.setViewer(pdfViewer);
|
pdfRenderingQueue.setViewer(pdfViewer);
|
||||||
|
@ -12278,7 +12280,8 @@ const PDFViewerApplication = {
|
||||||
eventBus,
|
eventBus,
|
||||||
renderingQueue: pdfRenderingQueue,
|
renderingQueue: pdfRenderingQueue,
|
||||||
linkService: pdfLinkService,
|
linkService: pdfLinkService,
|
||||||
pageColors
|
pageColors,
|
||||||
|
abortSignal: this._globalAbortController.signal
|
||||||
});
|
});
|
||||||
pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
|
pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
|
||||||
}
|
}
|
||||||
|
@ -12458,25 +12461,22 @@ const PDFViewerApplication = {
|
||||||
get initializedPromise() {
|
get initializedPromise() {
|
||||||
return this._initializedCapability.promise;
|
return this._initializedCapability.promise;
|
||||||
},
|
},
|
||||||
zoomIn(steps, scaleFactor) {
|
updateZoom(steps, scaleFactor, origin) {
|
||||||
if (this.pdfViewer.isInPresentationMode) {
|
if (this.pdfViewer.isInPresentationMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.pdfViewer.increaseScale({
|
this.pdfViewer.updateScale({
|
||||||
drawingDelay: AppOptions.get("defaultZoomDelay"),
|
drawingDelay: AppOptions.get("defaultZoomDelay"),
|
||||||
steps,
|
steps,
|
||||||
scaleFactor
|
scaleFactor,
|
||||||
|
origin
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
zoomOut(steps, scaleFactor) {
|
zoomIn() {
|
||||||
if (this.pdfViewer.isInPresentationMode) {
|
this.updateZoom(1);
|
||||||
return;
|
},
|
||||||
}
|
zoomOut() {
|
||||||
this.pdfViewer.decreaseScale({
|
this.updateZoom(-1);
|
||||||
drawingDelay: AppOptions.get("defaultZoomDelay"),
|
|
||||||
steps,
|
|
||||||
scaleFactor
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
zoomReset() {
|
zoomReset() {
|
||||||
if (this.pdfViewer.isInPresentationMode) {
|
if (this.pdfViewer.isInPresentationMode) {
|
||||||
|
@ -13482,6 +13482,10 @@ const PDFViewerApplication = {
|
||||||
unbindWindowEvents() {
|
unbindWindowEvents() {
|
||||||
this._windowAbortController?.abort();
|
this._windowAbortController?.abort();
|
||||||
this._windowAbortController = null;
|
this._windowAbortController = null;
|
||||||
|
if (AppOptions.get("isInAutomation")) {
|
||||||
|
this._globalAbortController?.abort();
|
||||||
|
this._globalAbortController = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_accumulateTicks(ticks, prop) {
|
_accumulateTicks(ticks, prop) {
|
||||||
if (this[prop] > 0 && ticks < 0 || this[prop] < 0 && ticks > 0) {
|
if (this[prop] > 0 && ticks < 0 || this[prop] < 0 && ticks > 0) {
|
||||||
|
@ -13503,17 +13507,6 @@ const PDFViewerApplication = {
|
||||||
this[prop] = factor / newFactor;
|
this[prop] = factor / newFactor;
|
||||||
return newFactor;
|
return newFactor;
|
||||||
},
|
},
|
||||||
_centerAtPos(previousScale, x, y) {
|
|
||||||
const {
|
|
||||||
pdfViewer
|
|
||||||
} = this;
|
|
||||||
const scaleDiff = pdfViewer.currentScale / previousScale - 1;
|
|
||||||
if (scaleDiff !== 0) {
|
|
||||||
const [top, left] = pdfViewer.containerTopLeft;
|
|
||||||
pdfViewer.container.scrollLeft += (x - left) * scaleDiff;
|
|
||||||
pdfViewer.container.scrollTop += (y - top) * scaleDiff;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_unblockDocumentLoadEvent() {
|
_unblockDocumentLoadEvent() {
|
||||||
document.blockUnblockOnload?.(false);
|
document.blockUnblockOnload?.(false);
|
||||||
this._unblockDocumentLoadEvent = () => {};
|
this._unblockDocumentLoadEvent = () => {};
|
||||||
|
@ -13859,21 +13852,15 @@ function webViewerWheel(evt) {
|
||||||
let scaleFactor = Math.exp(-evt.deltaY / 100);
|
let scaleFactor = Math.exp(-evt.deltaY / 100);
|
||||||
const isBuiltInMac = false;
|
const isBuiltInMac = false;
|
||||||
const isPinchToZoom = evt.ctrlKey && !PDFViewerApplication._isCtrlKeyDown && deltaMode === WheelEvent.DOM_DELTA_PIXEL && evt.deltaX === 0 && (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && evt.deltaZ === 0;
|
const isPinchToZoom = evt.ctrlKey && !PDFViewerApplication._isCtrlKeyDown && deltaMode === WheelEvent.DOM_DELTA_PIXEL && evt.deltaX === 0 && (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && evt.deltaZ === 0;
|
||||||
|
const origin = [evt.clientX, evt.clientY];
|
||||||
if (isPinchToZoom || evt.ctrlKey && supportsMouseWheelZoomCtrlKey || evt.metaKey && supportsMouseWheelZoomMetaKey) {
|
if (isPinchToZoom || evt.ctrlKey && supportsMouseWheelZoomCtrlKey || evt.metaKey && supportsMouseWheelZoomMetaKey) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if (PDFViewerApplication._isScrolling || zoomDisabledTimeout || document.visibilityState === "hidden" || PDFViewerApplication.overlayManager.active) {
|
if (PDFViewerApplication._isScrolling || zoomDisabledTimeout || document.visibilityState === "hidden" || PDFViewerApplication.overlayManager.active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const previousScale = pdfViewer.currentScale;
|
|
||||||
if (isPinchToZoom && supportsPinchToZoom) {
|
if (isPinchToZoom && supportsPinchToZoom) {
|
||||||
scaleFactor = PDFViewerApplication._accumulateFactor(previousScale, scaleFactor, "_wheelUnusedFactor");
|
scaleFactor = PDFViewerApplication._accumulateFactor(pdfViewer.currentScale, scaleFactor, "_wheelUnusedFactor");
|
||||||
if (scaleFactor < 1) {
|
PDFViewerApplication.updateZoom(null, scaleFactor, origin);
|
||||||
PDFViewerApplication.zoomOut(null, scaleFactor);
|
|
||||||
} else if (scaleFactor > 1) {
|
|
||||||
PDFViewerApplication.zoomIn(null, scaleFactor);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const delta = normalizeWheelEventDirection(evt);
|
const delta = normalizeWheelEventDirection(evt);
|
||||||
let ticks = 0;
|
let ticks = 0;
|
||||||
|
@ -13887,16 +13874,9 @@ function webViewerWheel(evt) {
|
||||||
const PIXELS_PER_LINE_SCALE = 30;
|
const PIXELS_PER_LINE_SCALE = 30;
|
||||||
ticks = PDFViewerApplication._accumulateTicks(delta / PIXELS_PER_LINE_SCALE, "_wheelUnusedTicks");
|
ticks = PDFViewerApplication._accumulateTicks(delta / PIXELS_PER_LINE_SCALE, "_wheelUnusedTicks");
|
||||||
}
|
}
|
||||||
if (ticks < 0) {
|
PDFViewerApplication.updateZoom(ticks, null, origin);
|
||||||
PDFViewerApplication.zoomOut(-ticks);
|
|
||||||
} else if (ticks > 0) {
|
|
||||||
PDFViewerApplication.zoomIn(ticks);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PDFViewerApplication._centerAtPos(previousScale, evt.clientX, evt.clientY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function webViewerTouchStart(evt) {
|
function webViewerTouchStart(evt) {
|
||||||
if (PDFViewerApplication.pdfViewer.isInPresentationMode || evt.touches.length < 2) {
|
if (PDFViewerApplication.pdfViewer.isInPresentationMode || evt.touches.length < 2) {
|
||||||
|
@ -13981,30 +13961,17 @@ function webViewerTouchMove(evt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
const origin = [(page0X + page1X) / 2, (page0Y + page1Y) / 2];
|
||||||
const distance = Math.hypot(page0X - page1X, page0Y - page1Y) || 1;
|
const distance = Math.hypot(page0X - page1X, page0Y - page1Y) || 1;
|
||||||
const pDistance = Math.hypot(pTouch0X - pTouch1X, pTouch0Y - pTouch1Y) || 1;
|
const pDistance = Math.hypot(pTouch0X - pTouch1X, pTouch0Y - pTouch1Y) || 1;
|
||||||
const previousScale = pdfViewer.currentScale;
|
|
||||||
if (supportsPinchToZoom) {
|
if (supportsPinchToZoom) {
|
||||||
const newScaleFactor = PDFViewerApplication._accumulateFactor(previousScale, distance / pDistance, "_touchUnusedFactor");
|
const newScaleFactor = PDFViewerApplication._accumulateFactor(pdfViewer.currentScale, distance / pDistance, "_touchUnusedFactor");
|
||||||
if (newScaleFactor < 1) {
|
PDFViewerApplication.updateZoom(null, newScaleFactor, origin);
|
||||||
PDFViewerApplication.zoomOut(null, newScaleFactor);
|
|
||||||
} else if (newScaleFactor > 1) {
|
|
||||||
PDFViewerApplication.zoomIn(null, newScaleFactor);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const PIXELS_PER_LINE_SCALE = 30;
|
const PIXELS_PER_LINE_SCALE = 30;
|
||||||
const ticks = PDFViewerApplication._accumulateTicks((distance - pDistance) / PIXELS_PER_LINE_SCALE, "_touchUnusedTicks");
|
const ticks = PDFViewerApplication._accumulateTicks((distance - pDistance) / PIXELS_PER_LINE_SCALE, "_touchUnusedTicks");
|
||||||
if (ticks < 0) {
|
PDFViewerApplication.updateZoom(ticks, null, origin);
|
||||||
PDFViewerApplication.zoomOut(-ticks);
|
|
||||||
} else if (ticks > 0) {
|
|
||||||
PDFViewerApplication.zoomIn(ticks);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
PDFViewerApplication._centerAtPos(previousScale, (page0X + page1X) / 2, (page0Y + page1Y) / 2);
|
|
||||||
}
|
}
|
||||||
function webViewerTouchEnd(evt) {
|
function webViewerTouchEnd(evt) {
|
||||||
if (!PDFViewerApplication._touchInfo) {
|
if (!PDFViewerApplication._touchInfo) {
|
||||||
|
@ -14322,8 +14289,8 @@ function webViewerReportTelemetry({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const pdfjsVersion = "4.3.98";
|
const pdfjsVersion = "4.4.11";
|
||||||
const pdfjsBuild = "8dba041e6";
|
const pdfjsBuild = "d76501a0c";
|
||||||
const AppConstants = {
|
const AppConstants = {
|
||||||
LinkTarget: LinkTarget,
|
LinkTarget: LinkTarget,
|
||||||
RenderingStates: RenderingStates,
|
RenderingStates: RenderingStates,
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue