mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 23:28:11 +08:00
WIP moving TS compilation to docs.rs
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
import type { SubpathCallback, SubpathInputOption, WasmSubpathInstance } from "@/types";
|
||||
import { capOptions, joinOptions, tSliderOptions, subpathTValueVariantOptions, intersectionErrorOptions, minimumSeparationOptions, separationDiskDiameter, SUBPATH_T_VALUE_VARIANTS } from "@/types";
|
||||
import {
|
||||
capOptions,
|
||||
joinOptions,
|
||||
tSliderOptions,
|
||||
subpathTValueVariantOptions,
|
||||
intersectionErrorOptions,
|
||||
minimumSeparationOptions,
|
||||
separationDiskDiameter,
|
||||
SUBPATH_T_VALUE_VARIANTS,
|
||||
miterLimitOptions,
|
||||
distanceOptions,
|
||||
} from "@/types";
|
||||
|
||||
const subpathFeatures = {
|
||||
constructor: {
|
||||
@@ -160,49 +171,12 @@ const subpathFeatures = {
|
||||
offset: {
|
||||
name: "Offset",
|
||||
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.offset(options.distance, options.join, options.miter_limit),
|
||||
inputOptions: [
|
||||
{
|
||||
variable: "distance",
|
||||
inputType: "slider",
|
||||
min: -25,
|
||||
max: 25,
|
||||
step: 1,
|
||||
default: 10,
|
||||
},
|
||||
joinOptions,
|
||||
{
|
||||
variable: "join: Miter - limit",
|
||||
inputType: "slider",
|
||||
min: 1,
|
||||
max: 10,
|
||||
step: 0.25,
|
||||
default: 4,
|
||||
},
|
||||
],
|
||||
inputOptions: [distanceOptions, miterLimitOptions],
|
||||
},
|
||||
outline: {
|
||||
name: "Outline",
|
||||
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.outline(options.distance, options.join, options.cap, options.miter_limit),
|
||||
inputOptions: [
|
||||
{
|
||||
variable: "distance",
|
||||
inputType: "slider",
|
||||
min: 0,
|
||||
max: 25,
|
||||
step: 1,
|
||||
default: 10,
|
||||
},
|
||||
joinOptions,
|
||||
{
|
||||
variable: "join: Miter - limit",
|
||||
inputType: "slider",
|
||||
min: 1,
|
||||
max: 10,
|
||||
step: 0.25,
|
||||
default: 4,
|
||||
},
|
||||
{ ...capOptions, isDisabledForClosed: true },
|
||||
],
|
||||
inputOptions: [{ ...distanceOptions, min: 0 }, joinOptions, miterLimitOptions, { ...capOptions, isDisabledForClosed: true }],
|
||||
},
|
||||
rotate: {
|
||||
name: "Rotate",
|
||||
|
||||
@@ -84,9 +84,8 @@ function bezierDemoGroup(key: BezierFeatureKey, options: BezierFeatureOptions):
|
||||
points: demoOptions[curveType]?.customPoints || getBezierDemoPointDefaults()[curveType],
|
||||
inputOptions: demoOptions[curveType]?.inputOptions || demoOptions.Quadratic?.inputOptions || [],
|
||||
}));
|
||||
return renderDemoGroup(`bezier/${key}`, bezierFeatures[key].name, demos, (demo: BezierDemoArgs) =>
|
||||
demoBezier(demo.title, demo.points, key, demo.inputOptions, options.triggerOnMouseMove || false),
|
||||
);
|
||||
const buildDemo = (demo: BezierDemoArgs) => demoBezier(demo.title, demo.points, key, demo.inputOptions, options.triggerOnMouseMove || false);
|
||||
return renderDemoGroup(`bezier/${key}`, bezierFeatures[key].name, demos, buildDemo);
|
||||
}
|
||||
|
||||
function subpathDemoGroup(key: SubpathFeatureKey, options: SubpathFeatureOptions): HTMLDivElement {
|
||||
|
||||
@@ -226,6 +226,24 @@ export const subpathTValueVariantOptions = {
|
||||
options: SUBPATH_T_VALUE_VARIANTS,
|
||||
};
|
||||
|
||||
export const distanceOptions = {
|
||||
variable: "distance",
|
||||
inputType: "slider",
|
||||
min: -25,
|
||||
max: 25,
|
||||
step: 1,
|
||||
default: 10,
|
||||
};
|
||||
|
||||
export const miterLimitOptions = {
|
||||
variable: "join: Miter - limit",
|
||||
inputType: "slider",
|
||||
min: 1,
|
||||
max: 10,
|
||||
step: 0.25,
|
||||
default: 4,
|
||||
};
|
||||
|
||||
export const joinOptions = {
|
||||
variable: "join",
|
||||
inputType: "dropdown",
|
||||
|
||||
Reference in New Issue
Block a user