Skip to content

Commit 041ffef

Browse files
committed
fix(node_diagram): improve highlight clearing logic by scoping to current SVG root
- Updated the clearHighlights method to use the current SVG root or container for querying highlighted elements, ensuring that highlights are cleared correctly within the intended scope. - This change enhances the functionality and reliability of the highlight clearing process in the Node Diagram Module. Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
1 parent 8e1ec33 commit 041ffef

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

  • autoware_system_designer/autoware_system_designer/visualization/js

autoware_system_designer/autoware_system_designer/visualization/js/node_diagram.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,26 +352,29 @@ class NodeDiagramModule extends DiagramBase {
352352
clearHighlights() {
353353
this.nodeConnectionDirections.clear();
354354

355-
document.querySelectorAll(".highlighted").forEach((el) => {
355+
const scope = this.currentSvgRoot || this.container;
356+
if (!scope) return;
357+
358+
scope.querySelectorAll(".highlighted").forEach((el) => {
356359
el.classList.remove("highlighted");
357360
if (el.tagName === "path") {
358361
el.setAttribute("marker-end", "url(#arrowhead)");
359362
el.style.stroke = "";
360363
el.style.strokeWidth = "";
361364
}
362365
});
363-
document
366+
scope
364367
.querySelectorAll(".module-highlighted")
365368
.forEach((el) => el.classList.remove("module-highlighted"));
366-
document
369+
scope
367370
.querySelectorAll(".child-highlighted")
368371
.forEach((el) => el.classList.remove("child-highlighted"));
369-
document.querySelectorAll(".port-highlighted").forEach((el) => {
372+
scope.querySelectorAll(".port-highlighted").forEach((el) => {
370373
el.classList.remove("port-highlighted");
371374
el.style.fill = "";
372375
el.style.stroke = "";
373376
});
374-
document.querySelectorAll(".node-connection-highlight").forEach((el) => {
377+
scope.querySelectorAll(".node-connection-highlight").forEach((el) => {
375378
el.classList.remove("node-connection-highlight");
376379
el.style.stroke = "";
377380
el.style.strokeWidth = "";

0 commit comments

Comments
 (0)