mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-10 18:10:54 +09:00
remove linked and related nodes with corresponding switches
This commit is contained in:
parent
d48c4dda3e
commit
bd12a53be0
1 changed files with 11 additions and 1 deletions
12
dist/workers/graph.js
vendored
12
dist/workers/graph.js
vendored
|
@ -217,11 +217,17 @@ updateForces = () => {
|
|||
// Filter links
|
||||
if (!settings.link) {
|
||||
edges = edges.filter(d => d.type != EdgeType.Link);
|
||||
updateOrphans();
|
||||
|
||||
nodes = nodes.filter(d => !d.linkCnt);
|
||||
};
|
||||
|
||||
// Filter relations
|
||||
if (!settings.relation) {
|
||||
edges = edges.filter(d => d.type != EdgeType.Relation);
|
||||
updateOrphans();
|
||||
|
||||
nodes = nodes.filter(d => !d.relationCnt);
|
||||
};
|
||||
|
||||
// Filte local only edges
|
||||
|
@ -305,7 +311,11 @@ updateTheme = ({ theme }) => {
|
|||
|
||||
updateOrphans = () => {
|
||||
nodes = nodes.map(d => {
|
||||
d.isOrphan = !!!edges.find(it => (it.source == d.id) || (it.target == d.id));
|
||||
const edgeList = edges.filter(it => (it.source == d.id) || (it.target == d.id));
|
||||
|
||||
d.isOrphan = !edgeList.length;
|
||||
d.linkCnt = edgeList.filter(it => it.type == EdgeType.Link).length;
|
||||
d.relationCnt = edgeList.filter(it => it.type == EdgeType.Relation).length;
|
||||
return d;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue