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

1.2.2 release #79

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
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: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ Draw perfect pressure-sensitive freehand lines.

💅 Designer? Check out the [Figma Plugin](https://www.figma.com/community/plugin/950892731860805817).

💕 Love this library? Consider [becoming a sponsor](https://github.com/sponsors/steveruizok?frequency=recurring&sponsor=steveruizok).
🕊 Flutterer? There's now a [dart version](https://pub.dev/packages/perfect_freehand) of this library, too.

Also available in:
- 🎯 [Flutter / Dart](https://pub.dev/packages/perfect_freehand)
- 🐍 [Python](https://github.com/bigbluebutton/perfect-freehand-python)
💕 Love this library? Consider [becoming a sponsor](https://github.com/sponsors/steveruizok?frequency=recurring&sponsor=steveruizok).

## Table of Contents

Expand Down Expand Up @@ -165,7 +163,7 @@ The options object is optional, as are each of its properties.
| `easing` | function | t => t | An easing function to apply to each point's pressure. |
| `start` | { } | | Tapering options for the start of the line. |
| `end` | { } | | Tapering options for the end of the line. |
| `last` | boolean | false | Whether the stroke is complete. |
| `last` | boolean | true | Whether the stroke is complete. |

**Note:** When the `last` property is `true`, the line's end will be drawn at the last input point, rather than slightly behind it.

Expand Down Expand Up @@ -277,14 +275,19 @@ function getSvgPathFromStroke(points, closed = true) {
let b = points[1]
const c = points[2]

let result = `M${a[0].toFixed(2)},${a[1].toFixed(2)} Q${b[0].toFixed(2)},${b[1].toFixed(
let result = `M${a[0].toFixed(2)},${a[1].toFixed(2)} Q${b[0].toFixed(
2
)} ${average(b[0], c[0]).toFixed(2)},${average(b[1], c[1]).toFixed(2)} T`
)},${b[1].toFixed(2)} ${average(b[0], c[0]).toFixed(2)},${average(
b[1],
c[1]
).toFixed(2)} T`

for (let i = 2, max = len - 1; i < max; i++) {
a = points[i]
b = points[i + 1]
result += `${average(a[0], b[0]).toFixed(2)},${average(a[1], b[1]).toFixed(2)} `
result += `${average(a[0], b[0]).toFixed(2)},${average(a[1], b[1]).toFixed(
2
)} `
}

if (closed) {
Expand Down
2 changes: 1 addition & 1 deletion packages/perfect-freehand/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.0",
"version": "1.2.2",
"name": "perfect-freehand",
"private": false,
"description": "Draw perfect pressure-sensitive freehand strokes.",
Expand Down
Loading