Skip to content

Commit

Permalink
Fixed arrows strokecaps (#68)
Browse files Browse the repository at this point in the history
* fixed arrows strokecaps

* fixed arrows strokecaps
  • Loading branch information
Cenadros committed Apr 24, 2024
1 parent b298dc6 commit 92e0b6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-camels-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---

Fixed strokecaps for arrows that were showing even when not configured in figma
8 changes: 4 additions & 4 deletions plugin-src/translators/translateStrokes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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':
Expand All @@ -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;
}
};

0 comments on commit 92e0b6f

Please sign in to comment.