Compare commits

..

No commits in common. "dd5ac8335028e26a6d475e41804c58384ab12f12" and "91c4ecf3c484ac1dd1e228c6a534f7def45b31b9" have entirely different histories.

2 changed files with 1 additions and 17 deletions

Binary file not shown.

View File

@ -87,7 +87,7 @@ export function loadFlameGraph(
return textCanvas;
}
function renderNodes(nodes: CalcNode[], hoverFnId?: number) {
function renderNodes(nodes: CalcNode[]) {
for (const node of nodes) {
const { x, y, w, h } = node;
ctx.fillStyle = "rgb(227, 178, 60)";
@ -125,12 +125,6 @@ export function loadFlameGraph(
Math.min(edgeWidth, (w - 4) / 2),
h - 4,
);
if (hoverFnId === node.fgNode.fn) {
ctx.strokeStyle = canvas.style.backgroundColor;
ctx.lineWidth = 1;
ctx.strokeRect(x + 2, y + 2, w - 4, h - 4);
}
}
const tooltip = document.getElementById("flame-graph-tooltip")!;
@ -144,24 +138,15 @@ export function loadFlameGraph(
if (!node) {
tooltip.hidden = true;
canvas.style.cursor = "default";
return;
}
tooltip.innerText = `${node.title} ${node.percent}`;
tooltip.style.left = `${e.clientX + 20}px`;
tooltip.style.top = `${e.clientY + 20}px`;
tooltip.hidden = false;
canvas.style.cursor = "pointer";
canvas.removeEventListener("mousemove", mousemoveEvent);
canvas.removeEventListener("mouseleave", mouseleaveEvent);
canvas.removeEventListener("mousedown", mousedownEvent);
ctx.clearRect(0, 0, canvas.width, canvas.height);
renderNodes(nodes, node.fgNode.fn);
};
const mouseleaveEvent = () => {
tooltip.hidden = true;
canvas.style.cursor = "default";
};
const mousedownEvent = (e: MouseEvent) => {
const x = e.offsetX;
@ -174,7 +159,6 @@ export function loadFlameGraph(
return;
}
tooltip.hidden = true;
canvas.style.cursor = "default";
const newNodes: CalcNode[] = [];
calculateNodeRects(
newNodes,