Skip to content

Commit

Permalink
Update getStrokeOutlinePoints.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
steveruizok committed Sep 7, 2022
1 parent c1d5ace commit 9fdb2ef
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/perfect-freehand/src/getStrokeOutlinePoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
dist2,
dpr,
lrp,
med,
mul,
neg,
per,
Expand Down Expand Up @@ -52,10 +51,10 @@ export function getStrokeOutlinePoints(
last: isComplete = false,
} = options

let { cap: capStart = true, easing: taperStartEase = (t) => t * (2 - t) } =
const { cap: capStart = true, easing: taperStartEase = (t) => t * (2 - t) } =
start

let { cap: capEnd = true, easing: taperEndEase = (t) => --t * t * t + 1 } =
const { cap: capEnd = true, easing: taperEndEase = (t) => --t * t * t + 1 } =
end

// We can't do anything with an empty array or a stroke with negative size.
Expand Down Expand Up @@ -130,7 +129,7 @@ export function getStrokeOutlinePoints(
// Keep track of whether the previous point is a sharp corner
// ... so that we don't detect the same corner twice
let isPrevPointSharpCorner = false

// let short = true

/*
Expand Down Expand Up @@ -209,8 +208,9 @@ export function getStrokeOutlinePoints(
draw a cap at the current point.
*/

const nextVector = (i < points.length - 1? points[i + 1] : points[i]).vector
const nextDpr = (i < points.length - 1? dpr(vector, nextVector) : 1.0)
const nextVector = (i < points.length - 1 ? points[i + 1] : points[i])
.vector
const nextDpr = i < points.length - 1 ? dpr(vector, nextVector) : 1.0
const prevDpr = dpr(vector, prevVector)

const isPointSharpCorner = prevDpr < 0 && !isPrevPointSharpCorner
Expand Down Expand Up @@ -239,9 +239,9 @@ export function getStrokeOutlinePoints(
}
continue
}

isPrevPointSharpCorner = false

// Handle the last point
if (i === points.length - 1) {
const offset = mul(per(vector), radius)
Expand Down

0 comments on commit 9fdb2ef

Please sign in to comment.