From 3983073d6cb968bd56db763ef11a38ff21c24a48 Mon Sep 17 00:00:00 2001
From: David Sehnal <david.sehnal@gmail.com>
Date: Mon, 21 Sep 2020 12:07:49 +0200
Subject: [PATCH] mol-plugin: fix canvas bg color when setting partial renderer
 params

---
 src/mol-plugin/context.ts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mol-plugin/context.ts b/src/mol-plugin/context.ts
index c961e2de6..0de74dcd6 100644
--- a/src/mol-plugin/context.ts
+++ b/src/mol-plugin/context.ts
@@ -190,7 +190,13 @@ export class PluginContext {
             const antialias = !(this.config.get(PluginConfig.General.DisableAntialiasing) ?? false);
             (this.canvas3d as Canvas3D) = Canvas3D.fromCanvas(canvas, {}, { antialias });
             this.canvas3dInit.next(true);
-            this.canvas3d?.setProps(this.spec.components?.viewport?.canvas3d || { renderer: { backgroundColor: Color(0xFCFBF9) } });
+            const props = this.spec.components?.viewport?.canvas3d;
+            if (!props || props.renderer?.backgroundColor === void 0) {
+                this.canvas3d?.setProps({ renderer: { backgroundColor: Color(0xFCFBF9) } });
+            }
+            if (props) {
+                this.canvas3d?.setProps(props);
+            }
             this.canvas3d!.animate();
             (this.helpers.viewportScreenshot as ViewportScreenshotHelper) = new ViewportScreenshotHelper(this);
             return true;
-- 
GitLab