Bezier-rs: Implement miter-limit (#1096)

* Implement miter-limit approximation

* Refactor to use Join enum and address other comments

* Rustdocs improvements

* Tweaks

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Hannah Li
2023-03-27 19:58:35 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent f49e62a51c
commit d1630c73de
15 changed files with 106 additions and 69 deletions
@@ -126,7 +126,7 @@ const subpathFeatures = {
},
offset: {
name: "Offset",
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.offset(options.distance, options.join),
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.offset(options.distance, options.join, options.miter_limit),
inputOptions: [
{
variable: "distance",
@@ -136,11 +136,18 @@ const subpathFeatures = {
default: 10,
},
joinOptions,
{
variable: "join: Miter - limit",
min: 1,
max: 10,
step: 0.25,
default: 4,
},
],
},
outline: {
name: "Outline",
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.outline(options.distance, options.join, options.cap),
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.outline(options.distance, options.join, options.cap, options.miter_limit),
inputOptions: [
{
variable: "distance",
@@ -150,6 +157,13 @@ const subpathFeatures = {
default: 10,
},
joinOptions,
{
variable: "join: Miter - limit",
min: 1,
max: 10,
step: 0.25,
default: 4,
},
{ ...capOptions, isDisabledForClosed: true },
],
},