Skip to content

Commit

Permalink
feat(Vis View): ✨ Add height property to adjList Items
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Aug 6, 2021
1 parent ccbdf2f commit 2f27bf4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/VisModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export function dfsAdjList(g: Graph, startNode: string): AdjListItem[] {
});
}
}
const maxDepth = adjList.sort((a, b) => a.depth - b.depth).last().depth;
adjList.forEach((item) => (item.height = maxDepth - item.depth));

return adjList;
}

Expand Down Expand Up @@ -132,15 +135,10 @@ export function bfsAdjList(g: Graph, startNode: string): AdjListItem[] {
});
}
}
return adjList;
}

export function reverseDepth(adjList: AdjListItem[]) {
const copy = _.cloneDeep(adjList);
const maxDepth = copy.sort((a, b) => a.depth - b.depth).last().depth;
const maxDepth = adjList.sort((a, b) => a.depth - b.depth).last().depth;
adjList.forEach((item) => (item.height = maxDepth - item.depth));

copy.forEach((item) => (item.depth = maxDepth - item.depth));
return copy;
return adjList;
}

export const stratify = d3
Expand Down Expand Up @@ -169,7 +167,7 @@ export class VisModal extends Modal {
let { contentEl } = this;
contentEl.empty();

contentEl.style.width = `${Math.round(window.innerWidth / 1.5)}px`;
contentEl.style.width = `${Math.round(window.innerWidth / 1.3)}px`;
contentEl.style.height = `${Math.round(window.innerHeight / 1.3)}px`;

const optionsDiv = contentEl.createDiv({ cls: "vis-view-options" });
Expand Down

0 comments on commit 2f27bf4

Please sign in to comment.