Browse Source

fix broken getLoci in Representation.createMulti

Alexander Rose 5 years ago
parent
commit
326649d4f5
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/mol-repr/representation.ts

+ 5 - 5
src/mol-repr/representation.ts

@@ -281,12 +281,12 @@ namespace Representation {
             get state() { return currentState },
             get theme() { return currentTheme },
             getLoci: (pickingId?: PickingId) => {
-                if (pickingId === undefined) {
-                    return reprList.length > 0 ? reprList[0].getLoci() : EmptyLoci
-                }
+                const { visuals } = currentProps
                 for (let i = 0, il = reprList.length; i < il; ++i) {
-                    const loci = reprList[i].getLoci(pickingId)
-                    if (!isEmptyLoci(loci)) return loci
+                    if (!visuals || visuals.includes(reprMap[i])) {
+                        const loci = reprList[i].getLoci(pickingId)
+                        if (!isEmptyLoci(loci)) return loci
+                    }
                 }
                 return EmptyLoci
             },