0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00

🐛 Support invisible fills by setting opacity to 0

This supports invisible fills in Figma by setting their opacity to 0
when exporting to Penpot. Closes GH-17.

Signed-off-by: Ryan Breen <rbreen@zmags.com>
This commit is contained in:
Ryan Breen 2023-01-05 08:42:31 -05:00
parent ac443b7047
commit c98236ef4e

View file

@ -99,6 +99,13 @@ export default class PenpotExporter extends React.Component<PenpotExporterProps,
let penpotFill = null;
for (var fill of fills){
penpotFill = this.translateFill(fill, width, height);
// Penpot does not track fill visibility, so if the Figma fill is invisible we
// force opacity to 0
if (fill.visible === false){
penpotFill.fillOpacity = 0;
}
if (penpotFill !== null){
penpotFills.unshift(penpotFill);
}
@ -115,7 +122,9 @@ export default class PenpotExporter extends React.Component<PenpotExporterProps,
}
createPenpotBoard(file, node, baseX, baseY){
file.addArtboard({ name: node.name, x: node.x + baseX, y: node.y + baseY, width: node.width, height: node.height });
file.addArtboard({ name: node.name, x: node.x + baseX, y: node.y + baseY, width: node.width, height: node.height,
fills: this.translateFills(node.fills, node.width, node.height)
});
for (var child of node.children){
this.createPenpotItem(file, child, node.x + baseX, node.y + baseY);
}