瀏覽代碼

fix: Transparent backgrounds result in bleed (#499)

lissitz 5 年之前
父節點
當前提交
3de48d2893
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/renderer/renderScene.ts

+ 7 - 0
src/renderer/renderScene.ts

@@ -36,6 +36,13 @@ export function renderScene(
 
   const fillStyle = context.fillStyle;
   if (typeof sceneState.viewBackgroundColor === "string") {
+    const hasTransparence =
+      sceneState.viewBackgroundColor === "transparent" ||
+      sceneState.viewBackgroundColor.length === 5 ||
+      sceneState.viewBackgroundColor.length === 9;
+    if (hasTransparence) {
+      context.clearRect(0, 0, canvas.width, canvas.height);
+    }
     context.fillStyle = sceneState.viewBackgroundColor;
     context.fillRect(0, 0, canvas.width, canvas.height);
   } else {