From 35b16e545b4fce299edbc00c9a9754179fa51634 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 17 Dec 2022 16:24:29 +0100 Subject: Document parameters in comment --- library/src/visualize/image.rs | 9 ++++++++- library/src/visualize/line.rs | 15 ++++++++++++++- library/src/visualize/shape.rs | 21 ++++++++++++++++++--- 3 files changed, 40 insertions(+), 5 deletions(-) (limited to 'library/src/visualize') diff --git a/library/src/visualize/image.rs b/library/src/visualize/image.rs index 936ec3bf..0ce3f20b 100644 --- a/library/src/visualize/image.rs +++ b/library/src/visualize/image.rs @@ -6,7 +6,14 @@ use crate::prelude::*; /// Show a raster or vector graphic. /// -/// Tags: visualize. +/// Supported formats are PNG, JPEG, GIF and SVG. +/// +/// # Parameters +/// - path: EcoString (positional, required) +/// Path to an image file. +/// +/// # Tags +/// - visualize #[func] #[capable(Layout, Inline)] #[derive(Debug, Hash)] diff --git a/library/src/visualize/line.rs b/library/src/visualize/line.rs index 9c9b8b00..5c8c9644 100644 --- a/library/src/visualize/line.rs +++ b/library/src/visualize/line.rs @@ -2,7 +2,20 @@ use crate::prelude::*; /// Display a line without affecting the layout. /// -/// Tags: visualize. +/// You should only provide either an endpoint or an angle and a length. +/// +/// # Parameters +/// - origin: Axes> (named) +/// The start point of the line. +/// - to: Axes> (named) +/// The end point of the line. +/// - length: Rel (named) +/// The line's length. +/// - angle: Angle (named) +/// The angle at which the line points away from the origin. +/// +/// # Tags +/// - visualize #[func] #[capable(Layout, Inline)] #[derive(Debug, Hash)] diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs index a3443189..be80b4fb 100644 --- a/library/src/visualize/shape.rs +++ b/library/src/visualize/shape.rs @@ -4,7 +4,22 @@ use crate::prelude::*; /// A sizable and fillable shape with optional content. /// -/// Tags: visualize. +/// # Parameters +/// - body: Content (positional) +/// The content to place into the shape. +/// - width: Rel (named) +/// The shape's width. +/// - height: Rel (named) +/// The shape's height. +/// - size: Length (named) +/// The square's side length. +/// - radius: Length (named) +/// The circle's radius. +/// - stroke: Smart>> (named) +/// How to stroke the shape. +/// +/// # Tags +/// - visualize #[func] #[capable(Layout, Inline)] #[derive(Debug, Hash)] @@ -27,7 +42,7 @@ impl ShapeNode { /// How to fill the shape. pub const FILL: Option = None; /// How to stroke the shape. - #[property(reflect, skip, resolve, fold)] + #[property(skip, resolve, fold)] pub const STROKE: Smart>> = Smart::Auto; /// How much to pad the shape's content. @@ -38,7 +53,7 @@ impl ShapeNode { pub const OUTSET: Sides>> = Sides::splat(Rel::zero()); /// How much to round the shape's corners. - #[property(reflect, skip, resolve, fold)] + #[property(skip, resolve, fold)] pub const RADIUS: Corners>> = Corners::splat(Rel::zero()); fn construct(_: &Vm, args: &mut Args) -> SourceResult { -- cgit v1.2.3