Browse Source

save interactivity props in state

Alexander Rose 5 years ago
parent
commit
987bf47827
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/mol-plugin/state.ts

+ 9 - 0
src/mol-plugin/state.ts

@@ -16,6 +16,7 @@ import { PluginCommands } from './command';
 import { PluginAnimationManager } from './state/animation/manager';
 import { PluginAnimationManager } from './state/animation/manager';
 import { ParamDefinition as PD } from '../mol-util/param-definition';
 import { ParamDefinition as PD } from '../mol-util/param-definition';
 import { UUID } from '../mol-util';
 import { UUID } from '../mol-util';
+import { Interactivity } from './util/interactivity';
 export { PluginState }
 export { PluginState }
 
 
 class PluginState {
 class PluginState {
@@ -57,6 +58,7 @@ class PluginState {
             } : void 0,
             } : void 0,
             cameraSnapshots: p.cameraSnapshots ? this.cameraSnapshots.getStateSnapshot() : void 0,
             cameraSnapshots: p.cameraSnapshots ? this.cameraSnapshots.getStateSnapshot() : void 0,
             canvas3d: p.canvas3d ? { props: this.plugin.canvas3d.props } : void 0,
             canvas3d: p.canvas3d ? { props: this.plugin.canvas3d.props } : void 0,
+            interactivity: p.interactivity ? { props: this.plugin.interactivity.props } : void 0,
             durationInMs: params && params.durationInMs
             durationInMs: params && params.durationInMs
         };
         };
     }
     }
@@ -69,6 +71,9 @@ class PluginState {
         if (snapshot.canvas3d) {
         if (snapshot.canvas3d) {
             if (snapshot.canvas3d.props) await PluginCommands.Canvas3D.SetSettings.dispatch(this.plugin, { settings: snapshot.canvas3d.props });
             if (snapshot.canvas3d.props) await PluginCommands.Canvas3D.SetSettings.dispatch(this.plugin, { settings: snapshot.canvas3d.props });
         }
         }
+        if (snapshot.interactivity) {
+            if (snapshot.interactivity.props) await PluginCommands.Interactivity.SetProps.dispatch(this.plugin, { props: snapshot.interactivity.props });
+        }
         if (snapshot.cameraSnapshots) this.cameraSnapshots.setStateSnapshot(snapshot.cameraSnapshots);
         if (snapshot.cameraSnapshots) this.cameraSnapshots.setStateSnapshot(snapshot.cameraSnapshots);
         if (snapshot.animation) {
         if (snapshot.animation) {
             this.animation.setSnapshot(snapshot.animation);
             this.animation.setSnapshot(snapshot.animation);
@@ -123,6 +128,7 @@ namespace PluginState {
         animation: PD.Boolean(true),
         animation: PD.Boolean(true),
         startAnimation: PD.Boolean(false),
         startAnimation: PD.Boolean(false),
         canvas3d: PD.Boolean(true),
         canvas3d: PD.Boolean(true),
+        interactivity: PD.Boolean(true),
         camera: PD.Boolean(true),
         camera: PD.Boolean(true),
         // TODO: make camera snapshots same as the StateSnapshots with "child states?"
         // TODO: make camera snapshots same as the StateSnapshots with "child states?"
         cameraSnapshots: PD.Boolean(false),
         cameraSnapshots: PD.Boolean(false),
@@ -151,6 +157,9 @@ namespace PluginState {
         canvas3d?: {
         canvas3d?: {
             props?: Canvas3DProps
             props?: Canvas3DProps
         },
         },
+        interactivity?: {
+            props?: Interactivity.Props
+        },
         durationInMs?: number
         durationInMs?: number
     }
     }
 }
 }