diff --git a/bezier-rs/docs/interactive-docs/src/App.vue b/bezier-rs/docs/interactive-docs/src/App.vue index ed1750ad..9340d028 100644 --- a/bezier-rs/docs/interactive-docs/src/App.vue +++ b/bezier-rs/docs/interactive-docs/src/App.vue @@ -2,7 +2,8 @@

Bezier-rs Interactive Documentation

This is the interactive documentation for the bezier-rs library. Click and drag on the endpoints of the example curves to visualize the various Bezier utilities and functions.

-
+

Beziers

+
+

Subpaths

+
+ +
@@ -21,10 +26,11 @@ import { defineComponent, markRaw } from "vue"; import { drawText, drawPoint, drawBezier, drawLine, getContextFromCanvas, drawBezierHelper, COLORS } from "@/utils/drawing"; -import { BezierCurveType, Point, WasmBezierInstance } from "@/utils/types"; +import { BezierCurveType, Point, WasmBezierInstance, WasmSubpathInstance } from "@/utils/types"; import ExamplePane from "@/components/ExamplePane.vue"; import SliderExample from "@/components/SliderExample.vue"; +import SubpathExamplePane from "@/components/SubpathExamplePane.vue"; const tSliderOptions = { min: 0, @@ -37,13 +43,9 @@ const tSliderOptions = { const SCALE_UNIT_VECTOR_FACTOR = 50; export default defineComponent({ - name: "App", - components: { - ExamplePane, - }, data() { return { - features: [ + bezierFeatures: [ { name: "Constructor", // eslint-disable-next-line @@ -355,8 +357,22 @@ export default defineComponent({ }, }, ], + subpathFeatures: [ + { + name: "Constructor", + callback: (subpath: WasmSubpathInstance): string => subpath.to_svg(), + }, + { + name: "Length", + callback: (subpath: WasmSubpathInstance): string => subpath.length(), + }, + ], }; }, + components: { + ExamplePane, + SubpathExamplePane, + }, }); diff --git a/bezier-rs/docs/interactive-docs/src/components/Example.vue b/bezier-rs/docs/interactive-docs/src/components/Example.vue index ec5dce8a..b5411bca 100644 --- a/bezier-rs/docs/interactive-docs/src/components/Example.vue +++ b/bezier-rs/docs/interactive-docs/src/components/Example.vue @@ -12,12 +12,6 @@ import BezierDrawing from "@/components/BezierDrawing"; import { BezierCallback, WasmBezierInstance } from "@/utils/types"; export default defineComponent({ - name: "ExampleComponent", - data() { - return { - bezierDrawing: new BezierDrawing(this.bezier, this.callback, this.options, this.createThroughPoints), - }; - }, props: { title: String, bezier: { @@ -37,6 +31,11 @@ export default defineComponent({ default: false, }, }, + data() { + return { + bezierDrawing: new BezierDrawing(this.bezier, this.callback, this.options, this.createThroughPoints), + }; + }, mounted() { const drawing = this.$refs.drawing as HTMLElement; drawing.appendChild(this.bezierDrawing.getCanvas()); diff --git a/bezier-rs/docs/interactive-docs/src/components/ExamplePane.vue b/bezier-rs/docs/interactive-docs/src/components/ExamplePane.vue index 1cded33d..8b919503 100644 --- a/bezier-rs/docs/interactive-docs/src/components/ExamplePane.vue +++ b/bezier-rs/docs/interactive-docs/src/components/ExamplePane.vue @@ -1,6 +1,6 @@