mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-07 14:18:12 +08:00
Bezier-rs: Add curvature and rotate functions to subpath (#1081)
* Add rotate and curvature * Fix comments * Fix case where curve is linear * Address comments * Fixed breakages caused by UI updates * Scootch rotation point to center in frame * Code review * Visualize t value point when segment is linear --------- Co-authored-by: Rob Nadal <robnadal44@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Rob Nadal
Keavon Chambers
parent
3f8adbafba
commit
d0ac86b713
@@ -467,7 +467,7 @@ const bezierFeatures = {
|
||||
},
|
||||
rotate: {
|
||||
name: "Rotate",
|
||||
callback: (bezier: WasmBezierInstance, options: Record<string, number>): string => bezier.rotate(options.angle * Math.PI, 100, 100),
|
||||
callback: (bezier: WasmBezierInstance, options: Record<string, number>): string => bezier.rotate(options.angle * Math.PI, 125, 100),
|
||||
demoOptions: {
|
||||
Quadratic: {
|
||||
inputOptions: [
|
||||
|
||||
@@ -95,6 +95,11 @@ const subpathFeatures = {
|
||||
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.self_intersections(options.error, options.minimum_separation),
|
||||
inputOptions: [intersectionErrorOptions, minimumSeparationOptions],
|
||||
},
|
||||
curvature: {
|
||||
name: "Curvature",
|
||||
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined): string => subpath.curvature(options.t, SUBPATH_T_VALUE_VARIANTS[options.TVariant]),
|
||||
inputOptions: [subpathTValueVariantOptions, { ...tSliderOptions, default: 0.2 }],
|
||||
},
|
||||
split: {
|
||||
name: "Split",
|
||||
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined): string => subpath.split(options.t, SUBPATH_T_VALUE_VARIANTS[options.TVariant]),
|
||||
@@ -134,6 +139,20 @@ const subpathFeatures = {
|
||||
{ ...capOptions, isDisabledForClosed: true },
|
||||
],
|
||||
},
|
||||
rotate: {
|
||||
name: "Rotate",
|
||||
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.rotate(options.angle * Math.PI, 125, 100),
|
||||
inputOptions: [
|
||||
{
|
||||
variable: "angle",
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 1 / 50,
|
||||
default: 0.12,
|
||||
unit: "π",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export type SubpathFeatureKey = keyof typeof subpathFeatures;
|
||||
|
||||
Reference in New Issue
Block a user