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
}
[14500] Fix | Delete
if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) {
[14501] Fix | Delete
this._pagesCapability.resolve();
[14502] Fix | Delete
return;
[14503] Fix | Delete
}
[14504] Fix | Delete
let getPagesLeft = pagesCount - 1;
[14505] Fix | Delete
if (getPagesLeft <= 0) {
[14506] Fix | Delete
this._pagesCapability.resolve();
[14507] Fix | Delete
return;
[14508] Fix | Delete
}
[14509] Fix | Delete
for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {
[14510] Fix | Delete
const promise = pdfDocument.getPage(pageNum).then(pdfPage => {
[14511] Fix | Delete
const pageView = this._pages[pageNum - 1];
[14512] Fix | Delete
if (!pageView.pdfPage) {
[14513] Fix | Delete
pageView.setPdfPage(pdfPage);
[14514] Fix | Delete
}
[14515] Fix | Delete
if (--getPagesLeft === 0) {
[14516] Fix | Delete
this._pagesCapability.resolve();
[14517] Fix | Delete
}
[14518] Fix | Delete
}, reason => {
[14519] Fix | Delete
console.error(`Unable to get page ${pageNum} to initialize viewer`, reason);
[14520] Fix | Delete
if (--getPagesLeft === 0) {
[14521] Fix | Delete
this._pagesCapability.resolve();
[14522] Fix | Delete
}
[14523] Fix | Delete
});
[14524] Fix | Delete
if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {
[14525] Fix | Delete
await promise;
[14526] Fix | Delete
}
[14527] Fix | Delete
}
[14528] Fix | Delete
});
[14529] Fix | Delete
eventBus.dispatch("pagesinit", {
[14530] Fix | Delete
source: this
[14531] Fix | Delete
});
[14532] Fix | Delete
pdfDocument.getMetadata().then(({
[14533] Fix | Delete
info
[14534] Fix | Delete
}) => {
[14535] Fix | Delete
if (pdfDocument !== this.pdfDocument) {
[14536] Fix | Delete
return;
[14537] Fix | Delete
}
[14538] Fix | Delete
if (info.Language) {
[14539] Fix | Delete
viewer.lang = info.Language;
[14540] Fix | Delete
}
[14541] Fix | Delete
});
[14542] Fix | Delete
if (this.defaultRenderingQueue) {
[14543] Fix | Delete
this.update();
[14544] Fix | Delete
}
[14545] Fix | Delete
}).catch(reason => {
[14546] Fix | Delete
console.error("Unable to initialize viewer", reason);
[14547] Fix | Delete
this._pagesCapability.reject(reason);
[14548] Fix | Delete
});
[14549] Fix | Delete
}
[14550] Fix | Delete
setPageLabels(labels) {
[14551] Fix | Delete
if (!this.pdfDocument) {
[14552] Fix | Delete
return;
[14553] Fix | Delete
}
[14554] Fix | Delete
if (!labels) {
[14555] Fix | Delete
this._pageLabels = null;
[14556] Fix | Delete
} else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
[14557] Fix | Delete
this._pageLabels = null;
[14558] Fix | Delete
console.error(`setPageLabels: Invalid page labels.`);
[14559] Fix | Delete
} else {
[14560] Fix | Delete
this._pageLabels = labels;
[14561] Fix | Delete
}
[14562] Fix | Delete
for (let i = 0, ii = this._pages.length; i < ii; i++) {
[14563] Fix | Delete
this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);
[14564] Fix | Delete
}
[14565] Fix | Delete
}
[14566] Fix | Delete
_resetView() {
[14567] Fix | Delete
this._pages = [];
[14568] Fix | Delete
this._currentPageNumber = 1;
[14569] Fix | Delete
this._currentScale = UNKNOWN_SCALE;
[14570] Fix | Delete
this._currentScaleValue = null;
[14571] Fix | Delete
this._pageLabels = null;
[14572] Fix | Delete
this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
[14573] Fix | Delete
this._location = null;
[14574] Fix | Delete
this._pagesRotation = 0;
[14575] Fix | Delete
this._optionalContentConfigPromise = null;
[14576] Fix | Delete
this._firstPageCapability = Promise.withResolvers();
[14577] Fix | Delete
this._onePageRenderedCapability = Promise.withResolvers();
[14578] Fix | Delete
this._pagesCapability = Promise.withResolvers();
[14579] Fix | Delete
this._scrollMode = ScrollMode.VERTICAL;
[14580] Fix | Delete
this._previousScrollMode = ScrollMode.UNKNOWN;
[14581] Fix | Delete
this._spreadMode = SpreadMode.NONE;
[14582] Fix | Delete
this.#scrollModePageState = {
[14583] Fix | Delete
previousPageNumber: 1,
[14584] Fix | Delete
scrollDown: true,
[14585] Fix | Delete
pages: []
[14586] Fix | Delete
};
[14587] Fix | Delete
this.#eventAbortController?.abort();
[14588] Fix | Delete
this.#eventAbortController = null;
[14589] Fix | Delete
this.viewer.textContent = "";
[14590] Fix | Delete
this._updateScrollMode();
[14591] Fix | Delete
this.viewer.removeAttribute("lang");
[14592] Fix | Delete
this.#hiddenCopyElement?.remove();
[14593] Fix | Delete
this.#hiddenCopyElement = null;
[14594] Fix | Delete
}
[14595] Fix | Delete
#ensurePageViewVisible() {
[14596] Fix | Delete
if (this._scrollMode !== ScrollMode.PAGE) {
[14597] Fix | Delete
throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");
[14598] Fix | Delete
}
[14599] Fix | Delete
const pageNumber = this._currentPageNumber,
[14600] Fix | Delete
state = this.#scrollModePageState,
[14601] Fix | Delete
viewer = this.viewer;
[14602] Fix | Delete
viewer.textContent = "";
[14603] Fix | Delete
state.pages.length = 0;
[14604] Fix | Delete
if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) {
[14605] Fix | Delete
const pageView = this._pages[pageNumber - 1];
[14606] Fix | Delete
viewer.append(pageView.div);
[14607] Fix | Delete
state.pages.push(pageView);
[14608] Fix | Delete
} else {
[14609] Fix | Delete
const pageIndexSet = new Set(),
[14610] Fix | Delete
parity = this._spreadMode - 1;
[14611] Fix | Delete
if (parity === -1) {
[14612] Fix | Delete
pageIndexSet.add(pageNumber - 1);
[14613] Fix | Delete
} else if (pageNumber % 2 !== parity) {
[14614] Fix | Delete
pageIndexSet.add(pageNumber - 1);
[14615] Fix | Delete
pageIndexSet.add(pageNumber);
[14616] Fix | Delete
} else {
[14617] Fix | Delete
pageIndexSet.add(pageNumber - 2);
[14618] Fix | Delete
pageIndexSet.add(pageNumber - 1);
[14619] Fix | Delete
}
[14620] Fix | Delete
const spread = document.createElement("div");
[14621] Fix | Delete
spread.className = "spread";
[14622] Fix | Delete
if (this.isInPresentationMode) {
[14623] Fix | Delete
const dummyPage = document.createElement("div");
[14624] Fix | Delete
dummyPage.className = "dummyPage";
[14625] Fix | Delete
spread.append(dummyPage);
[14626] Fix | Delete
}
[14627] Fix | Delete
for (const i of pageIndexSet) {
[14628] Fix | Delete
const pageView = this._pages[i];
[14629] Fix | Delete
if (!pageView) {
[14630] Fix | Delete
continue;
[14631] Fix | Delete
}
[14632] Fix | Delete
spread.append(pageView.div);
[14633] Fix | Delete
state.pages.push(pageView);
[14634] Fix | Delete
}
[14635] Fix | Delete
viewer.append(spread);
[14636] Fix | Delete
}
[14637] Fix | Delete
state.scrollDown = pageNumber >= state.previousPageNumber;
[14638] Fix | Delete
state.previousPageNumber = pageNumber;
[14639] Fix | Delete
}
[14640] Fix | Delete
_scrollUpdate() {
[14641] Fix | Delete
if (this.pagesCount === 0) {
[14642] Fix | Delete
return;
[14643] Fix | Delete
}
[14644] Fix | Delete
this.update();
[14645] Fix | Delete
}
[14646] Fix | Delete
#scrollIntoView(pageView, pageSpot = null) {
[14647] Fix | Delete
const {
[14648] Fix | Delete
div,
[14649] Fix | Delete
id
[14650] Fix | Delete
} = pageView;
[14651] Fix | Delete
if (this._currentPageNumber !== id) {
[14652] Fix | Delete
this._setCurrentPageNumber(id);
[14653] Fix | Delete
}
[14654] Fix | Delete
if (this._scrollMode === ScrollMode.PAGE) {
[14655] Fix | Delete
this.#ensurePageViewVisible();
[14656] Fix | Delete
this.update();
[14657] Fix | Delete
}
[14658] Fix | Delete
if (!pageSpot && !this.isInPresentationMode) {
[14659] Fix | Delete
const left = div.offsetLeft + div.clientLeft,
[14660] Fix | Delete
right = left + div.clientWidth;
[14661] Fix | Delete
const {
[14662] Fix | Delete
scrollLeft,
[14663] Fix | Delete
clientWidth
[14664] Fix | Delete
} = this.container;
[14665] Fix | Delete
if (this._scrollMode === ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) {
[14666] Fix | Delete
pageSpot = {
[14667] Fix | Delete
left: 0,
[14668] Fix | Delete
top: 0
[14669] Fix | Delete
};
[14670] Fix | Delete
}
[14671] Fix | Delete
}
[14672] Fix | Delete
scrollIntoView(div, pageSpot);
[14673] Fix | Delete
if (!this._currentScaleValue && this._location) {
[14674] Fix | Delete
this._location = null;
[14675] Fix | Delete
}
[14676] Fix | Delete
}
[14677] Fix | Delete
#isSameScale(newScale) {
[14678] Fix | Delete
return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;
[14679] Fix | Delete
}
[14680] Fix | Delete
#setScaleUpdatePages(newScale, newValue, {
[14681] Fix | Delete
noScroll = false,
[14682] Fix | Delete
preset = false,
[14683] Fix | Delete
drawingDelay = -1,
[14684] Fix | Delete
origin = null
[14685] Fix | Delete
}) {
[14686] Fix | Delete
this._currentScaleValue = newValue.toString();
[14687] Fix | Delete
if (this.#isSameScale(newScale)) {
[14688] Fix | Delete
if (preset) {
[14689] Fix | Delete
this.eventBus.dispatch("scalechanging", {
[14690] Fix | Delete
source: this,
[14691] Fix | Delete
scale: newScale,
[14692] Fix | Delete
presetValue: newValue
[14693] Fix | Delete
});
[14694] Fix | Delete
}
[14695] Fix | Delete
return;
[14696] Fix | Delete
}
[14697] Fix | Delete
this.viewer.style.setProperty("--scale-factor", newScale * PixelsPerInch.PDF_TO_CSS_UNITS);
[14698] Fix | Delete
const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;
[14699] Fix | Delete
this.refresh(true, {
[14700] Fix | Delete
scale: newScale,
[14701] Fix | Delete
drawingDelay: postponeDrawing ? drawingDelay : -1
[14702] Fix | Delete
});
[14703] Fix | Delete
if (postponeDrawing) {
[14704] Fix | Delete
this.#scaleTimeoutId = setTimeout(() => {
[14705] Fix | Delete
this.#scaleTimeoutId = null;
[14706] Fix | Delete
this.refresh();
[14707] Fix | Delete
}, drawingDelay);
[14708] Fix | Delete
}
[14709] Fix | Delete
const previousScale = this._currentScale;
[14710] Fix | Delete
this._currentScale = newScale;
[14711] Fix | Delete
if (!noScroll) {
[14712] Fix | Delete
let page = this._currentPageNumber,
[14713] Fix | Delete
dest;
[14714] Fix | Delete
if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {
[14715] Fix | Delete
page = this._location.pageNumber;
[14716] Fix | Delete
dest = [null, {
[14717] Fix | Delete
name: "XYZ"
[14718] Fix | Delete
}, this._location.left, this._location.top, null];
[14719] Fix | Delete
}
[14720] Fix | Delete
this.scrollPageIntoView({
[14721] Fix | Delete
pageNumber: page,
[14722] Fix | Delete
destArray: dest,
[14723] Fix | Delete
allowNegativeOffset: true
[14724] Fix | Delete
});
[14725] Fix | Delete
if (Array.isArray(origin)) {
[14726] Fix | Delete
const scaleDiff = newScale / previousScale - 1;
[14727] Fix | Delete
const [top, left] = this.containerTopLeft;
[14728] Fix | Delete
this.container.scrollLeft += (origin[0] - left) * scaleDiff;
[14729] Fix | Delete
this.container.scrollTop += (origin[1] - top) * scaleDiff;
[14730] Fix | Delete
}
[14731] Fix | Delete
}
[14732] Fix | Delete
this.eventBus.dispatch("scalechanging", {
[14733] Fix | Delete
source: this,
[14734] Fix | Delete
scale: newScale,
[14735] Fix | Delete
presetValue: preset ? newValue : undefined
[14736] Fix | Delete
});
[14737] Fix | Delete
if (this.defaultRenderingQueue) {
[14738] Fix | Delete
this.update();
[14739] Fix | Delete
}
[14740] Fix | Delete
}
[14741] Fix | Delete
get #pageWidthScaleFactor() {
[14742] Fix | Delete
if (this._spreadMode !== SpreadMode.NONE && this._scrollMode !== ScrollMode.HORIZONTAL) {
[14743] Fix | Delete
return 2;
[14744] Fix | Delete
}
[14745] Fix | Delete
return 1;
[14746] Fix | Delete
}
[14747] Fix | Delete
#setScale(value, options) {
[14748] Fix | Delete
let scale = parseFloat(value);
[14749] Fix | Delete
if (scale > 0) {
[14750] Fix | Delete
options.preset = false;
[14751] Fix | Delete
this.#setScaleUpdatePages(scale, value, options);
[14752] Fix | Delete
} else {
[14753] Fix | Delete
const currentPage = this._pages[this._currentPageNumber - 1];
[14754] Fix | Delete
if (!currentPage) {
[14755] Fix | Delete
return;
[14756] Fix | Delete
}
[14757] Fix | Delete
let hPadding = SCROLLBAR_PADDING,
[14758] Fix | Delete
vPadding = VERTICAL_PADDING;
[14759] Fix | Delete
if (this.isInPresentationMode) {
[14760] Fix | Delete
hPadding = vPadding = 4;
[14761] Fix | Delete
if (this._spreadMode !== SpreadMode.NONE) {
[14762] Fix | Delete
hPadding *= 2;
[14763] Fix | Delete
}
[14764] Fix | Delete
} else if (this.removePageBorders) {
[14765] Fix | Delete
hPadding = vPadding = 0;
[14766] Fix | Delete
} else if (this._scrollMode === ScrollMode.HORIZONTAL) {
[14767] Fix | Delete
[hPadding, vPadding] = [vPadding, hPadding];
[14768] Fix | Delete
}
[14769] Fix | Delete
const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this.#pageWidthScaleFactor;
[14770] Fix | Delete
const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
[14771] Fix | Delete
switch (value) {
[14772] Fix | Delete
case "page-actual":
[14773] Fix | Delete
scale = 1;
[14774] Fix | Delete
break;
[14775] Fix | Delete
case "page-width":
[14776] Fix | Delete
scale = pageWidthScale;
[14777] Fix | Delete
break;
[14778] Fix | Delete
case "page-height":
[14779] Fix | Delete
scale = pageHeightScale;
[14780] Fix | Delete
break;
[14781] Fix | Delete
case "page-fit":
[14782] Fix | Delete
scale = Math.min(pageWidthScale, pageHeightScale);
[14783] Fix | Delete
break;
[14784] Fix | Delete
case "auto":
[14785] Fix | Delete
const horizontalScale = isPortraitOrientation(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
[14786] Fix | Delete
scale = Math.min(MAX_AUTO_SCALE, horizontalScale);
[14787] Fix | Delete
break;
[14788] Fix | Delete
default:
[14789] Fix | Delete
console.error(`#setScale: "${value}" is an unknown zoom value.`);
[14790] Fix | Delete
return;
[14791] Fix | Delete
}
[14792] Fix | Delete
options.preset = true;
[14793] Fix | Delete
this.#setScaleUpdatePages(scale, value, options);
[14794] Fix | Delete
}
[14795] Fix | Delete
}
[14796] Fix | Delete
#resetCurrentPageView() {
[14797] Fix | Delete
const pageView = this._pages[this._currentPageNumber - 1];
[14798] Fix | Delete
if (this.isInPresentationMode) {
[14799] Fix | Delete
this.#setScale(this._currentScaleValue, {
[14800] Fix | Delete
noScroll: true
[14801] Fix | Delete
});
[14802] Fix | Delete
}
[14803] Fix | Delete
this.#scrollIntoView(pageView);
[14804] Fix | Delete
}
[14805] Fix | Delete
pageLabelToPageNumber(label) {
[14806] Fix | Delete
if (!this._pageLabels) {
[14807] Fix | Delete
return null;
[14808] Fix | Delete
}
[14809] Fix | Delete
const i = this._pageLabels.indexOf(label);
[14810] Fix | Delete
if (i < 0) {
[14811] Fix | Delete
return null;
[14812] Fix | Delete
}
[14813] Fix | Delete
return i + 1;
[14814] Fix | Delete
}
[14815] Fix | Delete
scrollPageIntoView({
[14816] Fix | Delete
pageNumber,
[14817] Fix | Delete
destArray = null,
[14818] Fix | Delete
allowNegativeOffset = false,
[14819] Fix | Delete
ignoreDestinationZoom = false
[14820] Fix | Delete
}) {
[14821] Fix | Delete
if (!this.pdfDocument) {
[14822] Fix | Delete
return;
[14823] Fix | Delete
}
[14824] Fix | Delete
const pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
[14825] Fix | Delete
if (!pageView) {
[14826] Fix | Delete
console.error(`scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.`);
[14827] Fix | Delete
return;
[14828] Fix | Delete
}
[14829] Fix | Delete
if (this.isInPresentationMode || !destArray) {
[14830] Fix | Delete
this._setCurrentPageNumber(pageNumber, true);
[14831] Fix | Delete
return;
[14832] Fix | Delete
}
[14833] Fix | Delete
let x = 0,
[14834] Fix | Delete
y = 0;
[14835] Fix | Delete
let width = 0,
[14836] Fix | Delete
height = 0,
[14837] Fix | Delete
widthScale,
[14838] Fix | Delete
heightScale;
[14839] Fix | Delete
const changeOrientation = pageView.rotation % 180 !== 0;
[14840] Fix | Delete
const pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / PixelsPerInch.PDF_TO_CSS_UNITS;
[14841] Fix | Delete
const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / PixelsPerInch.PDF_TO_CSS_UNITS;
[14842] Fix | Delete
let scale = 0;
[14843] Fix | Delete
switch (destArray[1].name) {
[14844] Fix | Delete
case "XYZ":
[14845] Fix | Delete
x = destArray[2];
[14846] Fix | Delete
y = destArray[3];
[14847] Fix | Delete
scale = destArray[4];
[14848] Fix | Delete
x = x !== null ? x : 0;
[14849] Fix | Delete
y = y !== null ? y : pageHeight;
[14850] Fix | Delete
break;
[14851] Fix | Delete
case "Fit":
[14852] Fix | Delete
case "FitB":
[14853] Fix | Delete
scale = "page-fit";
[14854] Fix | Delete
break;
[14855] Fix | Delete
case "FitH":
[14856] Fix | Delete
case "FitBH":
[14857] Fix | Delete
y = destArray[2];
[14858] Fix | Delete
scale = "page-width";
[14859] Fix | Delete
if (y === null && this._location) {
[14860] Fix | Delete
x = this._location.left;
[14861] Fix | Delete
y = this._location.top;
[14862] Fix | Delete
} else if (typeof y !== "number" || y < 0) {
[14863] Fix | Delete
y = pageHeight;
[14864] Fix | Delete
}
[14865] Fix | Delete
break;
[14866] Fix | Delete
case "FitV":
[14867] Fix | Delete
case "FitBV":
[14868] Fix | Delete
x = destArray[2];
[14869] Fix | Delete
width = pageWidth;
[14870] Fix | Delete
height = pageHeight;
[14871] Fix | Delete
scale = "page-height";
[14872] Fix | Delete
break;
[14873] Fix | Delete
case "FitR":
[14874] Fix | Delete
x = destArray[2];
[14875] Fix | Delete
y = destArray[3];
[14876] Fix | Delete
width = destArray[4] - x;
[14877] Fix | Delete
height = destArray[5] - y;
[14878] Fix | Delete
let hPadding = SCROLLBAR_PADDING,
[14879] Fix | Delete
vPadding = VERTICAL_PADDING;
[14880] Fix | Delete
if (this.removePageBorders) {
[14881] Fix | Delete
hPadding = vPadding = 0;
[14882] Fix | Delete
}
[14883] Fix | Delete
widthScale = (this.container.clientWidth - hPadding) / width / PixelsPerInch.PDF_TO_CSS_UNITS;
[14884] Fix | Delete
heightScale = (this.container.clientHeight - vPadding) / height / PixelsPerInch.PDF_TO_CSS_UNITS;
[14885] Fix | Delete
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
[14886] Fix | Delete
break;
[14887] Fix | Delete
default:
[14888] Fix | Delete
console.error(`scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.`);
[14889] Fix | Delete
return;
[14890] Fix | Delete
}
[14891] Fix | Delete
if (!ignoreDestinationZoom) {
[14892] Fix | Delete
if (scale && scale !== this._currentScale) {
[14893] Fix | Delete
this.currentScaleValue = scale;
[14894] Fix | Delete
} else if (this._currentScale === UNKNOWN_SCALE) {
[14895] Fix | Delete
this.currentScaleValue = DEFAULT_SCALE_VALUE;
[14896] Fix | Delete
}
[14897] Fix | Delete
}
[14898] Fix | Delete
if (scale === "page-fit" && !destArray[4]) {
[14899] Fix | Delete
this.#scrollIntoView(pageView);
[14900] Fix | Delete
return;
[14901] Fix | Delete
}
[14902] Fix | Delete
const boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
[14903] Fix | Delete
let left = Math.min(boundingRect[0][0], boundingRect[1][0]);
[14904] Fix | Delete
let top = Math.min(boundingRect[0][1], boundingRect[1][1]);
[14905] Fix | Delete
if (!allowNegativeOffset) {
[14906] Fix | Delete
left = Math.max(left, 0);
[14907] Fix | Delete
top = Math.max(top, 0);
[14908] Fix | Delete
}
[14909] Fix | Delete
this.#scrollIntoView(pageView, {
[14910] Fix | Delete
left,
[14911] Fix | Delete
top
[14912] Fix | Delete
});
[14913] Fix | Delete
}
[14914] Fix | Delete
_updateLocation(firstPage) {
[14915] Fix | Delete
const currentScale = this._currentScale;
[14916] Fix | Delete
const currentScaleValue = this._currentScaleValue;
[14917] Fix | Delete
const normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
[14918] Fix | Delete
const pageNumber = firstPage.id;
[14919] Fix | Delete
const currentPageView = this._pages[pageNumber - 1];
[14920] Fix | Delete
const container = this.container;
[14921] Fix | Delete
const topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
[14922] Fix | Delete
const intLeft = Math.round(topLeft[0]);
[14923] Fix | Delete
const intTop = Math.round(topLeft[1]);
[14924] Fix | Delete
let pdfOpenParams = `#page=${pageNumber}`;
[14925] Fix | Delete
if (!this.isInPresentationMode) {
[14926] Fix | Delete
pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;
[14927] Fix | Delete
}
[14928] Fix | Delete
this._location = {
[14929] Fix | Delete
pageNumber,
[14930] Fix | Delete
scale: normalizedScaleValue,
[14931] Fix | Delete
top: intTop,
[14932] Fix | Delete
left: intLeft,
[14933] Fix | Delete
rotation: this._pagesRotation,
[14934] Fix | Delete
pdfOpenParams
[14935] Fix | Delete
};
[14936] Fix | Delete
}
[14937] Fix | Delete
update() {
[14938] Fix | Delete
const visible = this._getVisiblePages();
[14939] Fix | Delete
const visiblePages = visible.views,
[14940] Fix | Delete
numVisiblePages = visiblePages.length;
[14941] Fix | Delete
if (numVisiblePages === 0) {
[14942] Fix | Delete
return;
[14943] Fix | Delete
}
[14944] Fix | Delete
const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
[14945] Fix | Delete
this.#buffer.resize(newCacheSize, visible.ids);
[14946] Fix | Delete
this.renderingQueue.renderHighestPriority(visible);
[14947] Fix | Delete
const isSimpleLayout = this._spreadMode === SpreadMode.NONE && (this._scrollMode === ScrollMode.PAGE || this._scrollMode === ScrollMode.VERTICAL);
[14948] Fix | Delete
const currentId = this._currentPageNumber;
[14949] Fix | Delete
let stillFullyVisible = false;
[14950] Fix | Delete
for (const page of visiblePages) {
[14951] Fix | Delete
if (page.percent < 100) {
[14952] Fix | Delete
break;
[14953] Fix | Delete
}
[14954] Fix | Delete
if (page.id === currentId && isSimpleLayout) {
[14955] Fix | Delete
stillFullyVisible = true;
[14956] Fix | Delete
break;
[14957] Fix | Delete
}
[14958] Fix | Delete
}
[14959] Fix | Delete
this._setCurrentPageNumber(stillFullyVisible ? currentId : visiblePages[0].id);
[14960] Fix | Delete
this._updateLocation(visible.first);
[14961] Fix | Delete
this.eventBus.dispatch("updateviewarea", {
[14962] Fix | Delete
source: this,
[14963] Fix | Delete
location: this._location
[14964] Fix | Delete
});
[14965] Fix | Delete
}
[14966] Fix | Delete
containsElement(element) {
[14967] Fix | Delete
return this.container.contains(element);
[14968] Fix | Delete
}
[14969] Fix | Delete
focus() {
[14970] Fix | Delete
this.container.focus();
[14971] Fix | Delete
}
[14972] Fix | Delete
get _isContainerRtl() {
[14973] Fix | Delete
return getComputedStyle(this.container).direction === "rtl";
[14974] Fix | Delete
}
[14975] Fix | Delete
get isInPresentationMode() {
[14976] Fix | Delete
return this.presentationModeState === PresentationModeState.FULLSCREEN;
[14977] Fix | Delete
}
[14978] Fix | Delete
get isChangingPresentationMode() {
[14979] Fix | Delete
return this.presentationModeState === PresentationModeState.CHANGING;
[14980] Fix | Delete
}
[14981] Fix | Delete
get isHorizontalScrollbarEnabled() {
[14982] Fix | Delete
return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;
[14983] Fix | Delete
}
[14984] Fix | Delete
get isVerticalScrollbarEnabled() {
[14985] Fix | Delete
return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
[14986] Fix | Delete
}
[14987] Fix | Delete
_getVisiblePages() {
[14988] Fix | Delete
const views = this._scrollMode === ScrollMode.PAGE ? this.#scrollModePageState.pages : this._pages,
[14989] Fix | Delete
horizontal = this._scrollMode === ScrollMode.HORIZONTAL,
[14990] Fix | Delete
rtl = horizontal && this._isContainerRtl;
[14991] Fix | Delete
return getVisibleElements({
[14992] Fix | Delete
scrollEl: this.container,
[14993] Fix | Delete
views,
[14994] Fix | Delete
sortByVisibility: true,
[14995] Fix | Delete
horizontal,
[14996] Fix | Delete
rtl
[14997] Fix | Delete
});
[14998] Fix | Delete
}
[14999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function