This commit is contained in:
Fine 2025-04-08 18:42:14 +08:00
parent 54a44e93e2
commit 77c1db0337
3 changed files with 7 additions and 6 deletions

View File

@ -434,7 +434,8 @@ limitations under the License. -->
fill: #409eff; fill: #409eff;
} }
.highlightedParent .node { .highlightedParent .node,
.highlighted .node {
stroke-width: 4; stroke-width: 4;
fill: var(--font-color); fill: var(--font-color);
stroke: var(--font-color); stroke: var(--font-color);

View File

@ -119,7 +119,7 @@ export default class ListGraph {
d3.select("svg.trace-list").on("click", function (event: MouseEvent) { d3.select("svg.trace-list").on("click", function (event: MouseEvent) {
if (event.target === this) { if (event.target === this) {
d3.select("#trace-action-box").style("display", "none"); d3.select("#trace-action-box").style("display", "none");
t.selectedNode.classed("highlighted", false); t.selectedNode && t.selectedNode.classed("highlighted", false);
} }
}); });
} }

View File

@ -143,7 +143,7 @@ export default class TraceMap {
d3.select("svg.d3-trace-tree").on("click", function (event: MouseEvent) { d3.select("svg.d3-trace-tree").on("click", function (event: MouseEvent) {
if (event.target === this) { if (event.target === this) {
d3.select("#trace-action-box").style("display", "none"); d3.select("#trace-action-box").style("display", "none");
t.selectedNode.classed("highlighted", false); t.selectedNode && t.selectedNode.classed("highlighted", false);
} }
}); });
@ -244,7 +244,7 @@ export default class TraceMap {
.append("text") .append("text")
.attr("class", "node-text") .attr("class", "node-text")
.attr("x", function (d: Recordable) { .attr("x", function (d: Recordable) {
return d.children || d._children ? -45 : 15; return d.children || d._children ? -30 : 15;
}) })
.attr("dy", "1.5em") .attr("dy", "1.5em")
.attr("fill", appStore.theme === Themes.Dark ? "#888" : "#bbb") .attr("fill", appStore.theme === Themes.Dark ? "#888" : "#bbb")
@ -304,7 +304,7 @@ export default class TraceMap {
.on("click", function (event: MouseEvent, d: Trace & { id: string }) { .on("click", function (event: MouseEvent, d: Trace & { id: string }) {
event.stopPropagation(); event.stopPropagation();
t.tip.hide(d, this); t.tip.hide(d, this);
d3.select(this).classed("highlighted", true); d3.select(this.parentNode).classed("highlighted", true);
const nodeBox = this.getBoundingClientRect(); const nodeBox = this.getBoundingClientRect();
const svgBox = (d3.select(`.${t.el?.className} .d3-trace-tree`) as any).node().getBoundingClientRect(); const svgBox = (d3.select(`.${t.el?.className} .d3-trace-tree`) as any).node().getBoundingClientRect();
const offsetX = nodeBox.x - svgBox.x; const offsetX = nodeBox.x - svgBox.x;
@ -313,7 +313,7 @@ export default class TraceMap {
.style("display", "block") .style("display", "block")
.style("left", `${offsetX + 30}px`) .style("left", `${offsetX + 30}px`)
.style("top", `${offsetY + 40}px`); .style("top", `${offsetY + 40}px`);
t.selectedNode = d3.select(this); t.selectedNode = d3.select(this.parentNode);
if (t.handleSelectSpan) { if (t.handleSelectSpan) {
t.handleSelectSpan(d); t.handleSelectSpan(d);
} }