Explorar el Código

add config item for state history-capacity

Alexander Rose hace 4 años
padre
commit
83ce5e9422
Se han modificado 3 ficheros con 5 adiciones y 4 borrados
  1. 2 1
      src/mol-plugin/config.ts
  2. 1 2
      src/mol-plugin/context.ts
  3. 2 1
      src/mol-plugin/state.ts

+ 2 - 1
src/mol-plugin/config.ts

@@ -27,7 +27,8 @@ export const PluginConfig = {
     },
     State: {
         DefaultServer: item('plugin-state.server', 'https://webchem.ncbr.muni.cz/molstar-state'),
-        CurrentServer: item('plugin-state.server', 'https://webchem.ncbr.muni.cz/molstar-state')
+        CurrentServer: item('plugin-state.server', 'https://webchem.ncbr.muni.cz/molstar-state'),
+        HistoryCapacity: item('history-capacity.server', 5)
     },
     VolumeStreaming: {
         DefaultServer: item('volume-streaming.server', 'https://ds.litemol.org'),

+ 1 - 2
src/mol-plugin/context.ts

@@ -72,11 +72,10 @@ export class PluginContext {
     private disposed = false;
     private ev = RxEventHelper.create();
 
+    readonly config = new PluginConfigManager(this.spec.config); // needed to init state
     readonly state = new PluginState(this);
     readonly commands = new PluginCommandManager();
 
-    readonly config = new PluginConfigManager(this.spec.config);
-
     private canvas3dInit = this.ev.behavior<boolean>(false);
     readonly behaviors = {
         state: {

+ 2 - 1
src/mol-plugin/state.ts

@@ -19,13 +19,14 @@ import { StructureFocusSnapshot } from '../mol-plugin-state/manager/structure/fo
 import { merge } from 'rxjs';
 import { PluginContext } from './context';
 import { PluginComponent } from '../mol-plugin-state/component';
+import { PluginConfig } from './config';
 
 export { PluginState };
 
 class PluginState extends PluginComponent {
     private get animation() { return this.plugin.managers.animation; }
 
-    readonly data = State.create(new SO.Root({ }), { runTask: this.plugin.runTask, globalContext: this.plugin });
+    readonly data = State.create(new SO.Root({ }), { runTask: this.plugin.runTask, globalContext: this.plugin, historyCapacity: this.plugin.config.get(PluginConfig.State.HistoryCapacity) });
     readonly behaviors = State.create(new PluginBehavior.Root({ }), { runTask: this.plugin.runTask, globalContext: this.plugin, rootState: { isLocked: true } });
 
     readonly events = {