rewrite picker color handling (#1487)

This commit is contained in:
David Luzar
2020-04-25 23:06:16 +02:00
committed by GitHub
parent a4b49ea350
commit 2c5c770e78
2 changed files with 19 additions and 25 deletions

View File

@ -114,8 +114,9 @@ export function renderScene(
if (typeof sceneState.viewBackgroundColor === "string") {
const hasTransparence =
sceneState.viewBackgroundColor === "transparent" ||
sceneState.viewBackgroundColor.length === 5 ||
sceneState.viewBackgroundColor.length === 9;
sceneState.viewBackgroundColor.length === 5 || // #RGBA
sceneState.viewBackgroundColor.length === 9 || // #RRGGBBA
/(hsla|rgba)\(/.test(sceneState.viewBackgroundColor);
if (hasTransparence) {
context.clearRect(0, 0, normalizedCanvasWidth, normalizedCanvasHeight);
}