diff options
author | bobzel <zzzman@gmail.com> | 2021-02-11 02:38:23 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-02-11 02:38:23 -0500 |
commit | 42865450ea252e340d89a1f67c8a2dc0b9c6eae3 (patch) | |
tree | 57b6179b2b4b43702602a0a8571ec90353898c02 /src/client/util/LinkManager.ts | |
parent | c86cb3966ecb905c2dc6a6236b71d7ce9c8fb80f (diff) |
more tweaking to simplify link following mechanisms.
Diffstat (limited to 'src/client/util/LinkManager.ts')
-rw-r--r-- | src/client/util/LinkManager.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts index 9034484d3..8a6ed9944 100644 --- a/src/client/util/LinkManager.ts +++ b/src/client/util/LinkManager.ts @@ -104,10 +104,10 @@ export class LinkManager { const batch = UndoManager.StartBatch("follow link click"); // open up target if it's not already in view ... const createViewFunc = (doc: Doc, followLoc: string, finished: Opt<() => void>) => { - const targetFocusAfterDocFocus = () => { + const targetFocusAfterDocFocus = (didFocus: boolean) => { const where = StrCast(sourceDoc.followLinkLocation) || followLoc; const hackToCallFinishAfterFocus = () => { - finished && setTimeout(finished, 0); // finished() needs to be called right after hackToCallFinishAfterFocus(), but there's no callback for that so we use the hacky timeout. + finished && setTimeout(finished); // finished() needs to be called right after hackToCallFinishAfterFocus(), but there's no callback for that so we use the hacky timeout. return false; // we must return false here so that the zoom to the document is not reversed. If it weren't for needing to call finished(), we wouldn't need this function at all since not having it is equivalent to returning false }; const addTab = docViewProps.addDocTab(doc, where); @@ -118,7 +118,7 @@ export class LinkManager { return where !== "inPlace" || addTab; // return true to reset the initial focus&zoom (return false for 'inPlace' since resetting the initial focus&zoom will negate the zoom into the target) }; if (!sourceDoc.followLinkZoom) { - targetFocusAfterDocFocus(); + targetFocusAfterDocFocus(false); } else { // first focus & zoom onto this (the clicked document). Then execute the function to focus on the target docViewProps.focus(sourceDoc, BoolCast(sourceDoc.followLinkZoom, true), 1, targetFocusAfterDocFocus); |