diff --git a/src/mol-plugin/behavior/static/representation.ts b/src/mol-plugin/behavior/static/representation.ts index cde79a5b614ebeb3f7d64b28df96cd91ded52ec3..bf58413b59e2d4d75998175dc1a5867944148e32 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;