Преглед изворни кода

Volume Streaming Around Camera - avoid chain-reaction updates

Adam Midlik пре 2 година
родитељ
комит
28ee47d501
1 измењених фајлова са 10 додато и 3 уклоњено
  1. 10 3
      src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts

+ 10 - 3
src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts

@@ -443,8 +443,15 @@ export namespace VolumeStreaming {
 
         private updateCameraTarget(snapshot: Camera.Snapshot) {
             this.updateQueue.enqueue(async () => {
-                const box = this.boxFromCameraTarget(snapshot, true);
-                await this.updateCameraTargetParams(box);
+                const origManualReset = this.plugin.canvas3d?.props.camera.manualReset;
+                try {
+                    console.log('Manual reset orig:', origManualReset);
+                    this.plugin.canvas3d?.setProps({ camera: { manualReset: true } });
+                    const box = this.boxFromCameraTarget(snapshot, true);
+                    await this.updateCameraTargetParams(box);
+                } finally {
+                    this.plugin.canvas3d?.setProps({ camera: { manualReset: origManualReset } });
+                }
             });
         }
 
@@ -487,7 +494,7 @@ export namespace VolumeStreaming {
                 ratio *= 2;
                 detail += 1;
             }
-            console.log(`decided dynamic detail: ${detail}, (baseDetail: ${baseDetail}, box/cell volume ratio: ${boxVolume/cellVolume})`);
+            console.log(`decided dynamic detail: ${detail}, (baseDetail: ${baseDetail}, box/cell volume ratio: ${boxVolume / cellVolume})`);
             return detail;
         }