Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hollow shapes for illustrator import in svg #527

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions taxonium_component/src/utils/deckglToSvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,22 @@ 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;
Expand All @@ -62,7 +75,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 += `<circle cx="${x}" cy="${y}" r="${radius}" fill="rgb(${color})"
svgContent += `<circle cx="${x}" cy="${y}" r="${radius}" fill="${color}"
${
layer.stroked
? `stroke="rgb(${strokeColor})" stroke-width="${strokeWidth}"`
Expand Down