Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/embedpre.../assets/pdf/build
File: script.js
this.current.textRenderingMode = mode;
[12000] Fix | Delete
}
[12001] Fix | Delete
setTextRise(rise) {
[12002] Fix | Delete
this.current.textRise = rise;
[12003] Fix | Delete
}
[12004] Fix | Delete
moveText(x, y) {
[12005] Fix | Delete
this.current.x = this.current.lineX += x;
[12006] Fix | Delete
this.current.y = this.current.lineY += y;
[12007] Fix | Delete
}
[12008] Fix | Delete
setLeadingMoveText(x, y) {
[12009] Fix | Delete
this.setLeading(-y);
[12010] Fix | Delete
this.moveText(x, y);
[12011] Fix | Delete
}
[12012] Fix | Delete
setTextMatrix(a, b, c, d, e, f) {
[12013] Fix | Delete
this.current.textMatrix = [a, b, c, d, e, f];
[12014] Fix | Delete
this.current.textMatrixScale = Math.hypot(a, b);
[12015] Fix | Delete
this.current.x = this.current.lineX = 0;
[12016] Fix | Delete
this.current.y = this.current.lineY = 0;
[12017] Fix | Delete
}
[12018] Fix | Delete
nextLine() {
[12019] Fix | Delete
this.moveText(0, this.current.leading);
[12020] Fix | Delete
}
[12021] Fix | Delete
paintChar(character, x, y, patternTransform) {
[12022] Fix | Delete
const ctx = this.ctx;
[12023] Fix | Delete
const current = this.current;
[12024] Fix | Delete
const font = current.font;
[12025] Fix | Delete
const textRenderingMode = current.textRenderingMode;
[12026] Fix | Delete
const fontSize = current.fontSize / current.fontSizeScale;
[12027] Fix | Delete
const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
[12028] Fix | Delete
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
[12029] Fix | Delete
const patternFill = current.patternFill && !font.missingFile;
[12030] Fix | Delete
let addToPath;
[12031] Fix | Delete
if (font.disableFontFace || isAddToPathSet || patternFill) {
[12032] Fix | Delete
addToPath = font.getPathGenerator(this.commonObjs, character);
[12033] Fix | Delete
}
[12034] Fix | Delete
if (font.disableFontFace || patternFill) {
[12035] Fix | Delete
ctx.save();
[12036] Fix | Delete
ctx.translate(x, y);
[12037] Fix | Delete
ctx.beginPath();
[12038] Fix | Delete
addToPath(ctx, fontSize);
[12039] Fix | Delete
if (patternTransform) {
[12040] Fix | Delete
ctx.setTransform(...patternTransform);
[12041] Fix | Delete
}
[12042] Fix | Delete
if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
[12043] Fix | Delete
ctx.fill();
[12044] Fix | Delete
}
[12045] Fix | Delete
if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
[12046] Fix | Delete
ctx.stroke();
[12047] Fix | Delete
}
[12048] Fix | Delete
ctx.restore();
[12049] Fix | Delete
} else {
[12050] Fix | Delete
if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
[12051] Fix | Delete
ctx.fillText(character, x, y);
[12052] Fix | Delete
}
[12053] Fix | Delete
if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
[12054] Fix | Delete
ctx.strokeText(character, x, y);
[12055] Fix | Delete
}
[12056] Fix | Delete
}
[12057] Fix | Delete
if (isAddToPathSet) {
[12058] Fix | Delete
const paths = this.pendingTextPaths ||= [];
[12059] Fix | Delete
paths.push({
[12060] Fix | Delete
transform: getCurrentTransform(ctx),
[12061] Fix | Delete
x,
[12062] Fix | Delete
y,
[12063] Fix | Delete
fontSize,
[12064] Fix | Delete
addToPath
[12065] Fix | Delete
});
[12066] Fix | Delete
}
[12067] Fix | Delete
}
[12068] Fix | Delete
get isFontSubpixelAAEnabled() {
[12069] Fix | Delete
const {
[12070] Fix | Delete
context: ctx
[12071] Fix | Delete
} = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10);
[12072] Fix | Delete
ctx.scale(1.5, 1);
[12073] Fix | Delete
ctx.fillText("I", 0, 10);
[12074] Fix | Delete
const data = ctx.getImageData(0, 0, 10, 10).data;
[12075] Fix | Delete
let enabled = false;
[12076] Fix | Delete
for (let i = 3; i < data.length; i += 4) {
[12077] Fix | Delete
if (data[i] > 0 && data[i] < 255) {
[12078] Fix | Delete
enabled = true;
[12079] Fix | Delete
break;
[12080] Fix | Delete
}
[12081] Fix | Delete
}
[12082] Fix | Delete
return shadow(this, "isFontSubpixelAAEnabled", enabled);
[12083] Fix | Delete
}
[12084] Fix | Delete
showText(glyphs) {
[12085] Fix | Delete
const current = this.current;
[12086] Fix | Delete
const font = current.font;
[12087] Fix | Delete
if (font.isType3Font) {
[12088] Fix | Delete
return this.showType3Text(glyphs);
[12089] Fix | Delete
}
[12090] Fix | Delete
const fontSize = current.fontSize;
[12091] Fix | Delete
if (fontSize === 0) {
[12092] Fix | Delete
return undefined;
[12093] Fix | Delete
}
[12094] Fix | Delete
const ctx = this.ctx;
[12095] Fix | Delete
const fontSizeScale = current.fontSizeScale;
[12096] Fix | Delete
const charSpacing = current.charSpacing;
[12097] Fix | Delete
const wordSpacing = current.wordSpacing;
[12098] Fix | Delete
const fontDirection = current.fontDirection;
[12099] Fix | Delete
const textHScale = current.textHScale * fontDirection;
[12100] Fix | Delete
const glyphsLength = glyphs.length;
[12101] Fix | Delete
const vertical = font.vertical;
[12102] Fix | Delete
const spacingDir = vertical ? 1 : -1;
[12103] Fix | Delete
const defaultVMetrics = font.defaultVMetrics;
[12104] Fix | Delete
const widthAdvanceScale = fontSize * current.fontMatrix[0];
[12105] Fix | Delete
const simpleFillText = current.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
[12106] Fix | Delete
ctx.save();
[12107] Fix | Delete
ctx.transform(...current.textMatrix);
[12108] Fix | Delete
ctx.translate(current.x, current.y + current.textRise);
[12109] Fix | Delete
if (fontDirection > 0) {
[12110] Fix | Delete
ctx.scale(textHScale, -1);
[12111] Fix | Delete
} else {
[12112] Fix | Delete
ctx.scale(textHScale, 1);
[12113] Fix | Delete
}
[12114] Fix | Delete
let patternTransform;
[12115] Fix | Delete
if (current.patternFill) {
[12116] Fix | Delete
ctx.save();
[12117] Fix | Delete
const pattern = current.fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL);
[12118] Fix | Delete
patternTransform = getCurrentTransform(ctx);
[12119] Fix | Delete
ctx.restore();
[12120] Fix | Delete
ctx.fillStyle = pattern;
[12121] Fix | Delete
}
[12122] Fix | Delete
let lineWidth = current.lineWidth;
[12123] Fix | Delete
const scale = current.textMatrixScale;
[12124] Fix | Delete
if (scale === 0 || lineWidth === 0) {
[12125] Fix | Delete
const fillStrokeMode = current.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
[12126] Fix | Delete
if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
[12127] Fix | Delete
lineWidth = this.getSinglePixelWidth();
[12128] Fix | Delete
}
[12129] Fix | Delete
} else {
[12130] Fix | Delete
lineWidth /= scale;
[12131] Fix | Delete
}
[12132] Fix | Delete
if (fontSizeScale !== 1.0) {
[12133] Fix | Delete
ctx.scale(fontSizeScale, fontSizeScale);
[12134] Fix | Delete
lineWidth /= fontSizeScale;
[12135] Fix | Delete
}
[12136] Fix | Delete
ctx.lineWidth = lineWidth;
[12137] Fix | Delete
if (font.isInvalidPDFjsFont) {
[12138] Fix | Delete
const chars = [];
[12139] Fix | Delete
let width = 0;
[12140] Fix | Delete
for (const glyph of glyphs) {
[12141] Fix | Delete
chars.push(glyph.unicode);
[12142] Fix | Delete
width += glyph.width;
[12143] Fix | Delete
}
[12144] Fix | Delete
ctx.fillText(chars.join(""), 0, 0);
[12145] Fix | Delete
current.x += width * widthAdvanceScale * textHScale;
[12146] Fix | Delete
ctx.restore();
[12147] Fix | Delete
this.compose();
[12148] Fix | Delete
return undefined;
[12149] Fix | Delete
}
[12150] Fix | Delete
let x = 0,
[12151] Fix | Delete
i;
[12152] Fix | Delete
for (i = 0; i < glyphsLength; ++i) {
[12153] Fix | Delete
const glyph = glyphs[i];
[12154] Fix | Delete
if (typeof glyph === "number") {
[12155] Fix | Delete
x += spacingDir * glyph * fontSize / 1000;
[12156] Fix | Delete
continue;
[12157] Fix | Delete
}
[12158] Fix | Delete
let restoreNeeded = false;
[12159] Fix | Delete
const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
[12160] Fix | Delete
const character = glyph.fontChar;
[12161] Fix | Delete
const accent = glyph.accent;
[12162] Fix | Delete
let scaledX, scaledY;
[12163] Fix | Delete
let width = glyph.width;
[12164] Fix | Delete
if (vertical) {
[12165] Fix | Delete
const vmetric = glyph.vmetric || defaultVMetrics;
[12166] Fix | Delete
const vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale;
[12167] Fix | Delete
const vy = vmetric[2] * widthAdvanceScale;
[12168] Fix | Delete
width = vmetric ? -vmetric[0] : width;
[12169] Fix | Delete
scaledX = vx / fontSizeScale;
[12170] Fix | Delete
scaledY = (x + vy) / fontSizeScale;
[12171] Fix | Delete
} else {
[12172] Fix | Delete
scaledX = x / fontSizeScale;
[12173] Fix | Delete
scaledY = 0;
[12174] Fix | Delete
}
[12175] Fix | Delete
if (font.remeasure && width > 0) {
[12176] Fix | Delete
const measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale;
[12177] Fix | Delete
if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
[12178] Fix | Delete
const characterScaleX = width / measuredWidth;
[12179] Fix | Delete
restoreNeeded = true;
[12180] Fix | Delete
ctx.save();
[12181] Fix | Delete
ctx.scale(characterScaleX, 1);
[12182] Fix | Delete
scaledX /= characterScaleX;
[12183] Fix | Delete
} else if (width !== measuredWidth) {
[12184] Fix | Delete
scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale;
[12185] Fix | Delete
}
[12186] Fix | Delete
}
[12187] Fix | Delete
if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
[12188] Fix | Delete
if (simpleFillText && !accent) {
[12189] Fix | Delete
ctx.fillText(character, scaledX, scaledY);
[12190] Fix | Delete
} else {
[12191] Fix | Delete
this.paintChar(character, scaledX, scaledY, patternTransform);
[12192] Fix | Delete
if (accent) {
[12193] Fix | Delete
const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;
[12194] Fix | Delete
const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;
[12195] Fix | Delete
this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform);
[12196] Fix | Delete
}
[12197] Fix | Delete
}
[12198] Fix | Delete
}
[12199] Fix | Delete
const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
[12200] Fix | Delete
x += charWidth;
[12201] Fix | Delete
if (restoreNeeded) {
[12202] Fix | Delete
ctx.restore();
[12203] Fix | Delete
}
[12204] Fix | Delete
}
[12205] Fix | Delete
if (vertical) {
[12206] Fix | Delete
current.y -= x;
[12207] Fix | Delete
} else {
[12208] Fix | Delete
current.x += x * textHScale;
[12209] Fix | Delete
}
[12210] Fix | Delete
ctx.restore();
[12211] Fix | Delete
this.compose();
[12212] Fix | Delete
return undefined;
[12213] Fix | Delete
}
[12214] Fix | Delete
showType3Text(glyphs) {
[12215] Fix | Delete
const ctx = this.ctx;
[12216] Fix | Delete
const current = this.current;
[12217] Fix | Delete
const font = current.font;
[12218] Fix | Delete
const fontSize = current.fontSize;
[12219] Fix | Delete
const fontDirection = current.fontDirection;
[12220] Fix | Delete
const spacingDir = font.vertical ? 1 : -1;
[12221] Fix | Delete
const charSpacing = current.charSpacing;
[12222] Fix | Delete
const wordSpacing = current.wordSpacing;
[12223] Fix | Delete
const textHScale = current.textHScale * fontDirection;
[12224] Fix | Delete
const fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;
[12225] Fix | Delete
const glyphsLength = glyphs.length;
[12226] Fix | Delete
const isTextInvisible = current.textRenderingMode === TextRenderingMode.INVISIBLE;
[12227] Fix | Delete
let i, glyph, width, spacingLength;
[12228] Fix | Delete
if (isTextInvisible || fontSize === 0) {
[12229] Fix | Delete
return;
[12230] Fix | Delete
}
[12231] Fix | Delete
this._cachedScaleForStroking[0] = -1;
[12232] Fix | Delete
this._cachedGetSinglePixelWidth = null;
[12233] Fix | Delete
ctx.save();
[12234] Fix | Delete
ctx.transform(...current.textMatrix);
[12235] Fix | Delete
ctx.translate(current.x, current.y);
[12236] Fix | Delete
ctx.scale(textHScale, fontDirection);
[12237] Fix | Delete
for (i = 0; i < glyphsLength; ++i) {
[12238] Fix | Delete
glyph = glyphs[i];
[12239] Fix | Delete
if (typeof glyph === "number") {
[12240] Fix | Delete
spacingLength = spacingDir * glyph * fontSize / 1000;
[12241] Fix | Delete
this.ctx.translate(spacingLength, 0);
[12242] Fix | Delete
current.x += spacingLength * textHScale;
[12243] Fix | Delete
continue;
[12244] Fix | Delete
}
[12245] Fix | Delete
const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
[12246] Fix | Delete
const operatorList = font.charProcOperatorList[glyph.operatorListId];
[12247] Fix | Delete
if (!operatorList) {
[12248] Fix | Delete
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
[12249] Fix | Delete
continue;
[12250] Fix | Delete
}
[12251] Fix | Delete
if (this.contentVisible) {
[12252] Fix | Delete
this.processingType3 = glyph;
[12253] Fix | Delete
this.save();
[12254] Fix | Delete
ctx.scale(fontSize, fontSize);
[12255] Fix | Delete
ctx.transform(...fontMatrix);
[12256] Fix | Delete
this.executeOperatorList(operatorList);
[12257] Fix | Delete
this.restore();
[12258] Fix | Delete
}
[12259] Fix | Delete
const transformed = Util.applyTransform([glyph.width, 0], fontMatrix);
[12260] Fix | Delete
width = transformed[0] * fontSize + spacing;
[12261] Fix | Delete
ctx.translate(width, 0);
[12262] Fix | Delete
current.x += width * textHScale;
[12263] Fix | Delete
}
[12264] Fix | Delete
ctx.restore();
[12265] Fix | Delete
this.processingType3 = null;
[12266] Fix | Delete
}
[12267] Fix | Delete
setCharWidth(xWidth, yWidth) {}
[12268] Fix | Delete
setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
[12269] Fix | Delete
this.ctx.rect(llx, lly, urx - llx, ury - lly);
[12270] Fix | Delete
this.ctx.clip();
[12271] Fix | Delete
this.endPath();
[12272] Fix | Delete
}
[12273] Fix | Delete
getColorN_Pattern(IR) {
[12274] Fix | Delete
let pattern;
[12275] Fix | Delete
if (IR[0] === "TilingPattern") {
[12276] Fix | Delete
const color = IR[1];
[12277] Fix | Delete
const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
[12278] Fix | Delete
const canvasGraphicsFactory = {
[12279] Fix | Delete
createCanvasGraphics: ctx => new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
[12280] Fix | Delete
optionalContentConfig: this.optionalContentConfig,
[12281] Fix | Delete
markedContentStack: this.markedContentStack
[12282] Fix | Delete
})
[12283] Fix | Delete
};
[12284] Fix | Delete
pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
[12285] Fix | Delete
} else {
[12286] Fix | Delete
pattern = this._getPattern(IR[1], IR[2]);
[12287] Fix | Delete
}
[12288] Fix | Delete
return pattern;
[12289] Fix | Delete
}
[12290] Fix | Delete
setStrokeColorN() {
[12291] Fix | Delete
this.current.strokeColor = this.getColorN_Pattern(arguments);
[12292] Fix | Delete
}
[12293] Fix | Delete
setFillColorN() {
[12294] Fix | Delete
this.current.fillColor = this.getColorN_Pattern(arguments);
[12295] Fix | Delete
this.current.patternFill = true;
[12296] Fix | Delete
}
[12297] Fix | Delete
setStrokeRGBColor(r, g, b) {
[12298] Fix | Delete
const color = Util.makeHexColor(r, g, b);
[12299] Fix | Delete
this.ctx.strokeStyle = color;
[12300] Fix | Delete
this.current.strokeColor = color;
[12301] Fix | Delete
}
[12302] Fix | Delete
setFillRGBColor(r, g, b) {
[12303] Fix | Delete
const color = Util.makeHexColor(r, g, b);
[12304] Fix | Delete
this.ctx.fillStyle = color;
[12305] Fix | Delete
this.current.fillColor = color;
[12306] Fix | Delete
this.current.patternFill = false;
[12307] Fix | Delete
}
[12308] Fix | Delete
_getPattern(objId, matrix = null) {
[12309] Fix | Delete
let pattern;
[12310] Fix | Delete
if (this.cachedPatterns.has(objId)) {
[12311] Fix | Delete
pattern = this.cachedPatterns.get(objId);
[12312] Fix | Delete
} else {
[12313] Fix | Delete
pattern = getShadingPattern(this.getObject(objId));
[12314] Fix | Delete
this.cachedPatterns.set(objId, pattern);
[12315] Fix | Delete
}
[12316] Fix | Delete
if (matrix) {
[12317] Fix | Delete
pattern.matrix = matrix;
[12318] Fix | Delete
}
[12319] Fix | Delete
return pattern;
[12320] Fix | Delete
}
[12321] Fix | Delete
shadingFill(objId) {
[12322] Fix | Delete
if (!this.contentVisible) {
[12323] Fix | Delete
return;
[12324] Fix | Delete
}
[12325] Fix | Delete
const ctx = this.ctx;
[12326] Fix | Delete
this.save();
[12327] Fix | Delete
const pattern = this._getPattern(objId);
[12328] Fix | Delete
ctx.fillStyle = pattern.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.SHADING);
[12329] Fix | Delete
const inv = getCurrentTransformInverse(ctx);
[12330] Fix | Delete
if (inv) {
[12331] Fix | Delete
const {
[12332] Fix | Delete
width,
[12333] Fix | Delete
height
[12334] Fix | Delete
} = ctx.canvas;
[12335] Fix | Delete
const [x0, y0, x1, y1] = Util.getAxialAlignedBoundingBox([0, 0, width, height], inv);
[12336] Fix | Delete
this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
[12337] Fix | Delete
} else {
[12338] Fix | Delete
this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
[12339] Fix | Delete
}
[12340] Fix | Delete
this.compose(this.current.getClippedPathBoundingBox());
[12341] Fix | Delete
this.restore();
[12342] Fix | Delete
}
[12343] Fix | Delete
beginInlineImage() {
[12344] Fix | Delete
unreachable("Should not call beginInlineImage");
[12345] Fix | Delete
}
[12346] Fix | Delete
beginImageData() {
[12347] Fix | Delete
unreachable("Should not call beginImageData");
[12348] Fix | Delete
}
[12349] Fix | Delete
paintFormXObjectBegin(matrix, bbox) {
[12350] Fix | Delete
if (!this.contentVisible) {
[12351] Fix | Delete
return;
[12352] Fix | Delete
}
[12353] Fix | Delete
this.save();
[12354] Fix | Delete
this.baseTransformStack.push(this.baseTransform);
[12355] Fix | Delete
if (matrix) {
[12356] Fix | Delete
this.transform(...matrix);
[12357] Fix | Delete
}
[12358] Fix | Delete
this.baseTransform = getCurrentTransform(this.ctx);
[12359] Fix | Delete
if (bbox) {
[12360] Fix | Delete
const width = bbox[2] - bbox[0];
[12361] Fix | Delete
const height = bbox[3] - bbox[1];
[12362] Fix | Delete
this.ctx.rect(bbox[0], bbox[1], width, height);
[12363] Fix | Delete
this.current.updateRectMinMax(getCurrentTransform(this.ctx), bbox);
[12364] Fix | Delete
this.clip();
[12365] Fix | Delete
this.endPath();
[12366] Fix | Delete
}
[12367] Fix | Delete
}
[12368] Fix | Delete
paintFormXObjectEnd() {
[12369] Fix | Delete
if (!this.contentVisible) {
[12370] Fix | Delete
return;
[12371] Fix | Delete
}
[12372] Fix | Delete
this.restore();
[12373] Fix | Delete
this.baseTransform = this.baseTransformStack.pop();
[12374] Fix | Delete
}
[12375] Fix | Delete
beginGroup(group) {
[12376] Fix | Delete
if (!this.contentVisible) {
[12377] Fix | Delete
return;
[12378] Fix | Delete
}
[12379] Fix | Delete
this.save();
[12380] Fix | Delete
if (this.inSMaskMode) {
[12381] Fix | Delete
this.endSMaskMode();
[12382] Fix | Delete
this.current.activeSMask = null;
[12383] Fix | Delete
}
[12384] Fix | Delete
const currentCtx = this.ctx;
[12385] Fix | Delete
if (!group.isolated) {
[12386] Fix | Delete
info("TODO: Support non-isolated groups.");
[12387] Fix | Delete
}
[12388] Fix | Delete
if (group.knockout) {
[12389] Fix | Delete
warn("Knockout groups not supported.");
[12390] Fix | Delete
}
[12391] Fix | Delete
const currentTransform = getCurrentTransform(currentCtx);
[12392] Fix | Delete
if (group.matrix) {
[12393] Fix | Delete
currentCtx.transform(...group.matrix);
[12394] Fix | Delete
}
[12395] Fix | Delete
if (!group.bbox) {
[12396] Fix | Delete
throw new Error("Bounding box is required.");
[12397] Fix | Delete
}
[12398] Fix | Delete
let bounds = Util.getAxialAlignedBoundingBox(group.bbox, getCurrentTransform(currentCtx));
[12399] Fix | Delete
const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
[12400] Fix | Delete
bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
[12401] Fix | Delete
const offsetX = Math.floor(bounds[0]);
[12402] Fix | Delete
const offsetY = Math.floor(bounds[1]);
[12403] Fix | Delete
const drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
[12404] Fix | Delete
const drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
[12405] Fix | Delete
this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
[12406] Fix | Delete
let cacheId = "groupAt" + this.groupLevel;
[12407] Fix | Delete
if (group.smask) {
[12408] Fix | Delete
cacheId += "_smask_" + this.smaskCounter++ % 2;
[12409] Fix | Delete
}
[12410] Fix | Delete
const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight);
[12411] Fix | Delete
const groupCtx = scratchCanvas.context;
[12412] Fix | Delete
groupCtx.translate(-offsetX, -offsetY);
[12413] Fix | Delete
groupCtx.transform(...currentTransform);
[12414] Fix | Delete
if (group.smask) {
[12415] Fix | Delete
this.smaskStack.push({
[12416] Fix | Delete
canvas: scratchCanvas.canvas,
[12417] Fix | Delete
context: groupCtx,
[12418] Fix | Delete
offsetX,
[12419] Fix | Delete
offsetY,
[12420] Fix | Delete
subtype: group.smask.subtype,
[12421] Fix | Delete
backdrop: group.smask.backdrop,
[12422] Fix | Delete
transferMap: group.smask.transferMap || null,
[12423] Fix | Delete
startTransformInverse: null
[12424] Fix | Delete
});
[12425] Fix | Delete
} else {
[12426] Fix | Delete
currentCtx.setTransform(1, 0, 0, 1, 0, 0);
[12427] Fix | Delete
currentCtx.translate(offsetX, offsetY);
[12428] Fix | Delete
currentCtx.save();
[12429] Fix | Delete
}
[12430] Fix | Delete
copyCtxState(currentCtx, groupCtx);
[12431] Fix | Delete
this.ctx = groupCtx;
[12432] Fix | Delete
this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
[12433] Fix | Delete
this.groupStack.push(currentCtx);
[12434] Fix | Delete
this.groupLevel++;
[12435] Fix | Delete
}
[12436] Fix | Delete
endGroup(group) {
[12437] Fix | Delete
if (!this.contentVisible) {
[12438] Fix | Delete
return;
[12439] Fix | Delete
}
[12440] Fix | Delete
this.groupLevel--;
[12441] Fix | Delete
const groupCtx = this.ctx;
[12442] Fix | Delete
const ctx = this.groupStack.pop();
[12443] Fix | Delete
this.ctx = ctx;
[12444] Fix | Delete
this.ctx.imageSmoothingEnabled = false;
[12445] Fix | Delete
if (group.smask) {
[12446] Fix | Delete
this.tempSMask = this.smaskStack.pop();
[12447] Fix | Delete
this.restore();
[12448] Fix | Delete
} else {
[12449] Fix | Delete
this.ctx.restore();
[12450] Fix | Delete
const currentMtx = getCurrentTransform(this.ctx);
[12451] Fix | Delete
this.restore();
[12452] Fix | Delete
this.ctx.save();
[12453] Fix | Delete
this.ctx.setTransform(...currentMtx);
[12454] Fix | Delete
const dirtyBox = Util.getAxialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx);
[12455] Fix | Delete
this.ctx.drawImage(groupCtx.canvas, 0, 0);
[12456] Fix | Delete
this.ctx.restore();
[12457] Fix | Delete
this.compose(dirtyBox);
[12458] Fix | Delete
}
[12459] Fix | Delete
}
[12460] Fix | Delete
beginAnnotation(id, rect, transform, matrix, hasOwnCanvas) {
[12461] Fix | Delete
this.#restoreInitialState();
[12462] Fix | Delete
resetCtxToDefault(this.ctx);
[12463] Fix | Delete
this.ctx.save();
[12464] Fix | Delete
this.save();
[12465] Fix | Delete
if (this.baseTransform) {
[12466] Fix | Delete
this.ctx.setTransform(...this.baseTransform);
[12467] Fix | Delete
}
[12468] Fix | Delete
if (rect) {
[12469] Fix | Delete
const width = rect[2] - rect[0];
[12470] Fix | Delete
const height = rect[3] - rect[1];
[12471] Fix | Delete
if (hasOwnCanvas && this.annotationCanvasMap) {
[12472] Fix | Delete
transform = transform.slice();
[12473] Fix | Delete
transform[4] -= rect[0];
[12474] Fix | Delete
transform[5] -= rect[1];
[12475] Fix | Delete
rect = rect.slice();
[12476] Fix | Delete
rect[0] = rect[1] = 0;
[12477] Fix | Delete
rect[2] = width;
[12478] Fix | Delete
rect[3] = height;
[12479] Fix | Delete
const [scaleX, scaleY] = Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx));
[12480] Fix | Delete
const {
[12481] Fix | Delete
viewportScale
[12482] Fix | Delete
} = this;
[12483] Fix | Delete
const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
[12484] Fix | Delete
const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
[12485] Fix | Delete
this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
[12486] Fix | Delete
const {
[12487] Fix | Delete
canvas,
[12488] Fix | Delete
context
[12489] Fix | Delete
} = this.annotationCanvas;
[12490] Fix | Delete
this.annotationCanvasMap.set(id, canvas);
[12491] Fix | Delete
this.annotationCanvas.savedCtx = this.ctx;
[12492] Fix | Delete
this.ctx = context;
[12493] Fix | Delete
this.ctx.save();
[12494] Fix | Delete
this.ctx.setTransform(scaleX, 0, 0, -scaleY, 0, height * scaleY);
[12495] Fix | Delete
resetCtxToDefault(this.ctx);
[12496] Fix | Delete
} else {
[12497] Fix | Delete
resetCtxToDefault(this.ctx);
[12498] Fix | Delete
this.ctx.rect(rect[0], rect[1], width, height);
[12499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function