aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/LinkManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-03-27 11:02:57 -0400
committerbobzel <zzzman@gmail.com>2024-03-27 11:02:57 -0400
commitbf6d1973cc81ba695afcca102c7229608faaa7e6 (patch)
treefb4660d424838d2690e3e468dc3de87b9d23813b /src/client/util/LinkManager.ts
parentb420caf2c7ecd386cae2cc550904522474b541aa (diff)
changed dashFieldViews to support Tab'ing between other dashFieldviews, changed deleting links to clear out the anchors so that linkBoxes will go away more easiliy. changed funcitonPlot to plot the equations that are linked to it. changed equations to link to functions. changed undo and other console logging to only happen when undo docked buttons are expanded (visible)
Diffstat (limited to 'src/client/util/LinkManager.ts')
-rw-r--r--src/client/util/LinkManager.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts
index cf16c4d6d..608e05fe9 100644
--- a/src/client/util/LinkManager.ts
+++ b/src/client/util/LinkManager.ts
@@ -152,10 +152,12 @@ export class LinkManager {
}
}
public deleteLink(linkDoc: Doc) {
- return Doc.RemoveDocFromList(Doc.LinkDBDoc(), 'data', linkDoc);
+ const ret = Doc.RemoveDocFromList(Doc.LinkDBDoc(), 'data', linkDoc);
+ linkDoc[DocData].link_anchor_1 = linkDoc[DocData].link_anchor_2 = undefined;
+ return ret;
}
public deleteAllLinksOnAnchor(anchor: Doc) {
- LinkManager.Instance.relatedLinker(anchor).forEach(linkDoc => LinkManager.Instance.deleteLink(linkDoc));
+ LinkManager.Instance.relatedLinker(anchor).forEach(LinkManager.Instance.deleteLink);
}
public getAllRelatedLinks(anchor: Doc) {
@@ -209,10 +211,10 @@ export class LinkManager {
const a1 = DocCast(linkDoc.link_anchor_1);
const a2 = DocCast(linkDoc.link_anchor_2);
if (linkDoc.link_matchEmbeddings) {
- return [a2, a2.annotationOn].includes(anchor) ? '2' : '1';
+ return [a2, a2?.annotationOn].includes(anchor) ? '2' : '1';
}
- if (Doc.AreProtosEqual(DocCast(anchor.annotationOn, anchor), DocCast(a1?.annotationOn, a1))) return '1';
- if (Doc.AreProtosEqual(DocCast(anchor.annotationOn, anchor), DocCast(a2?.annotationOn, a2))) return '2';
+ if (Doc.AreProtosEqual(DocCast(anchor?.annotationOn, anchor), DocCast(a1?.annotationOn, a1))) return '1';
+ if (Doc.AreProtosEqual(DocCast(anchor?.annotationOn, anchor), DocCast(a2?.annotationOn, a2))) return '2';
if (Doc.AreProtosEqual(anchor, linkDoc)) return '0';
// const a1 = DocCast(linkDoc.link_anchor_1);