diff options
author | Aubrey-Li <63608597+Aubrey-Li@users.noreply.github.com> | 2021-08-21 13:59:06 -0700 |
---|---|---|
committer | Aubrey-Li <63608597+Aubrey-Li@users.noreply.github.com> | 2021-08-21 13:59:06 -0700 |
commit | df03b0bbf84b8314423542d90c29a0a127638a73 (patch) | |
tree | dec130023105a60e5c3a04139b28364e7c3b7c6b /src/client/views/pdf/PDFViewer.tsx | |
parent | becf6eeac2bd370fef2eb67c107ccfaeef5805e4 (diff) | |
parent | 3051d9a16dff8efbf4d32465812093cae7508c74 (diff) |
Merge branch 'master' into trails-aubrey
Diffstat (limited to 'src/client/views/pdf/PDFViewer.tsx')
-rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index e7911e8f8..ee553fd43 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -182,17 +182,18 @@ export class PDFViewer extends React.Component<IViewerProps> { scrollFocus = (doc: Doc, smooth: boolean) => { const mainCont = this._mainCont.current; let focusSpeed: Opt<number>; - if (doc !== this.props.rootDoc && mainCont && this._pdfViewer) { + if (doc !== this.props.rootDoc && mainCont) { const windowHeight = this.props.PanelHeight() / (this.props.scaling?.() || 1); const scrollTo = Utils.scrollIntoView(NumCast(doc.y), doc[HeightSym](), NumCast(this.props.layoutDoc._scrollTop), windowHeight, .1 * windowHeight); if (scrollTo !== undefined) { focusSpeed = 500; - if (smooth) smoothScroll(focusSpeed, mainCont, scrollTo); + if (!this._pdfViewer) this._initialScroll = scrollTo; + else if (smooth) smoothScroll(focusSpeed, mainCont, scrollTo); else this._mainCont.current?.scrollTo({ top: Math.abs(scrollTo || 0) }); } } else { - this._initialScroll = NumCast(doc.y); + this._initialScroll = NumCast(this.props.layoutDoc._scrollTop); } return focusSpeed; } |