Track links

This commit is contained in:
Ian Gulliver
2019-06-23 06:00:20 +00:00
parent 7e30b3ef1e
commit 39f6776a9b

View File

@@ -109,7 +109,7 @@ class Architype {
link.clear();
this.buildGraphTarget(graph, link.getLabel(), link);
this.buildGraphInt(graph, [link.getFrom(), link.getTo()]);
// TODO: record link information on source node
link.getFrom().addLink(link.getTo(), link);
}
trimSoftNodes(graph) {
@@ -422,6 +422,8 @@ class EditorEntryBase extends ListenUtils {
constructor() {
super();
this.links_ = [];
this.elem_ = document.createElement('li');
this.elem_.tabIndex = 0;
this.listen(this.elem_, 'focus', () => this.onElemFocus());
@@ -447,6 +449,17 @@ class EditorEntryBase extends ListenUtils {
this.elem_.xArchObj = null;
}
clear() {
this.links_.length = 0;
}
addLink(target, link) {
this.links_.push({
target: target,
link: link,
});
}
onElemFocus() {
this.elem_.scrollIntoView({block: 'center'});
}
@@ -494,6 +507,7 @@ class Node extends EditorEntryBase {
}
clear() {
super.clear();
this.elem_.classList.remove('error');
}
@@ -596,6 +610,7 @@ class Group extends EditorEntryBase {
}
clear() {
super.clear();
this.elem_.classList.remove('error');
}
@@ -702,6 +717,7 @@ class Link extends EditorEntryBase {
}
clear() {
super.clear();
this.elem_.classList.remove('error');
}