Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/visGeometry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1830,16 +1830,23 @@ class VisGeometry {
}

public removePathForAgent(id: number): void {
if (!this.agentPaths.delete(id)) {
const path = this.agentPaths.get(id);
if (!path) {
this.logger.warn(
"attempted to remove path for agent " +
id +
" that doesn't exist."
);
return;
}
this.agentPathGroup.remove(path.line);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between agentPathGroup and agentPaths?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the agentPaths are the line data and the group paths are the threeJS objects associated with that data?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agentPathGroup is a threejs Group object which is just a parent node for all the paths to belong to. agentPaths is a mapping of agent id to path, for all current agents that are drawing paths.

this.agentPaths.delete(id);
}

private removeAllPaths() {
this.agentPaths.forEach((path) => {
this.agentPathGroup.remove(path.line);
});
Comment on lines +1847 to +1849
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider iterating with for...of instead of forEach for better performance when removing multiple paths, as it avoids function call overhead for each iteration.

Suggested change
this.agentPaths.forEach((path) => {
this.agentPathGroup.remove(path.line);
});
for (const path of this.agentPaths.values()) {
this.agentPathGroup.remove(path.line);
}

Copilot uses AI. Check for mistakes.
this.agentPaths.clear();
}

Expand Down
Loading