hm
This commit is contained in:
parent
7455d630fc
commit
4d3fc2cd47
84 changed files with 3429 additions and 3480 deletions
|
|
@ -26,26 +26,13 @@ function lineageBuildComponentsIdle(family, token, onProgress, onDone) {
|
|||
let dfsIndex = 0;
|
||||
const seen = new Set();
|
||||
|
||||
const addParent = (childId, parentId) => {
|
||||
if (!childId || !parentId || childId === parentId || !known.has(childId) || !known.has(parentId)) return;
|
||||
if (!parentsByChild.has(childId)) parentsByChild.set(childId, new Set());
|
||||
if (!childrenByParent.has(parentId)) childrenByParent.set(parentId, new Set());
|
||||
parentsByChild.get(childId).add(parentId);
|
||||
childrenByParent.get(parentId).add(childId);
|
||||
};
|
||||
const addParent = (childId, parentId) => lineageAddParentEdge(childId, parentId, known, parentsByChild, childrenByParent);
|
||||
const addGraphEdge = (a, b) => {
|
||||
if (!a || !b || !graph.has(a) || !graph.has(b)) return;
|
||||
graph.get(a).add(b);
|
||||
graph.get(b).add(a);
|
||||
};
|
||||
const validParentChild = (childId, parentId) => {
|
||||
const child = family[childId];
|
||||
const parent = family[parentId];
|
||||
if (!child || !parent) return false;
|
||||
const childListsParent = Array.isArray(child.parents) && child.parents.includes(parentId);
|
||||
const parentListsChild = Array.isArray(parent.children) && parent.children.includes(childId);
|
||||
return childListsParent || parentListsChild;
|
||||
};
|
||||
const validParentChild = (childId, parentId) => globalThis.TarinaiFamilyGraph.relationAllowsParentChild(family, childId, parentId);
|
||||
const finishEmpty = () => {
|
||||
lineageRelationIndexCache = { family, version: world.familyVersion || 0, index: { parentsByChild, childrenByParent } };
|
||||
onDone([]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue