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

Fixed arrows strokecaps (#68)

* fixed arrows strokecaps

* fixed arrows strokecaps
This commit is contained in:
Alex Sánchez 2024-04-24 16:29:24 +02:00 committed by GitHub
parent b298dc6f85
commit 92e0b6f026
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---
Fixed strokecaps for arrows that were showing even when not configured in figma

View file

@ -18,7 +18,7 @@ export const translateStrokes = (
strokeStyle: nodeStrokes.dashPattern.length ? 'dashed' : 'solid'
};
if (!hasFillGeometry && index === 0 && vectorNetwork && vectorNetwork.vertices.length) {
if (!hasFillGeometry && index === 0 && vectorNetwork && vectorNetwork.vertices.length > 0) {
stroke.strokeCapStart = translateStrokeCap(vectorNetwork.vertices[0]);
stroke.strokeCapEnd = translateStrokeCap(
vectorNetwork.vertices[vectorNetwork.vertices.length - 1]
@ -64,8 +64,6 @@ const translateStrokeAlignment = (
const translateStrokeCap = (vertex: VectorVertex): StrokeCaps | undefined => {
switch (vertex.strokeCap as StrokeCap | ConnectorStrokeCap) {
case 'NONE':
return;
case 'ROUND':
return 'round';
case 'ARROW_EQUILATERAL':
@ -78,7 +76,9 @@ const translateStrokeCap = (vertex: VectorVertex): StrokeCaps | undefined => {
case 'DIAMOND_FILLED':
return 'diamond-marker';
case 'ARROW_LINES':
default:
return 'line-arrow';
case 'NONE':
default:
return;
}
};