Browse Source

ensure single element loci have some volume in volume interaction behavior

Alexander Rose 5 years ago
parent
commit
ed1bc8cb7d
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts

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

@@ -244,7 +244,12 @@ export namespace VolumeStreaming {
             const root = this.getStructureRoot();
             if (!root || !root.obj || root.obj !== parent.obj) return Box3D.empty();
 
-            return StructureElement.Loci.getBoundary(StructureElement.Loci.extendToWholeResidues(loci)).box;
+            const extendedLoci = StructureElement.Loci.extendToWholeResidues(loci)
+            const box = StructureElement.Loci.getBoundary(extendedLoci).box
+            if (StructureElement.Loci.size(extendedLoci) === 1) {
+                Box3D.expand(box, box, Vec3.create(1, 1, 1))
+            }
+            return box;
         }
 
         private updateInteraction(current: Representation.Loci) {
@@ -263,7 +268,6 @@ export namespace VolumeStreaming {
             }
 
             const box = this.getBoxFromLoci(loci);
-            if (!box) return;
             this.updateDynamicBox(box);
         }