소스 검색

better use of StateSelection API

Alexander Rose 3 년 전
부모
커밋
d3da79f3dd
1개의 변경된 파일2개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 6
      src/mol-plugin/behavior/dynamic/representation.ts

+ 2 - 6
src/mol-plugin/behavior/dynamic/representation.ts

@@ -186,12 +186,8 @@ export const SelectLoci = PluginBehavior.create({
                         Structure.areEquivalent(structure, oldStructure) &&
                         Structure.areHierarchiesEqual(structure, oldStructure)) return;
 
-                    const children = this.ctx.state.data.select(StateSelection.children(ref));
-                    for (const child of children) {
-                        if (child.obj?.type === SO.Molecule.Structure.Representation3D.type) {
-                            this.applySelectMark(child.transform.ref, true);
-                        }
-                    }
+                    const reprs = this.ctx.state.data.select(StateSelection.children(ref).ofType(SO.Molecule.Structure.Representation3D));
+                    for (const repr of reprs) this.applySelectMark(repr.transform.ref, true);
                 }
             });
         }