diff options
Diffstat (limited to 'src/client/views/nodes/WebBox.tsx')
-rw-r--r-- | src/client/views/nodes/WebBox.tsx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index 4dbf78e35..662477c05 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -111,9 +111,8 @@ export class WebBox extends ViewBoxAnnotatableComponent<FieldViewProps, WebDocum } getAnchor = () => this.rootDoc; - scrollFocus = (doc: Doc, smooth: boolean, willZoom?: boolean, scale?: number, afterFocus?: DocAfterFocusFunc) => { - let focusSpeed = 0; - let endFocus = afterFocus; + scrollFocus = (doc: Doc, smooth: boolean) => { + let focusSpeed: Opt<number>; if (doc !== this.rootDoc && this.webpage && this._outerRef.current) { const scrollTo = Utils.scrollIntoView(NumCast(doc.y), doc[HeightSym](), NumCast(this.layoutDoc._scrollTop), this.props.PanelHeight() / (this.props.scaling?.() || 1)); if (scrollTo !== undefined) { @@ -122,13 +121,12 @@ export class WebBox extends ViewBoxAnnotatableComponent<FieldViewProps, WebDocum this.goTo(scrollTo, focusSpeed = smooth ? 500 : 0); this.layoutDoc._scrollTop = scrollTo; this._ignoreScroll = false; - endFocus = async (moved: boolean) => afterFocus ? await afterFocus(true) : false; } } else { this._initialScroll = NumCast(doc.y); } - (this.props as any).DocumentView().props.focus(this.rootDoc, willZoom, scale, (didFocus: boolean) => - new Promise<boolean>(res => setTimeout(async () => res(endFocus ? await endFocus(didFocus) : false), focusSpeed))); + + return focusSpeed; } async componentDidMount() { |