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/web
File: viewer.js
break;
[11500] Fix | Delete
case SidebarView.LAYERS:
[11501] Fix | Delete
if (this.layersButton.disabled) {
[11502] Fix | Delete
return;
[11503] Fix | Delete
}
[11504] Fix | Delete
break;
[11505] Fix | Delete
default:
[11506] Fix | Delete
console.error(`PDFSidebar.switchView: "${view}" is not a valid view.`);
[11507] Fix | Delete
return;
[11508] Fix | Delete
}
[11509] Fix | Delete
this.active = view;
[11510] Fix | Delete
toggleCheckedBtn(this.thumbnailButton, view === SidebarView.THUMBS, this.thumbnailView);
[11511] Fix | Delete
toggleCheckedBtn(this.outlineButton, view === SidebarView.OUTLINE, this.outlineView);
[11512] Fix | Delete
toggleCheckedBtn(this.attachmentsButton, view === SidebarView.ATTACHMENTS, this.attachmentsView);
[11513] Fix | Delete
toggleCheckedBtn(this.layersButton, view === SidebarView.LAYERS, this.layersView);
[11514] Fix | Delete
if (forceOpen && !this.isOpen) {
[11515] Fix | Delete
this.open();
[11516] Fix | Delete
return;
[11517] Fix | Delete
}
[11518] Fix | Delete
if (forceRendering) {
[11519] Fix | Delete
this.onUpdateThumbnails();
[11520] Fix | Delete
this.onToggled();
[11521] Fix | Delete
}
[11522] Fix | Delete
if (isViewChanged) {
[11523] Fix | Delete
this.#dispatchEvent();
[11524] Fix | Delete
}
[11525] Fix | Delete
}
[11526] Fix | Delete
open() {
[11527] Fix | Delete
if (this.isOpen) {
[11528] Fix | Delete
return;
[11529] Fix | Delete
}
[11530] Fix | Delete
this.isOpen = true;
[11531] Fix | Delete
toggleExpandedBtn(this.toggleButton, true);
[11532] Fix | Delete
this.outerContainer.classList.add("sidebarMoving", "sidebarOpen");
[11533] Fix | Delete
if (this.active === SidebarView.THUMBS) {
[11534] Fix | Delete
this.onUpdateThumbnails();
[11535] Fix | Delete
}
[11536] Fix | Delete
this.onToggled();
[11537] Fix | Delete
this.#dispatchEvent();
[11538] Fix | Delete
this.#hideUINotification();
[11539] Fix | Delete
}
[11540] Fix | Delete
close(evt = null) {
[11541] Fix | Delete
if (!this.isOpen) {
[11542] Fix | Delete
return;
[11543] Fix | Delete
}
[11544] Fix | Delete
this.isOpen = false;
[11545] Fix | Delete
toggleExpandedBtn(this.toggleButton, false);
[11546] Fix | Delete
this.outerContainer.classList.add("sidebarMoving");
[11547] Fix | Delete
this.outerContainer.classList.remove("sidebarOpen");
[11548] Fix | Delete
this.onToggled();
[11549] Fix | Delete
this.#dispatchEvent();
[11550] Fix | Delete
if (evt?.detail > 0) {
[11551] Fix | Delete
this.toggleButton.blur();
[11552] Fix | Delete
}
[11553] Fix | Delete
}
[11554] Fix | Delete
toggle(evt = null) {
[11555] Fix | Delete
if (this.isOpen) {
[11556] Fix | Delete
this.close(evt);
[11557] Fix | Delete
} else {
[11558] Fix | Delete
this.open();
[11559] Fix | Delete
}
[11560] Fix | Delete
}
[11561] Fix | Delete
#dispatchEvent() {
[11562] Fix | Delete
if (this.isInitialViewSet) {
[11563] Fix | Delete
this.isInitialEventDispatched ||= true;
[11564] Fix | Delete
}
[11565] Fix | Delete
this.eventBus.dispatch("sidebarviewchanged", {
[11566] Fix | Delete
source: this,
[11567] Fix | Delete
view: this.visibleView
[11568] Fix | Delete
});
[11569] Fix | Delete
}
[11570] Fix | Delete
#showUINotification() {
[11571] Fix | Delete
this.toggleButton.setAttribute("data-l10n-id", "pdfjs-toggle-sidebar-notification-button");
[11572] Fix | Delete
if (!this.isOpen) {
[11573] Fix | Delete
this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);
[11574] Fix | Delete
}
[11575] Fix | Delete
}
[11576] Fix | Delete
#hideUINotification(reset = false) {
[11577] Fix | Delete
if (this.isOpen || reset) {
[11578] Fix | Delete
this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);
[11579] Fix | Delete
}
[11580] Fix | Delete
if (reset) {
[11581] Fix | Delete
this.toggleButton.setAttribute("data-l10n-id", "pdfjs-toggle-sidebar-button");
[11582] Fix | Delete
}
[11583] Fix | Delete
}
[11584] Fix | Delete
#addEventListeners() {
[11585] Fix | Delete
this.sidebarContainer.addEventListener("transitionend", evt => {
[11586] Fix | Delete
if (evt.target === this.sidebarContainer) {
[11587] Fix | Delete
this.outerContainer.classList.remove("sidebarMoving");
[11588] Fix | Delete
this.eventBus.dispatch("resize", {
[11589] Fix | Delete
source: this
[11590] Fix | Delete
});
[11591] Fix | Delete
}
[11592] Fix | Delete
});
[11593] Fix | Delete
this.toggleButton.addEventListener("click", evt => {
[11594] Fix | Delete
this.toggle(evt);
[11595] Fix | Delete
});
[11596] Fix | Delete
this.thumbnailButton.addEventListener("click", () => {
[11597] Fix | Delete
this.switchView(SidebarView.THUMBS);
[11598] Fix | Delete
});
[11599] Fix | Delete
this.outlineButton.addEventListener("click", () => {
[11600] Fix | Delete
this.switchView(SidebarView.OUTLINE);
[11601] Fix | Delete
});
[11602] Fix | Delete
this.outlineButton.addEventListener("dblclick", () => {
[11603] Fix | Delete
this.eventBus.dispatch("toggleoutlinetree", {
[11604] Fix | Delete
source: this
[11605] Fix | Delete
});
[11606] Fix | Delete
});
[11607] Fix | Delete
this.attachmentsButton.addEventListener("click", () => {
[11608] Fix | Delete
this.switchView(SidebarView.ATTACHMENTS);
[11609] Fix | Delete
});
[11610] Fix | Delete
this.layersButton.addEventListener("click", () => {
[11611] Fix | Delete
this.switchView(SidebarView.LAYERS);
[11612] Fix | Delete
});
[11613] Fix | Delete
this.layersButton.addEventListener("dblclick", () => {
[11614] Fix | Delete
this.eventBus.dispatch("resetlayers", {
[11615] Fix | Delete
source: this
[11616] Fix | Delete
});
[11617] Fix | Delete
});
[11618] Fix | Delete
this._currentOutlineItemButton.addEventListener("click", () => {
[11619] Fix | Delete
this.eventBus.dispatch("currentoutlineitem", {
[11620] Fix | Delete
source: this
[11621] Fix | Delete
});
[11622] Fix | Delete
});
[11623] Fix | Delete
const onTreeLoaded = (count, button, view) => {
[11624] Fix | Delete
button.disabled = !count;
[11625] Fix | Delete
if (count) {
[11626] Fix | Delete
this.#showUINotification();
[11627] Fix | Delete
} else if (this.active === view) {
[11628] Fix | Delete
this.switchView(SidebarView.THUMBS);
[11629] Fix | Delete
}
[11630] Fix | Delete
};
[11631] Fix | Delete
this.eventBus._on("outlineloaded", evt => {
[11632] Fix | Delete
onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);
[11633] Fix | Delete
evt.currentOutlineItemPromise.then(enabled => {
[11634] Fix | Delete
if (!this.isInitialViewSet) {
[11635] Fix | Delete
return;
[11636] Fix | Delete
}
[11637] Fix | Delete
this._currentOutlineItemButton.disabled = !enabled;
[11638] Fix | Delete
});
[11639] Fix | Delete
});
[11640] Fix | Delete
this.eventBus._on("attachmentsloaded", evt => {
[11641] Fix | Delete
onTreeLoaded(evt.attachmentsCount, this.attachmentsButton, SidebarView.ATTACHMENTS);
[11642] Fix | Delete
});
[11643] Fix | Delete
this.eventBus._on("layersloaded", evt => {
[11644] Fix | Delete
onTreeLoaded(evt.layersCount, this.layersButton, SidebarView.LAYERS);
[11645] Fix | Delete
});
[11646] Fix | Delete
this.eventBus._on("presentationmodechanged", evt => {
[11647] Fix | Delete
if (evt.state === PresentationModeState.NORMAL && this.visibleView === SidebarView.THUMBS) {
[11648] Fix | Delete
this.onUpdateThumbnails();
[11649] Fix | Delete
}
[11650] Fix | Delete
});
[11651] Fix | Delete
this.resizer.addEventListener("mousedown", evt => {
[11652] Fix | Delete
if (evt.button !== 0) {
[11653] Fix | Delete
return;
[11654] Fix | Delete
}
[11655] Fix | Delete
this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
[11656] Fix | Delete
window.addEventListener("mousemove", this.#mouseMoveBound);
[11657] Fix | Delete
window.addEventListener("mouseup", this.#mouseUpBound);
[11658] Fix | Delete
});
[11659] Fix | Delete
this.eventBus._on("resize", evt => {
[11660] Fix | Delete
if (evt.source !== window) {
[11661] Fix | Delete
return;
[11662] Fix | Delete
}
[11663] Fix | Delete
this.#outerContainerWidth = null;
[11664] Fix | Delete
if (!this.#width) {
[11665] Fix | Delete
return;
[11666] Fix | Delete
}
[11667] Fix | Delete
if (!this.isOpen) {
[11668] Fix | Delete
this.#updateWidth(this.#width);
[11669] Fix | Delete
return;
[11670] Fix | Delete
}
[11671] Fix | Delete
this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
[11672] Fix | Delete
const updated = this.#updateWidth(this.#width);
[11673] Fix | Delete
Promise.resolve().then(() => {
[11674] Fix | Delete
this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
[11675] Fix | Delete
if (updated) {
[11676] Fix | Delete
this.eventBus.dispatch("resize", {
[11677] Fix | Delete
source: this
[11678] Fix | Delete
});
[11679] Fix | Delete
}
[11680] Fix | Delete
});
[11681] Fix | Delete
});
[11682] Fix | Delete
}
[11683] Fix | Delete
get outerContainerWidth() {
[11684] Fix | Delete
return this.#outerContainerWidth ||= this.outerContainer.clientWidth;
[11685] Fix | Delete
}
[11686] Fix | Delete
#updateWidth(width = 0) {
[11687] Fix | Delete
const maxWidth = Math.floor(this.outerContainerWidth / 2);
[11688] Fix | Delete
if (width > maxWidth) {
[11689] Fix | Delete
width = maxWidth;
[11690] Fix | Delete
}
[11691] Fix | Delete
if (width < SIDEBAR_MIN_WIDTH) {
[11692] Fix | Delete
width = SIDEBAR_MIN_WIDTH;
[11693] Fix | Delete
}
[11694] Fix | Delete
if (width === this.#width) {
[11695] Fix | Delete
return false;
[11696] Fix | Delete
}
[11697] Fix | Delete
this.#width = width;
[11698] Fix | Delete
docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);
[11699] Fix | Delete
return true;
[11700] Fix | Delete
}
[11701] Fix | Delete
#mouseMove(evt) {
[11702] Fix | Delete
let width = evt.clientX;
[11703] Fix | Delete
if (this.#isRTL) {
[11704] Fix | Delete
width = this.outerContainerWidth - width;
[11705] Fix | Delete
}
[11706] Fix | Delete
this.#updateWidth(width);
[11707] Fix | Delete
}
[11708] Fix | Delete
#mouseUp(evt) {
[11709] Fix | Delete
this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
[11710] Fix | Delete
this.eventBus.dispatch("resize", {
[11711] Fix | Delete
source: this
[11712] Fix | Delete
});
[11713] Fix | Delete
window.removeEventListener("mousemove", this.#mouseMoveBound);
[11714] Fix | Delete
window.removeEventListener("mouseup", this.#mouseUpBound);
[11715] Fix | Delete
}
[11716] Fix | Delete
}
[11717] Fix | Delete
[11718] Fix | Delete
;// CONCATENATED MODULE: ./web/pdf_thumbnail_view.js
[11719] Fix | Delete
[11720] Fix | Delete
[11721] Fix | Delete
const DRAW_UPSCALE_FACTOR = 2;
[11722] Fix | Delete
const MAX_NUM_SCALING_STEPS = 3;
[11723] Fix | Delete
const THUMBNAIL_WIDTH = 98;
[11724] Fix | Delete
class TempImageFactory {
[11725] Fix | Delete
static #tempCanvas = null;
[11726] Fix | Delete
static getCanvas(width, height) {
[11727] Fix | Delete
const tempCanvas = this.#tempCanvas ||= document.createElement("canvas");
[11728] Fix | Delete
tempCanvas.width = width;
[11729] Fix | Delete
tempCanvas.height = height;
[11730] Fix | Delete
const ctx = tempCanvas.getContext("2d", {
[11731] Fix | Delete
alpha: false
[11732] Fix | Delete
});
[11733] Fix | Delete
ctx.save();
[11734] Fix | Delete
ctx.fillStyle = "rgb(255, 255, 255)";
[11735] Fix | Delete
ctx.fillRect(0, 0, width, height);
[11736] Fix | Delete
ctx.restore();
[11737] Fix | Delete
return [tempCanvas, tempCanvas.getContext("2d")];
[11738] Fix | Delete
}
[11739] Fix | Delete
static destroyCanvas() {
[11740] Fix | Delete
const tempCanvas = this.#tempCanvas;
[11741] Fix | Delete
if (tempCanvas) {
[11742] Fix | Delete
tempCanvas.width = 0;
[11743] Fix | Delete
tempCanvas.height = 0;
[11744] Fix | Delete
}
[11745] Fix | Delete
this.#tempCanvas = null;
[11746] Fix | Delete
}
[11747] Fix | Delete
}
[11748] Fix | Delete
class PDFThumbnailView {
[11749] Fix | Delete
constructor({
[11750] Fix | Delete
container,
[11751] Fix | Delete
eventBus,
[11752] Fix | Delete
id,
[11753] Fix | Delete
defaultViewport,
[11754] Fix | Delete
optionalContentConfigPromise,
[11755] Fix | Delete
linkService,
[11756] Fix | Delete
renderingQueue,
[11757] Fix | Delete
pageColors
[11758] Fix | Delete
}) {
[11759] Fix | Delete
this.id = id;
[11760] Fix | Delete
this.renderingId = "thumbnail" + id;
[11761] Fix | Delete
this.pageLabel = null;
[11762] Fix | Delete
this.pdfPage = null;
[11763] Fix | Delete
this.rotation = 0;
[11764] Fix | Delete
this.viewport = defaultViewport;
[11765] Fix | Delete
this.pdfPageRotate = defaultViewport.rotation;
[11766] Fix | Delete
this._optionalContentConfigPromise = optionalContentConfigPromise || null;
[11767] Fix | Delete
this.pageColors = pageColors || null;
[11768] Fix | Delete
this.eventBus = eventBus;
[11769] Fix | Delete
this.linkService = linkService;
[11770] Fix | Delete
this.renderingQueue = renderingQueue;
[11771] Fix | Delete
this.renderTask = null;
[11772] Fix | Delete
this.renderingState = RenderingStates.INITIAL;
[11773] Fix | Delete
this.resume = null;
[11774] Fix | Delete
const anchor = document.createElement("a");
[11775] Fix | Delete
anchor.href = linkService.getAnchorUrl("#page=" + id);
[11776] Fix | Delete
anchor.setAttribute("data-l10n-id", "pdfjs-thumb-page-title");
[11777] Fix | Delete
anchor.setAttribute("data-l10n-args", this.#pageL10nArgs);
[11778] Fix | Delete
anchor.onclick = function () {
[11779] Fix | Delete
linkService.goToPage(id);
[11780] Fix | Delete
return false;
[11781] Fix | Delete
};
[11782] Fix | Delete
this.anchor = anchor;
[11783] Fix | Delete
const div = document.createElement("div");
[11784] Fix | Delete
div.className = "thumbnail";
[11785] Fix | Delete
div.setAttribute("data-page-number", this.id);
[11786] Fix | Delete
this.div = div;
[11787] Fix | Delete
this.#updateDims();
[11788] Fix | Delete
const img = document.createElement("div");
[11789] Fix | Delete
img.className = "thumbnailImage";
[11790] Fix | Delete
this._placeholderImg = img;
[11791] Fix | Delete
div.append(img);
[11792] Fix | Delete
anchor.append(div);
[11793] Fix | Delete
container.append(anchor);
[11794] Fix | Delete
}
[11795] Fix | Delete
#updateDims() {
[11796] Fix | Delete
const {
[11797] Fix | Delete
width,
[11798] Fix | Delete
height
[11799] Fix | Delete
} = this.viewport;
[11800] Fix | Delete
const ratio = width / height;
[11801] Fix | Delete
this.canvasWidth = THUMBNAIL_WIDTH;
[11802] Fix | Delete
this.canvasHeight = this.canvasWidth / ratio | 0;
[11803] Fix | Delete
this.scale = this.canvasWidth / width;
[11804] Fix | Delete
const {
[11805] Fix | Delete
style
[11806] Fix | Delete
} = this.div;
[11807] Fix | Delete
style.setProperty("--thumbnail-width", `${this.canvasWidth}px`);
[11808] Fix | Delete
style.setProperty("--thumbnail-height", `${this.canvasHeight}px`);
[11809] Fix | Delete
}
[11810] Fix | Delete
setPdfPage(pdfPage) {
[11811] Fix | Delete
this.pdfPage = pdfPage;
[11812] Fix | Delete
this.pdfPageRotate = pdfPage.rotate;
[11813] Fix | Delete
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
[11814] Fix | Delete
this.viewport = pdfPage.getViewport({
[11815] Fix | Delete
scale: 1,
[11816] Fix | Delete
rotation: totalRotation
[11817] Fix | Delete
});
[11818] Fix | Delete
this.reset();
[11819] Fix | Delete
}
[11820] Fix | Delete
reset() {
[11821] Fix | Delete
this.cancelRendering();
[11822] Fix | Delete
this.renderingState = RenderingStates.INITIAL;
[11823] Fix | Delete
this.div.removeAttribute("data-loaded");
[11824] Fix | Delete
this.image?.replaceWith(this._placeholderImg);
[11825] Fix | Delete
this.#updateDims();
[11826] Fix | Delete
if (this.image) {
[11827] Fix | Delete
this.image.removeAttribute("src");
[11828] Fix | Delete
delete this.image;
[11829] Fix | Delete
}
[11830] Fix | Delete
}
[11831] Fix | Delete
update({
[11832] Fix | Delete
rotation = null
[11833] Fix | Delete
}) {
[11834] Fix | Delete
if (typeof rotation === "number") {
[11835] Fix | Delete
this.rotation = rotation;
[11836] Fix | Delete
}
[11837] Fix | Delete
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
[11838] Fix | Delete
this.viewport = this.viewport.clone({
[11839] Fix | Delete
scale: 1,
[11840] Fix | Delete
rotation: totalRotation
[11841] Fix | Delete
});
[11842] Fix | Delete
this.reset();
[11843] Fix | Delete
}
[11844] Fix | Delete
cancelRendering() {
[11845] Fix | Delete
if (this.renderTask) {
[11846] Fix | Delete
this.renderTask.cancel();
[11847] Fix | Delete
this.renderTask = null;
[11848] Fix | Delete
}
[11849] Fix | Delete
this.resume = null;
[11850] Fix | Delete
}
[11851] Fix | Delete
#getPageDrawContext(upscaleFactor = 1) {
[11852] Fix | Delete
const canvas = document.createElement("canvas");
[11853] Fix | Delete
const ctx = canvas.getContext("2d", {
[11854] Fix | Delete
alpha: false
[11855] Fix | Delete
});
[11856] Fix | Delete
const outputScale = new OutputScale();
[11857] Fix | Delete
canvas.width = upscaleFactor * this.canvasWidth * outputScale.sx | 0;
[11858] Fix | Delete
canvas.height = upscaleFactor * this.canvasHeight * outputScale.sy | 0;
[11859] Fix | Delete
const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
[11860] Fix | Delete
return {
[11861] Fix | Delete
ctx,
[11862] Fix | Delete
canvas,
[11863] Fix | Delete
transform
[11864] Fix | Delete
};
[11865] Fix | Delete
}
[11866] Fix | Delete
#convertCanvasToImage(canvas) {
[11867] Fix | Delete
if (this.renderingState !== RenderingStates.FINISHED) {
[11868] Fix | Delete
throw new Error("#convertCanvasToImage: Rendering has not finished.");
[11869] Fix | Delete
}
[11870] Fix | Delete
const reducedCanvas = this.#reduceImage(canvas);
[11871] Fix | Delete
const image = document.createElement("img");
[11872] Fix | Delete
image.className = "thumbnailImage";
[11873] Fix | Delete
image.setAttribute("data-l10n-id", "pdfjs-thumb-page-canvas");
[11874] Fix | Delete
image.setAttribute("data-l10n-args", this.#pageL10nArgs);
[11875] Fix | Delete
image.src = reducedCanvas.toDataURL();
[11876] Fix | Delete
this.image = image;
[11877] Fix | Delete
this.div.setAttribute("data-loaded", true);
[11878] Fix | Delete
this._placeholderImg.replaceWith(image);
[11879] Fix | Delete
reducedCanvas.width = 0;
[11880] Fix | Delete
reducedCanvas.height = 0;
[11881] Fix | Delete
}
[11882] Fix | Delete
async #finishRenderTask(renderTask, canvas, error = null) {
[11883] Fix | Delete
if (renderTask === this.renderTask) {
[11884] Fix | Delete
this.renderTask = null;
[11885] Fix | Delete
}
[11886] Fix | Delete
if (error instanceof RenderingCancelledException) {
[11887] Fix | Delete
return;
[11888] Fix | Delete
}
[11889] Fix | Delete
this.renderingState = RenderingStates.FINISHED;
[11890] Fix | Delete
this.#convertCanvasToImage(canvas);
[11891] Fix | Delete
if (error) {
[11892] Fix | Delete
throw error;
[11893] Fix | Delete
}
[11894] Fix | Delete
}
[11895] Fix | Delete
async draw() {
[11896] Fix | Delete
if (this.renderingState !== RenderingStates.INITIAL) {
[11897] Fix | Delete
console.error("Must be in new state before drawing");
[11898] Fix | Delete
return undefined;
[11899] Fix | Delete
}
[11900] Fix | Delete
const {
[11901] Fix | Delete
pdfPage
[11902] Fix | Delete
} = this;
[11903] Fix | Delete
if (!pdfPage) {
[11904] Fix | Delete
this.renderingState = RenderingStates.FINISHED;
[11905] Fix | Delete
throw new Error("pdfPage is not loaded");
[11906] Fix | Delete
}
[11907] Fix | Delete
this.renderingState = RenderingStates.RUNNING;
[11908] Fix | Delete
const {
[11909] Fix | Delete
ctx,
[11910] Fix | Delete
canvas,
[11911] Fix | Delete
transform
[11912] Fix | Delete
} = this.#getPageDrawContext(DRAW_UPSCALE_FACTOR);
[11913] Fix | Delete
const drawViewport = this.viewport.clone({
[11914] Fix | Delete
scale: DRAW_UPSCALE_FACTOR * this.scale
[11915] Fix | Delete
});
[11916] Fix | Delete
const renderContinueCallback = cont => {
[11917] Fix | Delete
if (!this.renderingQueue.isHighestPriority(this)) {
[11918] Fix | Delete
this.renderingState = RenderingStates.PAUSED;
[11919] Fix | Delete
this.resume = () => {
[11920] Fix | Delete
this.renderingState = RenderingStates.RUNNING;
[11921] Fix | Delete
cont();
[11922] Fix | Delete
};
[11923] Fix | Delete
return;
[11924] Fix | Delete
}
[11925] Fix | Delete
cont();
[11926] Fix | Delete
};
[11927] Fix | Delete
const renderContext = {
[11928] Fix | Delete
canvasContext: ctx,
[11929] Fix | Delete
transform,
[11930] Fix | Delete
viewport: drawViewport,
[11931] Fix | Delete
optionalContentConfigPromise: this._optionalContentConfigPromise,
[11932] Fix | Delete
pageColors: this.pageColors
[11933] Fix | Delete
};
[11934] Fix | Delete
const renderTask = this.renderTask = pdfPage.render(renderContext);
[11935] Fix | Delete
renderTask.onContinue = renderContinueCallback;
[11936] Fix | Delete
const resultPromise = renderTask.promise.then(() => this.#finishRenderTask(renderTask, canvas), error => this.#finishRenderTask(renderTask, canvas, error));
[11937] Fix | Delete
resultPromise.finally(() => {
[11938] Fix | Delete
canvas.width = 0;
[11939] Fix | Delete
canvas.height = 0;
[11940] Fix | Delete
this.eventBus.dispatch("thumbnailrendered", {
[11941] Fix | Delete
source: this,
[11942] Fix | Delete
pageNumber: this.id,
[11943] Fix | Delete
pdfPage: this.pdfPage
[11944] Fix | Delete
});
[11945] Fix | Delete
});
[11946] Fix | Delete
return resultPromise;
[11947] Fix | Delete
}
[11948] Fix | Delete
setImage(pageView) {
[11949] Fix | Delete
if (this.renderingState !== RenderingStates.INITIAL) {
[11950] Fix | Delete
return;
[11951] Fix | Delete
}
[11952] Fix | Delete
const {
[11953] Fix | Delete
thumbnailCanvas: canvas,
[11954] Fix | Delete
pdfPage,
[11955] Fix | Delete
scale
[11956] Fix | Delete
} = pageView;
[11957] Fix | Delete
if (!canvas) {
[11958] Fix | Delete
return;
[11959] Fix | Delete
}
[11960] Fix | Delete
if (!this.pdfPage) {
[11961] Fix | Delete
this.setPdfPage(pdfPage);
[11962] Fix | Delete
}
[11963] Fix | Delete
if (scale < this.scale) {
[11964] Fix | Delete
return;
[11965] Fix | Delete
}
[11966] Fix | Delete
this.renderingState = RenderingStates.FINISHED;
[11967] Fix | Delete
this.#convertCanvasToImage(canvas);
[11968] Fix | Delete
}
[11969] Fix | Delete
#reduceImage(img) {
[11970] Fix | Delete
const {
[11971] Fix | Delete
ctx,
[11972] Fix | Delete
canvas
[11973] Fix | Delete
} = this.#getPageDrawContext();
[11974] Fix | Delete
if (img.width <= 2 * canvas.width) {
[11975] Fix | Delete
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
[11976] Fix | Delete
return canvas;
[11977] Fix | Delete
}
[11978] Fix | Delete
let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;
[11979] Fix | Delete
let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
[11980] Fix | Delete
const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(reducedWidth, reducedHeight);
[11981] Fix | Delete
while (reducedWidth > img.width || reducedHeight > img.height) {
[11982] Fix | Delete
reducedWidth >>= 1;
[11983] Fix | Delete
reducedHeight >>= 1;
[11984] Fix | Delete
}
[11985] Fix | Delete
reducedImageCtx.drawImage(img, 0, 0, img.width, img.height, 0, 0, reducedWidth, reducedHeight);
[11986] Fix | Delete
while (reducedWidth > 2 * canvas.width) {
[11987] Fix | Delete
reducedImageCtx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, reducedWidth >> 1, reducedHeight >> 1);
[11988] Fix | Delete
reducedWidth >>= 1;
[11989] Fix | Delete
reducedHeight >>= 1;
[11990] Fix | Delete
}
[11991] Fix | Delete
ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height);
[11992] Fix | Delete
return canvas;
[11993] Fix | Delete
}
[11994] Fix | Delete
get #pageL10nArgs() {
[11995] Fix | Delete
return JSON.stringify({
[11996] Fix | Delete
page: this.pageLabel ?? this.id
[11997] Fix | Delete
});
[11998] Fix | Delete
}
[11999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function