Browse Source

mol-plugin: manually sync representations

David Sehnal 6 years ago
parent
commit
5a3fed3ce3
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/mol-plugin/behavior/static/representation.ts

+ 3 - 4
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;