From 1316cc6a40dd7bcc45395c4487f59564a7f439ae Mon Sep 17 00:00:00 2001
From: Alexander Rose <alex.rose@rcsb.org>
Date: Wed, 9 Oct 2019 17:52:59 -0700
Subject: [PATCH] fix StructureSelectionControls.focus for single element

---
 src/mol-plugin/ui/structure/selection.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mol-plugin/ui/structure/selection.tsx b/src/mol-plugin/ui/structure/selection.tsx
index 60cf2aec9..e1c539d5d 100644
--- a/src/mol-plugin/ui/structure/selection.tsx
+++ b/src/mol-plugin/ui/structure/selection.tsx
@@ -46,8 +46,8 @@ export class StructureSelectionControls<P, S extends StructureSelectionControlsS
 
     focus = () => {
         const { extraRadius, minRadius, durationMs } = this.state
+        if (this.plugin.helpers.structureSelectionManager.stats.elementCount === 0) return
         const { sphere } = this.plugin.helpers.structureSelectionManager.getBoundary();
-        if (sphere.radius === 0) return
         const radius = Math.max(sphere.radius + extraRadius, minRadius);
         this.plugin.canvas3d.camera.focus(sphere.center, radius, durationMs);
     }
-- 
GitLab