Skip to content

Commit

Permalink
Merge branch 'main' into feature/text
Browse files Browse the repository at this point in the history
  • Loading branch information
Cenadros committed Apr 29, 2024
2 parents 78be941 + 59d70d2 commit e4a373c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 21 deletions.
5 changes: 0 additions & 5 deletions .changeset/flat-balloons-exercise.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/many-otters-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---

Fix vector shapes to be more precise with what you draw on figma
5 changes: 0 additions & 5 deletions .changeset/perfect-masks-kneel.md

This file was deleted.

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# penpot-exporter

## 0.2.1

### Patch Changes

- [#71](https://github.com/penpot/penpot-exporter-figma-plugin/pull/71) [`3dec0a4`](https://github.com/penpot/penpot-exporter-figma-plugin/commit/3dec0a452079e1a1a3e64290e16b881a47a22876) Thanks [@Cenadros](https://github.com/Cenadros)! - Fix blend mode 'color' translation

## 0.2.0

### Minor Changes

- [#58](https://github.com/penpot/penpot-exporter-figma-plugin/pull/58) [`e732887`](https://github.com/penpot/penpot-exporter-figma-plugin/commit/e73288739987d67135dc20ebb97fd165b3da0c79) Thanks [@jordisala1991](https://github.com/jordisala1991)! - Shadows

- [#57](https://github.com/penpot/penpot-exporter-figma-plugin/pull/57) [`c464ff9`](https://github.com/penpot/penpot-exporter-figma-plugin/commit/c464ff9bda24ef1660f2a58ecb39f76f1e8151a8) Thanks [@Cenadros](https://github.com/Cenadros)! - Added support for corner radius

### Patch Changes

- [#68](https://github.com/penpot/penpot-exporter-figma-plugin/pull/68) [`92e0b6f`](https://github.com/penpot/penpot-exporter-figma-plugin/commit/92e0b6f026c8f05d1581bd6d3774e20f6992cb92) Thanks [@Cenadros](https://github.com/Cenadros)! - Fixed strokecaps for arrows that were showing even when not configured in figma

## 0.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "penpot-exporter",
"version": "0.1.0",
"version": "0.2.1",
"description": "Penpot exporter",
"type": "module",
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions plugin-src/transformers/partials/transformVectorPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ import { translateVectorPaths } from '@plugin/translators';

import { PathAttributes } from '@ui/lib/types/path/pathAttributes';

const hasFillGeometry = (node: VectorNode | StarNode | LineNode | PolygonNode): boolean => {
return 'fillGeometry' in node && node.fillGeometry.length > 0;
};

const getVectorPaths = (node: VectorNode | StarNode | LineNode | PolygonNode): VectorPaths => {
switch (node.type) {
case 'STAR':
case 'POLYGON':
return node.fillGeometry;
case 'VECTOR':
return hasFillGeometry(node) ? node.fillGeometry : node.vectorPaths;
return node.vectorPaths;
case 'LINE':
return node.strokeGeometry;
}
Expand Down
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;
}
};
3 changes: 2 additions & 1 deletion ui-src/translators/translateUiBlendMode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
BLEND_MODE_COLOR,
BLEND_MODE_COLOR_BURN,
BLEND_MODE_COLOR_DODGE,
BLEND_MODE_DARKEN,
Expand Down Expand Up @@ -50,7 +51,7 @@ export const translateUiBlendMode = (blendMode?: BlendMode): BlendMode | undefin
case 'saturation':
return BLEND_MODE_SATURATION;
case 'color':
return BLEND_MODE_COLOR_BURN;
return BLEND_MODE_COLOR;
case 'luminosity':
return BLEND_MODE_LUMINOSITY;
default:
Expand Down

0 comments on commit e4a373c

Please sign in to comment.