|
@@ -11,6 +11,11 @@ import { Viewer, ViewerProps } from '@rcsb/rcsb-molstar/build/src/viewer';
|
|
|
import { TmDetColorThemeProvider } from '../tmdet-extension/tmdet-color-theme';
|
|
|
import { MembraneOrientationPreset } from '../tmdet-extension/behavior';
|
|
|
import { TmDetLabelProvider } from '../tmdet-extension/labeling';
|
|
|
+import { loadInitialSnapshot, rotateCamera, storeCameraSnapshot } from '../tmdet-extension/camera';
|
|
|
+import { BuiltInTrajectoryFormat } from 'molstar/lib/mol-plugin-state/formats/trajectory';
|
|
|
+import { PresetProps } from '../preset2';
|
|
|
+import { Mat4 } from 'molstar/lib/commonjs/mol-math/linear-algebra';
|
|
|
+import { TrajectoryHierarchyPresetProvider } from 'molstar/lib/mol-plugin-state/builder/structure/hierarchy-preset';
|
|
|
|
|
|
|
|
|
/** package version, filled in at bundle build time */
|
|
@@ -42,5 +47,30 @@ export class TmViewer extends Viewer {
|
|
|
await this.plugin.runTask(this.plugin.state.behaviors.updateTree(tree, { doNotUpdateCurrent: true, doNotLogTiming: true }));
|
|
|
}
|
|
|
|
|
|
+ loadStructureFromUrl<P, S>(url: string, format: BuiltInTrajectoryFormat, isBinary: boolean, config?: {
|
|
|
+ props?: PresetProps & {
|
|
|
+ dataLabel?: string;
|
|
|
+ };
|
|
|
+ matrix?: Mat4;
|
|
|
+ reprProvider?: TrajectoryHierarchyPresetProvider<P, S>;
|
|
|
+ params?: P;
|
|
|
+ }): Promise<any> {
|
|
|
+ this.plugin.canvas3dInitialized.then(() => {
|
|
|
+ console.log('Camera initialization started', this.plugin.canvas3d?.camera)
|
|
|
+ storeCameraSnapshot(this.plugin); // store if it is not stored yet
|
|
|
+ loadInitialSnapshot(this.plugin); // load if there is a stored one
|
|
|
+
|
|
|
+ // INVALID DATA CELL: setTimeout(() => { this.plugin.clear(); }, 100); // clear scene after some delay
|
|
|
+
|
|
|
+ setTimeout(() => { (async () => {
|
|
|
+ rotateCamera(this.plugin);
|
|
|
+ })(); }, 1000);
|
|
|
+ });
|
|
|
+
|
|
|
+ const result = super.loadStructureFromUrl(url, format, isBinary, config);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|