Skip to content

Commit

Permalink
Updates comments
Browse files Browse the repository at this point in the history
  • Loading branch information
steveruizok committed Oct 5, 2021
1 parent 79e4ef9 commit 9cf702c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
8 changes: 4 additions & 4 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import fs from 'fs'

const files = [
'README.md',
'process.gif',
'icons.png',
'perfect-freehand-card.png',
'perfect-freehand-logo.svg',
'assets/process.gif',
'assets/icons.png',
'assets/perfect-freehand-card.png',
'assets/perfect-freehand-logo.svg',
]

for (const file of files) {
Expand Down
4 changes: 4 additions & 0 deletions packages/perfect-freehand/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.14

- Updates README and documentation.

## 1.0.13

- Fixes an issue where default values were incorrectly being inserted for zero pressure points.
Expand Down
4 changes: 2 additions & 2 deletions packages/perfect-freehand/src/getStroke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { getStrokePoints } from './getStrokePoints'
* @param options.smoothing How much to soften the stroke's edges.
* @param options.easing An easing function to apply to each point's pressure.
* @param options.simulatePressure Whether to simulate pressure based on velocity.
* @param options.start Tapering and easing function for the start of the line.
* @param options.end Tapering and easing function for the end of the line.
* @param options.start Cap, taper and easing for the start of the line.
* @param options.end Cap, taper and easing for the end of the line.
* @param options.last Whether to handle the points as a completed stroke.
*/

Expand Down
8 changes: 4 additions & 4 deletions packages/perfect-freehand/src/getStrokeOutlinePoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ const FIXED_PI = PI + 0.0001
/**
* ## getStrokeOutlinePoints
* @description Get an array of points (as `[x, y]`) representing the outline of a stroke.
* @param points An array of points (as `[x, y, pressure]` or `{x, y, pressure}`). Pressure is optional.
* @param options An (optional) object with options.
* @param points An array of StrokePoints as returned from `getStrokePoints`.
* @param options (optional) An object with options.
* @param options.size The base size (diameter) of the stroke.
* @param options.thinning The effect of pressure on the stroke's size.
* @param options.smoothing How much to soften the stroke's edges.
* @param options.easing An easing function to apply to each point's pressure.
* @param options.simulatePressure Whether to simulate pressure based on velocity.
* @param options.start Tapering and easing function for the start of the line.
* @param options.end Tapering and easing function for the end of the line.
* @param options.start Cap, taper and easing for the start of the line.
* @param options.end Cap, taper and easing for the end of the line.
* @param options.last Whether to handle the points as a completed stroke.
*/
export function getStrokeOutlinePoints(
Expand Down
13 changes: 10 additions & 3 deletions packages/perfect-freehand/src/getStrokePoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ import type { StrokeOptions, StrokePoint } from './types'
/**
* ## getStrokePoints
* @description Get an array of points as objects with an adjusted point, pressure, vector, distance, and runningLength.
* @param points An array of points (as `[x, y, pressure]` or `{x, y, pressure}`). Pressure is optional.
* @param streamline How much to streamline the stroke.
* @param size The stroke's size.
* @param points An array of points (as `[x, y, pressure]` or `{x, y, pressure}`). Pressure is optional in both cases.
* @param options (optional) An object with options.
* @param options.size The base size (diameter) of the stroke.
* @param options.thinning The effect of pressure on the stroke's size.
* @param options.smoothing How much to soften the stroke's edges.
* @param options.easing An easing function to apply to each point's pressure.
* @param options.simulatePressure Whether to simulate pressure based on velocity.
* @param options.start Cap, taper and easing for the start of the line.
* @param options.end Cap, taper and easing for the end of the line.
* @param options.last Whether to handle the points as a completed stroke.
*/
export function getStrokePoints<
T extends number[],
Expand Down
11 changes: 11 additions & 0 deletions packages/perfect-freehand/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/**
* The options object for `getStroke` or `getStrokePoints`.
* @param points An array of points (as `[x, y, pressure]` or `{x, y, pressure}`). Pressure is optional in both cases.
* @param options (optional) An object with options.
* @param options.size The base size (diameter) of the stroke.
* @param options.thinning The effect of pressure on the stroke's size.
* @param options.smoothing How much to soften the stroke's edges.
* @param options.easing An easing function to apply to each point's pressure.
* @param options.simulatePressure Whether to simulate pressure based on velocity.
* @param options.start Cap, taper and easing for the start of the line.
* @param options.end Cap, taper and easing for the end of the line.
* @param options.last Whether to handle the points as a completed stroke.
*/
export interface StrokeOptions {
size?: number
Expand All @@ -18,6 +28,7 @@ export interface StrokeOptions {
taper?: number
easing?: (distance: number) => number
}
// Whether to handle the points as a completed stroke.
last?: boolean
}

Expand Down

0 comments on commit 9cf702c

Please sign in to comment.