Fix screenshot animation loop handling (#1660)

This commit is contained in:
David Sehnal
2025-09-16 20:09:33 +02:00
committed by GitHub
parent ab2bcde794
commit 2bdaa565b4
2 changed files with 3 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ Note that since we don't clearly distinguish between a public and private interf
- Use of `KHR_parallel_shader_compile` extension when available to check status
- Add `ShaderManager` to compile shaders based on `Canvas3D` params and `Scene` content
- Draw `Scene` only when shaders are ready
- Fix incorrect animation loop handling in the screenshot code
## [v4.18.0] - 2025-06-08
- MolViewSpec extension:

View File

@@ -362,7 +362,7 @@ export class ViewportScreenshotHelper extends PluginComponent {
const { width, height, viewport } = this.getSizeAndViewport();
if (width <= 0 || height <= 0) return;
this.plugin.canvas3d?.pause(true);
this.plugin.animationLoop.stop({ noDraw: true });
try {
await ctx.update('Rendering image...');
const pass = this.imagePass;
@@ -377,7 +377,7 @@ export class ViewportScreenshotHelper extends PluginComponent {
if (!canvasCtx) throw new Error('Could not create canvas 2d context');
canvasCtx.putImageData(imageData, 0, 0);
} finally {
this.plugin.canvas3d?.animate();
this.plugin.animationLoop.start({ immediate: true });
}
return;
}