mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-20 17:20:54 +00:00
Bug 1782014 - Update pdf.js to version b06d1904519d2270a191e44ef1290188ac8dbc46 r=pdfjs-reviewers,Snuffleupagus
Differential Revision: https://phabricator.services.mozilla.com/D153070
This commit is contained in:
parent
2efdd1384f
commit
be45a5d46b
@ -261,10 +261,11 @@ editor_ink_label=Ink Annotation
|
||||
free_text_default_content=Enter text…
|
||||
|
||||
# Editor Parameters
|
||||
editor_free_text_font_color=Font Color
|
||||
editor_free_text_font_size=Font Size
|
||||
editor_ink_line_color=Line Color
|
||||
editor_ink_line_thickness=Line Thickness
|
||||
editor_free_text_color=Color
|
||||
editor_free_text_size=Size
|
||||
editor_ink_color=Color
|
||||
editor_ink_thickness=Thickness
|
||||
editor_ink_opacity=Opacity
|
||||
|
||||
# Editor aria
|
||||
editor_free_text_aria_label=FreeText Editor
|
||||
|
@ -1,5 +1,5 @@
|
||||
This is the PDF.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 2.15.303
|
||||
Current extension version is: 2.15.322
|
||||
|
||||
Taken from upstream commit: bf0006873
|
||||
Taken from upstream commit: b06d19045
|
||||
|
@ -106,10 +106,12 @@ const AnnotationEditorType = {
|
||||
};
|
||||
exports.AnnotationEditorType = AnnotationEditorType;
|
||||
const AnnotationEditorParamsType = {
|
||||
FREETEXT_SIZE: 0,
|
||||
FREETEXT_COLOR: 1,
|
||||
INK_COLOR: 2,
|
||||
INK_THICKNESS: 3
|
||||
FREETEXT_SIZE: 1,
|
||||
FREETEXT_COLOR: 2,
|
||||
FREETEXT_OPACITY: 3,
|
||||
INK_COLOR: 11,
|
||||
INK_THICKNESS: 12,
|
||||
INK_OPACITY: 13
|
||||
};
|
||||
exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
|
||||
const PermissionFlag = {
|
||||
@ -1537,6 +1539,10 @@ function getRGB(color) {
|
||||
return color.slice(4, -1).split(",").map(x => parseInt(x));
|
||||
}
|
||||
|
||||
if (color.startsWith("rgba(")) {
|
||||
return color.slice(5, -1).split(",").map(x => parseInt(x)).slice(0, 3);
|
||||
}
|
||||
|
||||
(0, _util.warn)(`Not a valid color format: "${color}"`);
|
||||
return [0, 0, 0];
|
||||
}
|
||||
@ -2026,7 +2032,7 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
||||
|
||||
const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
|
||||
docId,
|
||||
apiVersion: '2.15.303',
|
||||
apiVersion: '2.15.322',
|
||||
source: {
|
||||
data: source.data,
|
||||
url: source.url,
|
||||
@ -4059,9 +4065,9 @@ class InternalRenderTask {
|
||||
|
||||
}
|
||||
|
||||
const version = '2.15.303';
|
||||
const version = '2.15.322';
|
||||
exports.version = version;
|
||||
const build = 'bf0006873';
|
||||
const build = 'b06d19045';
|
||||
exports.build = build;
|
||||
|
||||
/***/ }),
|
||||
@ -4383,11 +4389,14 @@ class AnnotationEditor {
|
||||
}
|
||||
|
||||
pointerdown(event) {
|
||||
if (event.button !== 0) {
|
||||
const isMac = _tools.KeyboardManager.platform.isMac;
|
||||
|
||||
if (event.button !== 0 || event.ctrlKey && isMac) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.ctrlKey || event.shiftKey) {
|
||||
if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
|
||||
this.parent.toggleSelected(this);
|
||||
} else {
|
||||
this.parent.setSelected(this);
|
||||
@ -4563,6 +4572,7 @@ Object.defineProperty(exports, "__esModule", ({
|
||||
}));
|
||||
exports.KeyboardManager = exports.CommandManager = exports.ColorManager = exports.AnnotationEditorUIManager = void 0;
|
||||
exports.bindEvents = bindEvents;
|
||||
exports.opacityToHex = opacityToHex;
|
||||
|
||||
var _util = __w_pdfjs_require__(1);
|
||||
|
||||
@ -4574,6 +4584,10 @@ function bindEvents(obj, element, names) {
|
||||
}
|
||||
}
|
||||
|
||||
function opacityToHex(opacity) {
|
||||
return Math.round(Math.min(255, Math.max(1, 255 * opacity))).toString(16).padStart(2, "0");
|
||||
}
|
||||
|
||||
class IdManager {
|
||||
#id = 0;
|
||||
|
||||
@ -4585,6 +4599,7 @@ class IdManager {
|
||||
|
||||
class CommandManager {
|
||||
#commands = [];
|
||||
#locked = false;
|
||||
#maxSize;
|
||||
#position = -1;
|
||||
|
||||
@ -4604,6 +4619,10 @@ class CommandManager {
|
||||
cmd();
|
||||
}
|
||||
|
||||
if (this.#locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
const save = {
|
||||
cmd,
|
||||
undo,
|
||||
@ -4611,6 +4630,10 @@ class CommandManager {
|
||||
};
|
||||
|
||||
if (this.#position === -1) {
|
||||
if (this.#commands.length > 0) {
|
||||
this.#commands.length = 0;
|
||||
}
|
||||
|
||||
this.#position = 0;
|
||||
this.#commands.push(save);
|
||||
return;
|
||||
@ -4645,14 +4668,18 @@ class CommandManager {
|
||||
return;
|
||||
}
|
||||
|
||||
this.#locked = true;
|
||||
this.#commands[this.#position].undo();
|
||||
this.#locked = false;
|
||||
this.#position -= 1;
|
||||
}
|
||||
|
||||
redo() {
|
||||
if (this.#position < this.#commands.length - 1) {
|
||||
this.#position += 1;
|
||||
this.#locked = true;
|
||||
this.#commands[this.#position].cmd();
|
||||
this.#locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4737,6 +4764,7 @@ class KeyboardManager {
|
||||
}
|
||||
|
||||
callback.bind(self)();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
@ -4844,7 +4872,7 @@ class AnnotationEditorUIManager {
|
||||
hasSelectedEditor: false
|
||||
};
|
||||
#container = null;
|
||||
static _keyboardManager = new KeyboardManager([[["ctrl+a", "mac+meta+a"], AnnotationEditorUIManager.prototype.selectAll], [["ctrl+c", "mac+meta+c"], AnnotationEditorUIManager.prototype.copy], [["ctrl+v", "mac+meta+v"], AnnotationEditorUIManager.prototype.paste], [["ctrl+x", "mac+meta+x"], AnnotationEditorUIManager.prototype.cut], [["ctrl+z", "mac+meta+z"], AnnotationEditorUIManager.prototype.undo], [["ctrl+y", "ctrl+shift+Z", "mac+meta+shift+Z"], AnnotationEditorUIManager.prototype.redo], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete"], AnnotationEditorUIManager.prototype.delete], [["Escape"], AnnotationEditorUIManager.prototype.unselectAll]]);
|
||||
static _keyboardManager = new KeyboardManager([[["ctrl+a", "mac+meta+a"], AnnotationEditorUIManager.prototype.selectAll], [["ctrl+c", "mac+meta+c"], AnnotationEditorUIManager.prototype.copy], [["ctrl+v", "mac+meta+v"], AnnotationEditorUIManager.prototype.paste], [["ctrl+x", "mac+meta+x"], AnnotationEditorUIManager.prototype.cut], [["ctrl+z", "mac+meta+z"], AnnotationEditorUIManager.prototype.undo], [["ctrl+y", "ctrl+shift+Z", "mac+meta+shift+Z"], AnnotationEditorUIManager.prototype.redo], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete"], AnnotationEditorUIManager.prototype.delete], [["Escape", "mac+Escape"], AnnotationEditorUIManager.prototype.unselectAll]]);
|
||||
|
||||
constructor(container, eventBus) {
|
||||
this.#container = container;
|
||||
@ -10501,10 +10529,10 @@ exports.AnnotationEditorLayer = void 0;
|
||||
|
||||
var _util = __w_pdfjs_require__(1);
|
||||
|
||||
var _display_utils = __w_pdfjs_require__(4);
|
||||
|
||||
var _tools = __w_pdfjs_require__(9);
|
||||
|
||||
var _display_utils = __w_pdfjs_require__(4);
|
||||
|
||||
var _freetext = __w_pdfjs_require__(22);
|
||||
|
||||
var _ink = __w_pdfjs_require__(23);
|
||||
@ -10927,6 +10955,12 @@ class AnnotationEditorLayer {
|
||||
}
|
||||
|
||||
pointerup(event) {
|
||||
const isMac = _tools.KeyboardManager.platform.isMac;
|
||||
|
||||
if (event.button !== 0 || event.ctrlKey && isMac) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target !== this.div) {
|
||||
return;
|
||||
}
|
||||
@ -10940,6 +10974,12 @@ class AnnotationEditorLayer {
|
||||
}
|
||||
|
||||
pointerdown(event) {
|
||||
const isMac = _tools.KeyboardManager.platform.isMac;
|
||||
|
||||
if (event.button !== 0 || event.ctrlKey && isMac) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target !== this.div) {
|
||||
return;
|
||||
}
|
||||
@ -11195,6 +11235,10 @@ class FreeTextEditor extends _editor.AnnotationEditor {
|
||||
}
|
||||
|
||||
enableEditMode() {
|
||||
if (this.isInEditMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.parent.setEditingState(false);
|
||||
this.parent.updateToolbar(_util.AnnotationEditorType.FREETEXT);
|
||||
super.enableEditMode();
|
||||
@ -11207,6 +11251,10 @@ class FreeTextEditor extends _editor.AnnotationEditor {
|
||||
}
|
||||
|
||||
disableEditMode() {
|
||||
if (!this.isInEditMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.parent.setEditingState(true);
|
||||
super.disableEditMode();
|
||||
this.overlayDiv.classList.add("enabled");
|
||||
@ -11215,6 +11263,7 @@ class FreeTextEditor extends _editor.AnnotationEditor {
|
||||
this.editorDiv.removeEventListener("keydown", this.#boundEditorDivKeydown);
|
||||
this.editorDiv.removeEventListener("focus", this.#boundEditorDivFocus);
|
||||
this.editorDiv.removeEventListener("blur", this.#boundEditorDivBlur);
|
||||
this.div.focus();
|
||||
this.isEditing = false;
|
||||
}
|
||||
|
||||
@ -11228,7 +11277,6 @@ class FreeTextEditor extends _editor.AnnotationEditor {
|
||||
|
||||
onceAdded() {
|
||||
if (this.width) {
|
||||
this.parent.setActiveEditor(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -11439,6 +11487,8 @@ var _editor = __w_pdfjs_require__(8);
|
||||
|
||||
var _pdfjsFitCurve = __w_pdfjs_require__(24);
|
||||
|
||||
var _tools = __w_pdfjs_require__(9);
|
||||
|
||||
const RESIZER_SIZE = 16;
|
||||
|
||||
class InkEditor extends _editor.AnnotationEditor {
|
||||
@ -11451,10 +11501,13 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
#boundCanvasPointerdown = this.canvasPointerdown.bind(this);
|
||||
#disableEditing = false;
|
||||
#isCanvasInitialized = false;
|
||||
#lastPoint = null;
|
||||
#observer = null;
|
||||
#realWidth = 0;
|
||||
#realHeight = 0;
|
||||
#requestFrameCallback = null;
|
||||
static _defaultColor = null;
|
||||
static _defaultOpacity = 1;
|
||||
static _defaultThickness = 1;
|
||||
static _l10nPromise;
|
||||
|
||||
@ -11464,6 +11517,7 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
});
|
||||
this.color = params.color || null;
|
||||
this.thickness = params.thickness || null;
|
||||
this.opacity = params.opacity || null;
|
||||
this.paths = [];
|
||||
this.bezierPath2D = [];
|
||||
this.currentPath = [];
|
||||
@ -11486,6 +11540,10 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
case _util.AnnotationEditorParamsType.INK_COLOR:
|
||||
InkEditor._defaultColor = value;
|
||||
break;
|
||||
|
||||
case _util.AnnotationEditorParamsType.INK_OPACITY:
|
||||
InkEditor._defaultOpacity = value / 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11498,15 +11556,19 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
case _util.AnnotationEditorParamsType.INK_COLOR:
|
||||
this.#updateColor(value);
|
||||
break;
|
||||
|
||||
case _util.AnnotationEditorParamsType.INK_OPACITY:
|
||||
this.#updateOpacity(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static get defaultPropertiesToUpdate() {
|
||||
return [[_util.AnnotationEditorParamsType.INK_THICKNESS, InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor]];
|
||||
return [[_util.AnnotationEditorParamsType.INK_THICKNESS, InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(InkEditor._defaultOpacity * 100)]];
|
||||
}
|
||||
|
||||
get propertiesToUpdate() {
|
||||
return [[_util.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, this.color || InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor]];
|
||||
return [[_util.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, this.color || InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? InkEditor._defaultOpacity))]];
|
||||
}
|
||||
|
||||
#updateThickness(thickness) {
|
||||
@ -11545,6 +11607,25 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
});
|
||||
}
|
||||
|
||||
#updateOpacity(opacity) {
|
||||
opacity /= 100;
|
||||
const savedOpacity = this.opacity;
|
||||
this.parent.addCommands({
|
||||
cmd: () => {
|
||||
this.opacity = opacity;
|
||||
this.#redraw();
|
||||
},
|
||||
undo: () => {
|
||||
this.opacity = savedOpacity;
|
||||
this.#redraw();
|
||||
},
|
||||
mustExec: true,
|
||||
type: _util.AnnotationEditorParamsType.INK_OPACITY,
|
||||
overwriteIfSameType: true,
|
||||
keepUndo: true
|
||||
});
|
||||
}
|
||||
|
||||
rebuild() {
|
||||
super.rebuild();
|
||||
|
||||
@ -11640,7 +11721,7 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
this.ctx.lineCap = "round";
|
||||
this.ctx.lineJoin = "round";
|
||||
this.ctx.miterLimit = 10;
|
||||
this.ctx.strokeStyle = this.color;
|
||||
this.ctx.strokeStyle = `${this.color}${(0, _tools.opacityToHex)(this.opacity)}`;
|
||||
}
|
||||
|
||||
#startDrawing(x, y) {
|
||||
@ -11651,27 +11732,64 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
this.#setCanvasDims();
|
||||
this.thickness ||= InkEditor._defaultThickness;
|
||||
this.color ||= InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor;
|
||||
this.opacity ??= InkEditor._defaultOpacity;
|
||||
}
|
||||
|
||||
this.currentPath.push([x, y]);
|
||||
this.#lastPoint = null;
|
||||
this.#setStroke();
|
||||
this.ctx.beginPath();
|
||||
this.ctx.moveTo(x, y);
|
||||
|
||||
this.#requestFrameCallback = () => {
|
||||
if (!this.#requestFrameCallback) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.#lastPoint) {
|
||||
if (this.isEmpty()) {
|
||||
this.ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
||||
} else {
|
||||
this.#redraw();
|
||||
}
|
||||
|
||||
this.ctx.lineTo(...this.#lastPoint);
|
||||
this.#lastPoint = null;
|
||||
this.ctx.stroke();
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(this.#requestFrameCallback);
|
||||
};
|
||||
|
||||
window.requestAnimationFrame(this.#requestFrameCallback);
|
||||
}
|
||||
|
||||
#draw(x, y) {
|
||||
const [lastX, lastY] = this.currentPath.at(-1);
|
||||
|
||||
if (x === lastX && y === lastY) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentPath.push([x, y]);
|
||||
this.ctx.lineTo(x, y);
|
||||
this.ctx.stroke();
|
||||
this.#lastPoint = [x, y];
|
||||
}
|
||||
|
||||
#stopDrawing(x, y) {
|
||||
this.ctx.closePath();
|
||||
this.#requestFrameCallback = null;
|
||||
x = Math.min(Math.max(x, 0), this.canvas.width);
|
||||
y = Math.min(Math.max(y, 0), this.canvas.height);
|
||||
this.currentPath.push([x, y]);
|
||||
const [lastX, lastY] = this.currentPath.at(-1);
|
||||
|
||||
if (x !== lastX || y !== lastY) {
|
||||
this.currentPath.push([x, y]);
|
||||
}
|
||||
|
||||
let bezier;
|
||||
|
||||
if (this.currentPath.length !== 2 || this.currentPath[0][0] !== x || this.currentPath[0][1] !== y) {
|
||||
if (this.currentPath.length !== 1) {
|
||||
bezier = (0, _pdfjsFitCurve.fitCurve)(this.currentPath, 30, null);
|
||||
} else {
|
||||
const xy = [x, y];
|
||||
@ -11711,21 +11829,18 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
}
|
||||
|
||||
#redraw() {
|
||||
this.#setStroke();
|
||||
|
||||
if (this.isEmpty()) {
|
||||
this.#updateTransform();
|
||||
return;
|
||||
}
|
||||
|
||||
const [parentWidth, parentHeight] = this.parent.viewportBaseDimensions;
|
||||
this.#setStroke();
|
||||
const {
|
||||
ctx,
|
||||
height,
|
||||
width
|
||||
canvas,
|
||||
ctx
|
||||
} = this;
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
ctx.clearRect(0, 0, width * parentWidth, height * parentHeight);
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
this.#updateTransform();
|
||||
|
||||
for (const path of this.bezierPath2D) {
|
||||
@ -12080,6 +12195,7 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
const editor = super.deserialize(data, parent);
|
||||
editor.thickness = data.thickness;
|
||||
editor.color = _util.Util.makeHexColor(...data.color);
|
||||
editor.opacity = data.opacity;
|
||||
const [pageWidth, pageHeight] = parent.pageDimensions;
|
||||
const width = editor.width * pageWidth;
|
||||
const height = editor.height * pageHeight;
|
||||
@ -12135,6 +12251,7 @@ class InkEditor extends _editor.AnnotationEditor {
|
||||
annotationType: _util.AnnotationEditorType.INK,
|
||||
color,
|
||||
thickness: this.thickness,
|
||||
opacity: this.opacity,
|
||||
paths: this.#serializePaths(this.scaleFactor / this.parent.scaleFactor, this.translationX, this.translationY, height),
|
||||
pageIndex: this.parent.pageIndex,
|
||||
rect,
|
||||
@ -16325,8 +16442,8 @@ var _svg = __w_pdfjs_require__(30);
|
||||
|
||||
var _xfa_layer = __w_pdfjs_require__(28);
|
||||
|
||||
const pdfjsVersion = '2.15.303';
|
||||
const pdfjsBuild = 'bf0006873';
|
||||
const pdfjsVersion = '2.15.322';
|
||||
const pdfjsBuild = 'b06d19045';
|
||||
;
|
||||
})();
|
||||
|
||||
|
@ -5068,8 +5068,8 @@ Object.defineProperty(exports, "initSandbox", ({
|
||||
|
||||
var _initialization = __w_pdfjs_require__(1);
|
||||
|
||||
const pdfjsVersion = '2.15.303';
|
||||
const pdfjsBuild = 'bf0006873';
|
||||
const pdfjsVersion = '2.15.322';
|
||||
const pdfjsBuild = 'b06d19045';
|
||||
})();
|
||||
|
||||
/******/ return __webpack_exports__;
|
||||
|
@ -117,7 +117,7 @@ class WorkerMessageHandler {
|
||||
const WorkerTasks = [];
|
||||
const verbosity = (0, _util.getVerbosityLevel)();
|
||||
const apiVersion = docParams.apiVersion;
|
||||
const workerVersion = '2.15.303';
|
||||
const workerVersion = '2.15.322';
|
||||
|
||||
if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||
@ -773,10 +773,12 @@ const AnnotationEditorType = {
|
||||
};
|
||||
exports.AnnotationEditorType = AnnotationEditorType;
|
||||
const AnnotationEditorParamsType = {
|
||||
FREETEXT_SIZE: 0,
|
||||
FREETEXT_COLOR: 1,
|
||||
INK_COLOR: 2,
|
||||
INK_THICKNESS: 3
|
||||
FREETEXT_SIZE: 1,
|
||||
FREETEXT_COLOR: 2,
|
||||
FREETEXT_OPACITY: 3,
|
||||
INK_COLOR: 11,
|
||||
INK_THICKNESS: 12,
|
||||
INK_OPACITY: 13
|
||||
};
|
||||
exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
|
||||
const PermissionFlag = {
|
||||
@ -9459,7 +9461,8 @@ class InkAnnotation extends MarkupAnnotation {
|
||||
rect,
|
||||
rotation,
|
||||
paths,
|
||||
thickness
|
||||
thickness,
|
||||
opacity
|
||||
} = annotation;
|
||||
const [x1, y1, x2, y2] = rect;
|
||||
let w = x2 - x1;
|
||||
@ -9470,6 +9473,11 @@ class InkAnnotation extends MarkupAnnotation {
|
||||
}
|
||||
|
||||
const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
|
||||
|
||||
if (opacity !== 1) {
|
||||
appearanceBuffer.push("/R0 gs");
|
||||
}
|
||||
|
||||
const buffer = [];
|
||||
|
||||
for (const {
|
||||
@ -9501,6 +9509,17 @@ class InkAnnotation extends MarkupAnnotation {
|
||||
appearanceStreamDict.set("Matrix", matrix);
|
||||
}
|
||||
|
||||
if (opacity !== 1) {
|
||||
const resources = new _primitives.Dict(xref);
|
||||
const extGState = new _primitives.Dict(xref);
|
||||
const r0 = new _primitives.Dict(xref);
|
||||
r0.set("CA", opacity);
|
||||
r0.set("Type", _primitives.Name.get("ExtGState"));
|
||||
extGState.set("R0", r0);
|
||||
resources.set("ExtGState", extGState);
|
||||
appearanceStreamDict.set("Resources", resources);
|
||||
}
|
||||
|
||||
const ap = new _stream.StringStream(appearance);
|
||||
ap.dict = appearanceStreamDict;
|
||||
return ap;
|
||||
@ -41827,26 +41846,35 @@ class PDFImage {
|
||||
this.image = image;
|
||||
const dict = image.dict;
|
||||
const filter = dict.get("F", "Filter");
|
||||
let filterName;
|
||||
|
||||
if (filter instanceof _primitives.Name) {
|
||||
switch (filter.name) {
|
||||
case "JPXDecode":
|
||||
const jpxImage = new _jpx.JpxImage();
|
||||
jpxImage.parseImageProperties(image.stream);
|
||||
image.stream.reset();
|
||||
image.width = jpxImage.width;
|
||||
image.height = jpxImage.height;
|
||||
image.bitsPerComponent = jpxImage.bitsPerComponent;
|
||||
image.numComps = jpxImage.componentsCount;
|
||||
break;
|
||||
filterName = filter.name;
|
||||
} else if (Array.isArray(filter)) {
|
||||
const filterZero = xref.fetchIfRef(filter[0]);
|
||||
|
||||
case "JBIG2Decode":
|
||||
image.bitsPerComponent = 1;
|
||||
image.numComps = 1;
|
||||
break;
|
||||
if (filterZero instanceof _primitives.Name) {
|
||||
filterName = filterZero.name;
|
||||
}
|
||||
}
|
||||
|
||||
switch (filterName) {
|
||||
case "JPXDecode":
|
||||
const jpxImage = new _jpx.JpxImage();
|
||||
jpxImage.parseImageProperties(image.stream);
|
||||
image.stream.reset();
|
||||
image.width = jpxImage.width;
|
||||
image.height = jpxImage.height;
|
||||
image.bitsPerComponent = jpxImage.bitsPerComponent;
|
||||
image.numComps = jpxImage.componentsCount;
|
||||
break;
|
||||
|
||||
case "JBIG2Decode":
|
||||
image.bitsPerComponent = 1;
|
||||
image.numComps = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
let width = dict.get("W", "Width");
|
||||
let height = dict.get("H", "Height");
|
||||
|
||||
@ -63270,8 +63298,8 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
|
||||
|
||||
var _worker = __w_pdfjs_require__(1);
|
||||
|
||||
const pdfjsVersion = '2.15.303';
|
||||
const pdfjsBuild = 'bf0006873';
|
||||
const pdfjsVersion = '2.15.322';
|
||||
const pdfjsBuild = 'b06d19045';
|
||||
})();
|
||||
|
||||
/******/ return __webpack_exports__;
|
||||
|
@ -118,11 +118,11 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
<div class="editorParamsToolbar hidden doorHangerRight" id="editorFreeTextParamsToolbar">
|
||||
<div class="editorParamsToolbarContainer">
|
||||
<div class="editorParamsSetter">
|
||||
<label for="editorFreeTextColor" class="editorParamsLabel" data-l10n-id="editor_free_text_font_color">Font Color</label>
|
||||
<label for="editorFreeTextColor" class="editorParamsLabel" data-l10n-id="editor_free_text_color">Color</label>
|
||||
<input type="color" id="editorFreeTextColor" class="editorParamsColor" tabindex="100">
|
||||
</div>
|
||||
<div class="editorParamsSetter">
|
||||
<label for="editorFreeTextFontSize" class="editorParamsLabel" data-l10n-id="editor_free_text_font_size">Font Size</label>
|
||||
<label for="editorFreeTextFontSize" class="editorParamsLabel" data-l10n-id="editor_free_text_size">Size</label>
|
||||
<input type="range" id="editorFreeTextFontSize" class="editorParamsSlider" value="10" min="5" max="100" step="1" tabindex="101">
|
||||
</div>
|
||||
</div>
|
||||
@ -131,13 +131,17 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
<div class="editorParamsToolbar hidden doorHangerRight" id="editorInkParamsToolbar">
|
||||
<div class="editorParamsToolbarContainer">
|
||||
<div class="editorParamsSetter">
|
||||
<label for="editorInkColor" class="editorParamsLabel" data-l10n-id="editor_ink_line_color">Line Color</label>
|
||||
<label for="editorInkColor" class="editorParamsLabel" data-l10n-id="editor_ink_color">Color</label>
|
||||
<input type="color" id="editorInkColor" class="editorParamsColor" tabindex="102">
|
||||
</div>
|
||||
<div class="editorParamsSetter">
|
||||
<label for="editorInkThickness" class="editorParamsLabel" data-l10n-id="editor_ink_line_thickness">Line Thickness</label>
|
||||
<label for="editorInkThickness" class="editorParamsLabel" data-l10n-id="editor_ink_thickness">Thickness</label>
|
||||
<input type="range" id="editorInkThickness" class="editorParamsSlider" value="1" min="1" max="20" step="1" tabindex="103">
|
||||
</div>
|
||||
<div class="editorParamsSetter">
|
||||
<label for="editorInkOpacity" class="editorParamsLabel" data-l10n-id="editor_ink_opacity">Opacity</label>
|
||||
<input type="range" id="editorInkOpacity" class="editorParamsSlider" value="100" min="1" max="100" step="1" tabindex="104">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -4398,7 +4398,8 @@ class AnnotationEditorParams {
|
||||
editorFreeTextFontSize,
|
||||
editorFreeTextColor,
|
||||
editorInkColor,
|
||||
editorInkThickness
|
||||
editorInkThickness,
|
||||
editorInkOpacity
|
||||
}) {
|
||||
editorFreeTextFontSize.addEventListener("input", evt => {
|
||||
this.eventBus.dispatch("switchannotationeditorparams", {
|
||||
@ -4428,6 +4429,13 @@ class AnnotationEditorParams {
|
||||
value: editorInkThickness.valueAsNumber
|
||||
});
|
||||
});
|
||||
editorInkOpacity.addEventListener("input", evt => {
|
||||
this.eventBus.dispatch("switchannotationeditorparams", {
|
||||
source: this,
|
||||
type: _pdfjsLib.AnnotationEditorParamsType.INK_OPACITY,
|
||||
value: editorInkOpacity.valueAsNumber
|
||||
});
|
||||
});
|
||||
|
||||
this.eventBus._on("annotationeditorparamschanged", evt => {
|
||||
for (const [type, value] of evt.details) {
|
||||
@ -4447,6 +4455,10 @@ class AnnotationEditorParams {
|
||||
case _pdfjsLib.AnnotationEditorParamsType.INK_THICKNESS:
|
||||
editorInkThickness.value = value;
|
||||
break;
|
||||
|
||||
case _pdfjsLib.AnnotationEditorParamsType.INK_OPACITY:
|
||||
editorInkOpacity.value = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -9724,7 +9736,7 @@ class BaseViewer {
|
||||
throw new Error("Cannot initialize BaseViewer.");
|
||||
}
|
||||
|
||||
const viewerVersion = '2.15.303';
|
||||
const viewerVersion = '2.15.322';
|
||||
|
||||
if (_pdfjsLib.version !== viewerVersion) {
|
||||
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
|
||||
@ -14821,8 +14833,8 @@ var _app_options = __webpack_require__(1);
|
||||
|
||||
var _app = __webpack_require__(2);
|
||||
|
||||
const pdfjsVersion = '2.15.303';
|
||||
const pdfjsBuild = 'bf0006873';
|
||||
const pdfjsVersion = '2.15.322';
|
||||
const pdfjsBuild = 'b06d19045';
|
||||
window.PDFViewerApplication = _app.PDFViewerApplication;
|
||||
window.PDFViewerApplicationOptions = _app_options.AppOptions;
|
||||
;
|
||||
@ -14949,7 +14961,8 @@ function getViewerConfiguration() {
|
||||
editorFreeTextFontSize: document.getElementById("editorFreeTextFontSize"),
|
||||
editorFreeTextColor: document.getElementById("editorFreeTextColor"),
|
||||
editorInkColor: document.getElementById("editorInkColor"),
|
||||
editorInkThickness: document.getElementById("editorInkThickness")
|
||||
editorInkThickness: document.getElementById("editorInkThickness"),
|
||||
editorInkOpacity: document.getElementById("editorInkOpacity")
|
||||
},
|
||||
errorWrapper,
|
||||
printContainer: document.getElementById("printContainer"),
|
||||
|
@ -20,8 +20,8 @@ origin:
|
||||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: bf000687313b08924186f9f35a604f8cce27bd1d (2022-07-13T16:44:23Z).
|
||||
revision: bf000687313b08924186f9f35a604f8cce27bd1d
|
||||
release: b06d1904519d2270a191e44ef1290188ac8dbc46 (2022-07-28T10:21:23Z).
|
||||
revision: b06d1904519d2270a191e44ef1290188ac8dbc46
|
||||
|
||||
# The package's license, where possible using the mnemonic from
|
||||
# https://spdx.org/licenses/
|
||||
|
@ -213,7 +213,12 @@ async function addFreeText(browser, text, box) {
|
||||
const { x, y, width, height } = box;
|
||||
await clickAt(browser, x + 0.1 * width, y + 0.5 * height);
|
||||
await write(browser, text);
|
||||
await clickAt(browser, x + 0.1 * width, y + 2 * height);
|
||||
|
||||
// Commit.
|
||||
EventUtils.synthesizeKey("KEY_Escape");
|
||||
|
||||
// Unselect.
|
||||
EventUtils.synthesizeKey("KEY_Escape");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user