Skip to content

Commit

Permalink
Update TimelineGraph.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Sep 21, 2023
1 parent fe3676c commit 2e78c1b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/Draco.Trace.Visualizer/src/TimelineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,20 @@ const TimelineGraph = (props: Props) => {
.attr('x', node => node.x0 + (node.x1 - node.x0) / 2)
.attr('y', node => height - node.y1 + (node.y1 - node.y0) / 2);

allNodes.on('click', (svg, node) => {
console.log(node.data.name);

const parent = node.parent;
if (!parent) return;
if (!parent.children) return;

for (let child of parent.children) {
if (child === node) continue;

child.data.startTime = 0;
child.data.endTime = 0;
}
allNodes.on('click', function (svg, node) {
d3
.select(this)
.select('rect')
.transition()
.duration(500)
.attr('width', (d: any) => width)
.attr('x', (d: any) => 0);
d3
.select(this)
.select('text')
.transition()
.duration(500)
.attr('x', (d: any) => width / 2);
});
}, [data, width, height]);

Expand Down

0 comments on commit 2e78c1b

Please sign in to comment.