summaryrefslogtreecommitdiff
path: root/library/src/visualize
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-19 22:28:49 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-19 22:39:19 +0100
commitab43bd802eafe33977a91893907e67553e099569 (patch)
treeaf4dead92b143348f52e2e8f869df3f7dfd7322a /library/src/visualize
parentd6aaae0cea1e79eecd85dc94ab85b9ad8eff48e8 (diff)
Renaming and refactoring
Diffstat (limited to 'library/src/visualize')
-rw-r--r--library/src/visualize/image.rs8
-rw-r--r--library/src/visualize/line.rs8
-rw-r--r--library/src/visualize/shape.rs26
3 files changed, 21 insertions, 21 deletions
diff --git a/library/src/visualize/image.rs b/library/src/visualize/image.rs
index c5016436..8a81a40e 100644
--- a/library/src/visualize/image.rs
+++ b/library/src/visualize/image.rs
@@ -22,8 +22,8 @@ use crate::prelude::*;
///
/// Display: Image
/// Category: visualize
-#[node(Layout)]
-pub struct ImageNode {
+#[element(Layout)]
+pub struct ImageElem {
/// Path to an image file.
#[required]
#[parse(
@@ -46,7 +46,7 @@ pub struct ImageNode {
pub fit: ImageFit,
}
-impl Layout for ImageNode {
+impl Layout for ImageElem {
fn layout(
&self,
vt: &mut Vt,
@@ -97,7 +97,7 @@ impl Layout for ImageNode {
// the frame to the target size, center aligning the image in the
// process.
let mut frame = Frame::new(fitted);
- frame.push(Point::zero(), Element::Image(image, fitted, self.span()));
+ frame.push(Point::zero(), FrameItem::Image(image, fitted, self.span()));
frame.resize(target, Align::CENTER_HORIZON);
// Create a clipping group if only part of the image should be visible.
diff --git a/library/src/visualize/line.rs b/library/src/visualize/line.rs
index 6614e3ee..0932a9f1 100644
--- a/library/src/visualize/line.rs
+++ b/library/src/visualize/line.rs
@@ -11,8 +11,8 @@ use crate::prelude::*;
///
/// Display: Line
/// Category: visualize
-#[node(Layout)]
-pub struct LineNode {
+#[element(Layout)]
+pub struct LineElem {
/// The start point of the line.
///
/// Must be an array of exactly two relative lengths.
@@ -49,7 +49,7 @@ pub struct LineNode {
pub stroke: PartialStroke,
}
-impl Layout for LineNode {
+impl Layout for LineElem {
fn layout(
&self,
_: &mut Vt,
@@ -76,7 +76,7 @@ impl Layout for LineNode {
let mut frame = Frame::new(target);
let shape = Geometry::Line(delta.to_point()).stroked(stroke);
- frame.push(start.to_point(), Element::Shape(shape, self.span()));
+ frame.push(start.to_point(), FrameItem::Shape(shape, self.span()));
Ok(Fragment::frame(frame))
}
}
diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs
index 8aef3629..601f0d85 100644
--- a/library/src/visualize/shape.rs
+++ b/library/src/visualize/shape.rs
@@ -18,8 +18,8 @@ use crate::prelude::*;
///
/// Display: Rectangle
/// Category: visualize
-#[node(Layout)]
-pub struct RectNode {
+#[element(Layout)]
+pub struct RectElem {
/// The rectangle's width, relative to its parent container.
pub width: Smart<Rel<Length>>,
@@ -139,7 +139,7 @@ pub struct RectNode {
pub body: Option<Content>,
}
-impl Layout for RectNode {
+impl Layout for RectElem {
fn layout(
&self,
vt: &mut Vt,
@@ -179,8 +179,8 @@ impl Layout for RectNode {
///
/// Display: Square
/// Category: visualize
-#[node(Layout)]
-pub struct SquareNode {
+#[element(Layout)]
+pub struct SquareElem {
/// The square's side length. This is mutually exclusive with `width` and
/// `height`.
#[external]
@@ -249,7 +249,7 @@ pub struct SquareNode {
pub body: Option<Content>,
}
-impl Layout for SquareNode {
+impl Layout for SquareElem {
fn layout(
&self,
vt: &mut Vt,
@@ -290,8 +290,8 @@ impl Layout for SquareNode {
///
/// Display: Ellipse
/// Category: visualize
-#[node(Layout)]
-pub struct EllipseNode {
+#[element(Layout)]
+pub struct EllipseElem {
/// The ellipse's width, relative to its parent container.
pub width: Smart<Rel<Length>>,
@@ -331,7 +331,7 @@ pub struct EllipseNode {
pub body: Option<Content>,
}
-impl Layout for EllipseNode {
+impl Layout for EllipseElem {
fn layout(
&self,
vt: &mut Vt,
@@ -372,8 +372,8 @@ impl Layout for EllipseNode {
///
/// Display: Circle
/// Category: visualize
-#[node(Layout)]
-pub struct CircleNode {
+#[element(Layout)]
+pub struct CircleElem {
/// The circle's radius. This is mutually exclusive with `width` and
/// `height`.
#[external]
@@ -438,7 +438,7 @@ pub struct CircleNode {
pub body: Option<Content>,
}
-impl Layout for CircleNode {
+impl Layout for CircleElem {
fn layout(
&self,
vt: &mut Vt,
@@ -529,7 +529,7 @@ fn layout(
let size = frame.size() + outset.sum_by_axis();
let pos = Point::new(-outset.left, -outset.top);
let shape = ellipse(size, fill, stroke.left);
- frame.prepend(pos, Element::Shape(shape, span));
+ frame.prepend(pos, FrameItem::Shape(shape, span));
} else {
frame.fill_and_stroke(fill, stroke, outset, radius, span);
}