Ver Fonte

mol-plugin: stop animating when snapshots are paused and vice versa

David Sehnal há 6 anos atrás
pai
commit
51895ec642
2 ficheiros alterados com 8 adições e 2 exclusões
  1. 4 1
      src/mol-plugin/state/snapshots.ts
  2. 4 1
      src/mol-plugin/ui/controls.tsx

+ 4 - 1
src/mol-plugin/state/snapshots.ts

@@ -194,7 +194,10 @@ class PluginStateSnapshotManager extends PluginComponent<{
     }
 
     togglePlay() {
-        if (this.state.isPlaying) this.stop();
+        if (this.state.isPlaying) {
+            this.stop();
+            this.plugin.state.animation.stop();
+        }
         else this.play();
     }
 

+ 4 - 1
src/mol-plugin/ui/controls.tsx

@@ -183,7 +183,10 @@ export class AnimationViewportControls extends PluginUIComponent<{}, { isEmpty:
         });
     }
     toggleExpanded = () => this.setState({ isExpanded: !this.state.isExpanded });
-    stop = () => this.plugin.state.animation.stop();
+    stop = () => {
+        this.plugin.state.animation.stop();
+        this.plugin.state.snapshots.stop();
+    }
 
     render() {
         // if (!this.state.show) return null;