From 0df806499cb589672015105e8ba3166bde29f625 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Thu, 14 Sep 2023 17:11:49 +0100 Subject: [PATCH 1/2] fix hollows for illustrator import --- taxonium_component/src/utils/deckglToSvg.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/taxonium_component/src/utils/deckglToSvg.js b/taxonium_component/src/utils/deckglToSvg.js index 48992bac..93770d00 100644 --- a/taxonium_component/src/utils/deckglToSvg.js +++ b/taxonium_component/src/utils/deckglToSvg.js @@ -47,9 +47,24 @@ const getSVGfunction = (layers, viewState) => { let color; if (!accessor) { // make color transparent - color = [0, 0, 0, 0]; + color = "none"; } else { - color = accessOrConstant(accessor, point).join(","); + const initColor = accessOrConstant(accessor, point); + // if rgba + if (initColor.length === 4) { + color = `rgba(${initColor.join(",")})`; + if (initColor[3] === 0) { + + color = "none"; + } + } + // if rgb + else if (initColor.length === 3) { + color = `rgb(${initColor.join(",")})`; + } + else{ + console.warn("Unsupported color format"); + } } // check if stroked let strokeColor, strokeWidth; @@ -62,7 +77,7 @@ const getSVGfunction = (layers, viewState) => { // if getRadius is a fn call it otherwise assume it's a value const radius = accessOrConstant(layer.getRadius, point); - svgContent += ` Date: Thu, 14 Sep 2023 16:13:17 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- taxonium_component/src/utils/deckglToSvg.js | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/taxonium_component/src/utils/deckglToSvg.js b/taxonium_component/src/utils/deckglToSvg.js index 93770d00..b8d3da3a 100644 --- a/taxonium_component/src/utils/deckglToSvg.js +++ b/taxonium_component/src/utils/deckglToSvg.js @@ -49,22 +49,20 @@ const getSVGfunction = (layers, viewState) => { // make color transparent color = "none"; } else { - const initColor = accessOrConstant(accessor, point); - // if rgba - if (initColor.length === 4) { - color = `rgba(${initColor.join(",")})`; - if (initColor[3] === 0) { - - color = "none"; - } - } - // if rgb - else if (initColor.length === 3) { - color = `rgb(${initColor.join(",")})`; - } - else{ - console.warn("Unsupported color format"); + const initColor = accessOrConstant(accessor, point); + // if rgba + if (initColor.length === 4) { + color = `rgba(${initColor.join(",")})`; + if (initColor[3] === 0) { + color = "none"; } + } + // if rgb + else if (initColor.length === 3) { + color = `rgb(${initColor.join(",")})`; + } else { + console.warn("Unsupported color format"); + } } // check if stroked let strokeColor, strokeWidth;