Skip to content

Commit

Permalink
fix bond clear method
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Nov 23, 2024
1 parent 41b1238 commit 61d3eca
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/atoms/plugins/bond.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { elementsWithPolyhedra, covalentRadii, elementColors, default_bond_pairs
import { convertColor } from "../utils.js";
import { kdTree } from "../../geometry/kdTree.js";
import { searchBoundary } from "./boundary.js";
import { clearObject } from "../../utils.js";

// default bond radius
export const defaultBondRadius = 0.1;
Expand Down Expand Up @@ -42,7 +43,7 @@ export class BondManager {
this.viewer = viewer;
this.scene = this.viewer.tjs.scene;
this.settings = {};
this.meshes = [];
this.meshes = {};
this.hideLongBonds = hideLongBonds;
this.showHydrogenBonds = showHydrogenBonds;
this.bondRadius = 0.1;
Expand Down Expand Up @@ -134,10 +135,12 @@ export class BondManager {

clearMeshes() {
/* Remove highlighted atom meshes from the selectedAtomsMesh group */
this.meshes.forEach((mesh) => {
clearObject(this.scene, mesh);
Object.values(this.meshes).forEach((mesh) => {
if (mesh) {
clearObject(this.scene, mesh);
}
});
this.meshes = [];
this.meshes = {};
}

drawBonds() {
Expand Down

0 comments on commit 61d3eca

Please sign in to comment.