|
@@ -10,6 +10,7 @@ import { PluginStateTransform } from '../base';
|
|
|
import { PluginStateObjects as SO } from '../objects';
|
|
|
//import { CartoonRepresentation, DefaultCartoonProps } from 'mol-repr/structure/representation/cartoon';
|
|
|
import { BallAndStickRepresentation, DefaultBallAndStickProps } from 'mol-repr/structure/representation/ball-and-stick';
|
|
|
+import { PluginContext } from 'mol-plugin/context';
|
|
|
|
|
|
export { CreateStructureRepresentation }
|
|
|
namespace CreateStructureRepresentation { export interface Params { } }
|
|
@@ -18,16 +19,16 @@ const CreateStructureRepresentation = PluginStateTransform.Create<SO.Structure,
|
|
|
display: { name: 'Create 3D Representation' },
|
|
|
from: [SO.Structure],
|
|
|
to: [SO.StructureRepresentation3D],
|
|
|
- apply({ a, params }) {
|
|
|
+ apply({ a, params }, plugin: PluginContext) {
|
|
|
return Task.create('Structure Representation', async ctx => {
|
|
|
const repr = BallAndStickRepresentation(); // CartoonRepresentation();
|
|
|
- await repr.createOrUpdate({ /* TODO add `webgl: WebGLContext` */ }, DefaultBallAndStickProps, a.data).runInContext(ctx);
|
|
|
- return new SO.StructureRepresentation3D({ label: 'Cartoon' }, { repr });
|
|
|
+ await repr.createOrUpdate({ webgl: plugin.canvas3d.webgl }, DefaultBallAndStickProps, a.data).runInContext(ctx);
|
|
|
+ return new SO.StructureRepresentation3D({ label: 'Visual Repr.' }, { repr });
|
|
|
});
|
|
|
},
|
|
|
- update({ a, b }) {
|
|
|
+ update({ a, b }, plugin: PluginContext) {
|
|
|
return Task.create('Structure Representation', async ctx => {
|
|
|
- await b.data.repr.createOrUpdate({ /* TODO add `webgl: WebGLContext` */ }, b.data.repr.props, a.data).runInContext(ctx);
|
|
|
+ await b.data.repr.createOrUpdate({ webgl: plugin.canvas3d.webgl }, b.data.repr.props, a.data).runInContext(ctx);
|
|
|
return Transformer.UpdateResult.Updated;
|
|
|
});
|
|
|
}
|