Skip to content

Commit

Permalink
ok (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveruizok committed Mar 9, 2024
1 parent 315d598 commit fd12047
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
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

0 comments on commit fd12047

Please sign in to comment.