aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/PDFViewer.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-10-01 21:48:15 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-10-01 21:48:15 -0400
commit88b20ece053ae85e541f4903748ee311b9ecf81c (patch)
treecccfa6aaa34948bb158ab8f8d91ab91dc853d06f /src/client/views/pdf/PDFViewer.tsx
parent128b8f61a8e3c7557bf7c3424a76f9c61ad6a56b (diff)
better fix than last one for icon sizes and default pdf dimensions.
Diffstat (limited to 'src/client/views/pdf/PDFViewer.tsx')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 91a8cbf9f..33226eac4 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -24,6 +24,7 @@ import { CollectionVideoView } from "../collections/CollectionVideoView";
import { CollectionView } from "../collections/CollectionView";
import Annotation from "./Annotation";
import { CollectionFreeFormView } from "../collections/collectionFreeForm/CollectionFreeFormView";
+import { SelectionManager } from "../../util/SelectionManager";
const PDFJSViewer = require("pdfjs-dist/web/pdf_viewer");
const pdfjsLib = require("pdfjs-dist");
@@ -107,7 +108,7 @@ export class PDFViewer extends React.Component<IViewerProps> {
// file address of the pdf
this._coverPath = JSON.parse(await rp.get(Utils.prepend(`/thumbnail${this.props.url.substring("files/".length, this.props.url.length - ".pdf".length)}-${NumCast(this.props.Document.curPage, 1)}.PNG`)));
runInAction(() => this._showWaiting = this._showCover = true);
- this._selectionReactionDisposer = reaction(() => this.props.isSelected(), () => this.setupPdfJsViewer(), { fireImmediately: this.props.startupLive });
+ this._selectionReactionDisposer = reaction(() => this.props.isSelected(), () => this.props.isSelected() && SelectionManager.SelectedDocuments().length === 1 && this.setupPdfJsViewer(), { fireImmediately: this.props.startupLive });
this._reactionDisposer = reaction(
() => this.props.Document.scrollY,
(scrollY) => {
@@ -632,7 +633,7 @@ export class PDFViewer extends React.Component<IViewerProps> {
}
getCoverImage = () => {
- if (!this.props.Document[HeightSym]()) {
+ if (!this.props.Document[HeightSym]() || !this.props.Document.nativeHeight) {
setTimeout(() => {
this.props.Document.height = this.props.Document[WidthSym]() * this._coverPath.height / this._coverPath.width;
this.props.Document.nativeHeight = nativeWidth * this._coverPath.height / this._coverPath.width;