aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/PDFBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/PDFBox.tsx')
-rw-r--r--src/client/views/nodes/PDFBox.tsx38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx
index e4050a3c3..45fa5cc12 100644
--- a/src/client/views/nodes/PDFBox.tsx
+++ b/src/client/views/nodes/PDFBox.tsx
@@ -396,7 +396,15 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
onKeyDown={e => ([KeyCodes.BACKSPACE, KeyCodes.DELETE].includes(e.keyCode) ? e.stopPropagation() : true)}
onPointerDown={e => e.stopPropagation()}
style={{ display: this._props.isContentActive() ? 'flex' : 'none' }}>
- <div className="pdfBox-overlayCont" onPointerDown={e => e.stopPropagation()} style={{ left: `${this._searching ? 0 : 100}%` }}>
+ <div
+ className="pdfBox-overlayCont"
+ onPointerDown={e => e.stopPropagation()}
+ style={{
+ transformOrigin: 'bottom left',
+ transform: `scale(${this._props.DocumentView?.().UIBtnScaling || 1})`,
+ width: `${100 / (this._props.DocumentView?.().UIBtnScaling || 1)}%`,
+ left: `${this._searching ? 0 : 100}%`,
+ }}>
<button type="button" className="pdfBox-overlayButton" title={searchTitle} />
<input
className="pdfBox-searchBar"
@@ -422,17 +430,25 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
type="button"
className="pdfBox-overlayButton"
title={searchTitle}
+ style={{
+ transformOrigin: 'bottom right',
+ transform: `scale(${this._props.DocumentView?.().UIBtnScaling || 1})`,
+ }}
onClick={action(() => {
this._searching = !this._searching;
this.search('', true, true);
})}>
- <div className="pdfBox-overlayButton-arrow" onPointerDown={e => e.stopPropagation()} />
<div className="pdfBox-overlayButton-iconCont" onPointerDown={e => e.stopPropagation()}>
<FontAwesomeIcon icon={this._searching ? 'times' : 'search'} size="lg" />
</div>
</button>
- <div className="pdfBox-pageNums">
+ <div
+ className="pdfBox-pageNums"
+ style={{
+ transformOrigin: 'top left',
+ transform: `scale(${this._props.DocumentView?.().UIBtnScaling || 1})`,
+ }}>
<input
value={curPage}
style={{ width: `${curPage > 99 ? 4 : 3}ch`, pointerEvents: 'all' }}
@@ -636,19 +652,11 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
const pdfView = !this._pdf ? null : this.renderPdfView;
const href = this.pdfUrl?.url.href;
if (!pdfView && href) {
- if (PDFBox.pdfcache.get(href))
- setTimeout(
- action(() => {
- this._pdf = PDFBox.pdfcache.get(href);
- })
- );
+ if (PDFBox.pdfcache.get(href)) setTimeout(action(() => (this._pdf = PDFBox.pdfcache.get(href))));
else {
- if (!PDFBox.pdfpromise.get(href)) PDFBox.pdfpromise.set(href, Pdfjs.getDocument(href).promise);
- PDFBox.pdfpromise.get(href)?.then(
- action(pdf => {
- PDFBox.pdfcache.set(href, (this._pdf = pdf));
- })
- );
+ const pdfPromise = PDFBox.pdfpromise.get(href) ?? Pdfjs.getDocument(href).promise;
+ PDFBox.pdfpromise.set(href, pdfPromise);
+ pdfPromise.then(action(pdf => PDFBox.pdfcache.set(href, (this._pdf = pdf))));
}
}
return pdfView ?? this.renderTitleBox;