Browse Source

volume streaming: ensure current focus is shown upon registering

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

+ 15 - 9
src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts

@@ -235,16 +235,22 @@ export namespace VolumeStreaming {
             });
 
             this.subscribeObservable(this.plugin.managers.structure.focus.events.changed, () => {
-                const entry = this.plugin.managers.structure.focus.current
-                console.log(entry)
-                const loci = entry ? entry.loci : EmptyLoci
-
-                if (this.params.entry.params.view.name !== 'selection-box') {
-                    this.lastLoci = loci;
-                } else {
-                    this.updateInteraction(loci)
-                }
+                this.updateFromFocus()
             });
+
+            // ensure current focus is shown if needed upon registering
+            this.updateFromFocus()
+        }
+
+        private updateFromFocus() {
+            const entry = this.plugin.managers.structure.focus.current
+            const loci = entry ? entry.loci : EmptyLoci
+
+            if (this.params.entry.params.view.name !== 'selection-box') {
+                this.lastLoci = loci;
+            } else {
+                this.updateInteraction(loci)
+            }
         }
 
         private getBoxFromLoci(loci: StructureElement.Loci | EmptyLoci): Box3D {