From 416209bb530e4ce1b4c19b11e3aa94bcd4275128 Mon Sep 17 00:00:00 2001 From: Johannes Wolf Date: Fri, 24 Jan 2025 20:01:53 +0100 Subject: [PATCH] docs: Update documentation --- docs/api/draw-functions/shapes/polygon.mdx | 5 +++++ docs/api/draw-functions/shapes/shapes.md | 1 + docs/api/sidebar.js | 2 ++ src/draw/shapes.typ | 6 ++++++ 4 files changed, 14 insertions(+) create mode 100644 docs/api/draw-functions/shapes/polygon.mdx diff --git a/docs/api/draw-functions/shapes/polygon.mdx b/docs/api/draw-functions/shapes/polygon.mdx new file mode 100644 index 000000000..5f211c327 --- /dev/null +++ b/docs/api/draw-functions/shapes/polygon.mdx @@ -0,0 +1,5 @@ +import Polygon from "@site/cetz/docs/_generated/draw/shapes/polygon.mdx"; + +# polygon + + diff --git a/docs/api/draw-functions/shapes/shapes.md b/docs/api/draw-functions/shapes/shapes.md index e95df7215..66fd77b86 100644 --- a/docs/api/draw-functions/shapes/shapes.md +++ b/docs/api/draw-functions/shapes/shapes.md @@ -6,6 +6,7 @@ Draw functions that draw shapes onto the canvas, be that lines, circles or curve - [arc](./arc) Draws an arc between two points. - [mark](./mark) Draws a mark at a point in a direction. - [line](./line) Draws a line between two points, or a line strip between 3 or more points. +- [polygon](./polygon) Draws a regular polygon. - [grid](./grid) Draws a grid. - [content](./content) Places some content on the canvas. - [rect](./rect) Draws a rectangle between two points. diff --git a/docs/api/sidebar.js b/docs/api/sidebar.js index 1461a6407..ad8828c36 100644 --- a/docs/api/sidebar.js +++ b/docs/api/sidebar.js @@ -21,6 +21,7 @@ export default [ "api/draw-functions/shapes/arc", "api/draw-functions/shapes/mark", "api/draw-functions/shapes/line", + "api/draw-functions/shapes/polygon", "api/draw-functions/shapes/grid", "api/draw-functions/shapes/content", "api/draw-functions/shapes/rect", @@ -42,6 +43,7 @@ export default [ "api/draw-functions/grouping/intersections", "api/draw-functions/grouping/group", "api/draw-functions/grouping/anchor", + "api/draw-functions/grouping/scope", "api/draw-functions/grouping/copy-anchors", "api/draw-functions/grouping/set-ctx", "api/draw-functions/grouping/get-ctx", diff --git a/src/draw/shapes.typ b/src/draw/shapes.typ index a93712ab7..147b27f4a 100644 --- a/src/draw/shapes.typ +++ b/src/draw/shapes.typ @@ -591,6 +591,12 @@ /// Draws a regular polygon. /// +/// ```typc example +/// polygon((0,0), 3, angle: 90deg) +/// polygon((2,0), 5) +/// polygon((4,0), 7) +/// ``` +/// /// - origin (coordinate): Coordinate to draw the polygon at /// - sides (int): Number of sides of the polygon (>= 3) /// - angle (angle) = 0deg: Angle angle to rotate the polygon arround its origin