summaryrefslogtreecommitdiff
path: root/library/src/visualize
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/visualize')
-rw-r--r--library/src/visualize/image.rs4
-rw-r--r--library/src/visualize/line.rs4
-rw-r--r--library/src/visualize/shape.rs4
3 files changed, 9 insertions, 3 deletions
diff --git a/library/src/visualize/image.rs b/library/src/visualize/image.rs
index 205c8a7d..b8b05aec 100644
--- a/library/src/visualize/image.rs
+++ b/library/src/visualize/image.rs
@@ -5,10 +5,12 @@ use typst::image::{Image, ImageFormat, RasterFormat, VectorFormat};
use crate::prelude::*;
/// Show a raster or vector graphic.
+#[func]
+#[capable(Layout, Inline)]
#[derive(Debug, Hash)]
pub struct ImageNode(pub Image);
-#[node(Layout, Inline)]
+#[node]
impl ImageNode {
/// How the image should adjust itself to a given area.
pub const FIT: ImageFit = ImageFit::Cover;
diff --git a/library/src/visualize/line.rs b/library/src/visualize/line.rs
index ef6ce2c3..ed6a3d92 100644
--- a/library/src/visualize/line.rs
+++ b/library/src/visualize/line.rs
@@ -1,6 +1,8 @@
use crate::prelude::*;
/// Display a line without affecting the layout.
+#[func]
+#[capable(Layout, Inline)]
#[derive(Debug, Hash)]
pub struct LineNode {
/// Where the line starts.
@@ -9,7 +11,7 @@ pub struct LineNode {
pub delta: Axes<Rel<Length>>,
}
-#[node(Layout, Inline)]
+#[node]
impl LineNode {
/// How to stroke the line.
#[property(resolve, fold)]
diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs
index 4517380a..702fc6f8 100644
--- a/library/src/visualize/shape.rs
+++ b/library/src/visualize/shape.rs
@@ -3,6 +3,8 @@ use std::f64::consts::SQRT_2;
use crate::prelude::*;
/// A sizable and fillable shape with optional content.
+#[func]
+#[capable(Layout, Inline)]
#[derive(Debug, Hash)]
pub struct ShapeNode<const S: ShapeKind>(pub Option<Content>);
@@ -18,7 +20,7 @@ pub type CircleNode = ShapeNode<CIRCLE>;
/// A ellipse with optional content.
pub type EllipseNode = ShapeNode<ELLIPSE>;
-#[node(Layout, Inline)]
+#[node]
impl<const S: ShapeKind> ShapeNode<S> {
/// How to fill the shape.
pub const FILL: Option<Paint> = None;