From 5a3fed3ce385cf23e435b577d98742e9c85e60a8 Mon Sep 17 00:00:00 2001 From: David Sehnal <david.sehnal@gmail.com> Date: Fri, 23 Nov 2018 17:41:46 +0100 Subject: [PATCH] mol-plugin: manually sync representations --- src/mol-plugin/behavior/static/representation.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mol-plugin/behavior/static/representation.ts b/src/mol-plugin/behavior/static/representation.ts index cde79a5b6..bf58413b5 100644 --- a/src/mol-plugin/behavior/static/representation.ts +++ b/src/mol-plugin/behavior/static/representation.ts @@ -19,10 +19,10 @@ export function SyncRepresentationToCanvas(ctx: PluginContext) { events.object.created.subscribe(e => { if (!SO.isRepresentation3D(e.obj)) return; updateVisibility(e, e.obj.data); + e.obj.data.setState({ syncManually: true }); ctx.canvas3d.add(e.obj.data); // TODO: only do this if there were no representations previously ctx.canvas3d.resetCamera(); - ctx.canvas3d.requestDraw(true); }); events.object.updated.subscribe(e => { if (e.oldObj && SO.isRepresentation3D(e.oldObj)) { @@ -34,11 +34,10 @@ export function SyncRepresentationToCanvas(ctx: PluginContext) { if (!SO.isRepresentation3D(e.obj)) return; updateVisibility(e, e.obj.data); - if (e.action === 'recreate') { - ctx.canvas3d.add(e.obj.data); - ctx.canvas3d.requestDraw(true); + e.obj.data.setState({ syncManually: true }); } + ctx.canvas3d.add(e.obj.data); }); events.object.removed.subscribe(e => { if (!SO.isRepresentation3D(e.obj)) return; -- GitLab