diff options
author | dinhanhtruong <70963346+dinhanhtruong@users.noreply.github.com> | 2021-08-22 13:16:11 -0400 |
---|---|---|
committer | dinhanhtruong <70963346+dinhanhtruong@users.noreply.github.com> | 2021-08-22 13:16:11 -0400 |
commit | 91cb0ed53125061d0ab570d5b7e3e34457e8da06 (patch) | |
tree | 161dd3683431be148abce74ceff8182b6737e16d /src/client/views/pdf/PDFViewer.tsx | |
parent | 8f77323d6be4d4e3537d2bc2bbe815e9d578eccb (diff) | |
parent | 3051d9a16dff8efbf4d32465812093cae7508c74 (diff) |
Merge branch 'master' into linking-anh
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; } |