Skip to content
Snippets Groups Projects
Commit 987bf478 authored by Alexander Rose's avatar Alexander Rose
Browse files

save interactivity props in state

parent 6201dd1d
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ import { PluginCommands } from './command'; ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -151,6 +157,9 @@ namespace PluginState {
canvas3d?: { canvas3d?: {
props?: Canvas3DProps props?: Canvas3DProps
}, },
interactivity?: {
props?: Interactivity.Props
},
durationInMs?: number durationInMs?: number
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment