From 69e96e6c1eaf9a41787939af06d77354df0fa32a Mon Sep 17 00:00:00 2001 From: Kai O'Reilly Date: Tue, 24 Dec 2024 20:20:00 -0800 Subject: [PATCH] update canvas docs to new content structure --- .../{2-widgets/5-media/canvases.md => canvas.md} | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) rename docs/content/{2-widgets/5-media/canvases.md => canvas.md} (89%) diff --git a/docs/content/2-widgets/5-media/canvases.md b/docs/content/canvas.md similarity index 89% rename from docs/content/2-widgets/5-media/canvases.md rename to docs/content/canvas.md index fecac968ff..5d7fbb616e 100644 --- a/docs/content/2-widgets/5-media/canvases.md +++ b/docs/content/canvas.md @@ -1,6 +1,12 @@ -Cogent Core provides customizable canvases that allow you to arbitrarily draw anything that you want. All canvas coordinates are on a normalized 0-1 scale. ++++ +Categories = ["Widgets"] ++++ -You can set the function used to draw the canvas: +A **canvas** allows you to arbitrarily render. All canvas coordinates are on a normalized 0-1 scale. + +## Draw + +You can set the function used to draw a canvas: ```Go core.NewCanvas(b).SetDraw(func(pc *paint.Context) { @@ -94,6 +100,8 @@ core.NewCanvas(b).SetDraw(func(pc *paint.Context) { }) ``` +## Styles + You can change the size of a canvas: ```Go @@ -105,7 +113,7 @@ c.Styler(func(s *styles.Style) { }) ``` -You can make a canvas grow to fill the available space: +You can make a canvas [[styles#grow]] to fill the available space: ```Go c := core.NewCanvas(b).SetDraw(func(pc *paint.Context) {