aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/LinkFollower.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/LinkFollower.ts')
-rw-r--r--src/client/util/LinkFollower.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/client/util/LinkFollower.ts b/src/client/util/LinkFollower.ts
index 146eed6c2..2df4d1ca8 100644
--- a/src/client/util/LinkFollower.ts
+++ b/src/client/util/LinkFollower.ts
@@ -10,6 +10,7 @@ import { LinkManager } from './LinkManager';
import { ScriptingGlobals } from './ScriptingGlobals';
import { SelectionManager } from './SelectionManager';
import { UndoManager } from './UndoManager';
+import { SnappingManager } from './SnappingManager';
/*
* link doc:
* - link_anchor_1: doc
@@ -23,19 +24,18 @@ import { UndoManager } from './UndoManager';
* - user defined kvps
*/
export class LinkFollower {
- @observable public static IsFollowing = false;
// follows a link - if the target is on screen, it highlights/pans to it.
// if the target isn't onscreen, then it will open up the target in the lightbox, or in place
// depending on the followLinkLocation property of the source (or the link itself as a fallback);
public static FollowLink = (linkDoc: Opt<Doc>, sourceDoc: Doc, altKey: boolean) => {
const batch = UndoManager.StartBatch('Follow Link');
- runInAction(() => (LinkFollower.IsFollowing = true)); // turn off decoration bounds while following links since animations may occur, and DocDecorations is based on screenToLocal which is not always an observable value
+ runInAction(() => SnappingManager.SetIsLinkFollowing(true)); // turn off decoration bounds while following links since animations may occur, and DocDecorations is based on screenToLocal which is not always an observable value
return LinkFollower.traverseLink(
linkDoc,
sourceDoc,
action(() => {
batch.end();
- Doc.AddUnHighlightWatcher(action(() => (LinkFollower.IsFollowing = false)));
+ Doc.AddUnHighlightWatcher(() => SnappingManager.SetIsLinkFollowing(false));
}),
altKey ? true : undefined
);
@@ -63,10 +63,10 @@ export class LinkFollower {
sourceDoc === linkDoc.link_anchor_1
? linkDoc.link_anchor_2
: sourceDoc === linkDoc.link_anchor_2
- ? linkDoc.link_anchor_1
- : Doc.AreProtosEqual(sourceDoc, linkDoc.link_anchor_1 as Doc) || Doc.AreProtosEqual((linkDoc.link_anchor_1 as Doc).annotationOn as Doc, sourceDoc)
- ? linkDoc.link_anchor_2
- : linkDoc.link_anchor_1
+ ? linkDoc.link_anchor_1
+ : Doc.AreProtosEqual(sourceDoc, linkDoc.link_anchor_1 as Doc) || Doc.AreProtosEqual((linkDoc.link_anchor_1 as Doc).annotationOn as Doc, sourceDoc)
+ ? linkDoc.link_anchor_2
+ : linkDoc.link_anchor_1
) as Doc;
const srcAnchor = LinkManager.getOppositeAnchor(linkDoc, target) ?? sourceDoc;
if (target) {