Skip to content
Snippets Groups Projects
Commit 5a3fed3c authored by David Sehnal's avatar David Sehnal
Browse files

mol-plugin: manually sync representations

parent 5467c694
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment