summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/visualize
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-library/src/visualize')
-rw-r--r--crates/typst-library/src/visualize/image.rs2
-rw-r--r--crates/typst-library/src/visualize/line.rs2
-rw-r--r--crates/typst-library/src/visualize/mod.rs1
-rw-r--r--crates/typst-library/src/visualize/path.rs4
-rw-r--r--crates/typst-library/src/visualize/polygon.rs2
-rw-r--r--crates/typst-library/src/visualize/shape.rs2
6 files changed, 7 insertions, 6 deletions
diff --git a/crates/typst-library/src/visualize/image.rs b/crates/typst-library/src/visualize/image.rs
index b4a9015f..b0c9d8ea 100644
--- a/crates/typst-library/src/visualize/image.rs
+++ b/crates/typst-library/src/visualize/image.rs
@@ -206,7 +206,7 @@ impl Layout for ImageElem {
// First, place the image in a frame of exactly its size and then resize
// the frame to the target size, center aligning the image in the
// process.
- let mut frame = Frame::new(fitted);
+ let mut frame = Frame::soft(fitted);
frame.push(Point::zero(), FrameItem::Image(image, fitted, self.span()));
frame.resize(target, Axes::splat(FixedAlign::Center));
diff --git a/crates/typst-library/src/visualize/line.rs b/crates/typst-library/src/visualize/line.rs
index 9960a2d3..6837caf1 100644
--- a/crates/typst-library/src/visualize/line.rs
+++ b/crates/typst-library/src/visualize/line.rs
@@ -75,7 +75,7 @@ impl Layout for LineElem {
let size = start.max(start + delta).max(Size::zero());
let target = regions.expand.select(regions.size, size);
- let mut frame = Frame::new(target);
+ let mut frame = Frame::soft(target);
let shape = Geometry::Line(delta.to_point()).stroked(stroke);
frame.push(start.to_point(), FrameItem::Shape(shape, self.span()));
Ok(Fragment::frame(frame))
diff --git a/crates/typst-library/src/visualize/mod.rs b/crates/typst-library/src/visualize/mod.rs
index a013853f..e39d50bc 100644
--- a/crates/typst-library/src/visualize/mod.rs
+++ b/crates/typst-library/src/visualize/mod.rs
@@ -18,6 +18,7 @@ use crate::prelude::*;
pub(super) fn define(global: &mut Scope) {
global.category("visualize");
global.define_type::<Color>();
+ global.define_type::<Gradient>();
global.define_type::<Stroke>();
global.define_elem::<ImageElem>();
global.define_elem::<LineElem>();
diff --git a/crates/typst-library/src/visualize/path.rs b/crates/typst-library/src/visualize/path.rs
index c252e95f..79364b07 100644
--- a/crates/typst-library/src/visualize/path.rs
+++ b/crates/typst-library/src/visualize/path.rs
@@ -82,7 +82,7 @@ impl Layout for PathElem {
let mut size = Size::zero();
if points.is_empty() {
- return Ok(Fragment::frame(Frame::new(size)));
+ return Ok(Fragment::frame(Frame::soft(size)));
}
// Only create a path if there are more than zero points.
@@ -138,7 +138,7 @@ impl Layout for PathElem {
Smart::Custom(stroke) => stroke.map(Stroke::unwrap_or_default),
};
- let mut frame = Frame::new(size);
+ let mut frame = Frame::soft(size);
let shape = Shape { geometry: Geometry::Path(path), stroke, fill };
frame.push(Point::zero(), FrameItem::Shape(shape, self.span()));
diff --git a/crates/typst-library/src/visualize/polygon.rs b/crates/typst-library/src/visualize/polygon.rs
index 9f573467..1d19a94d 100644
--- a/crates/typst-library/src/visualize/polygon.rs
+++ b/crates/typst-library/src/visualize/polygon.rs
@@ -130,7 +130,7 @@ impl Layout for PolygonElem {
.collect();
let size = points.iter().fold(Point::zero(), |max, c| c.max(max)).to_size();
- let mut frame = Frame::new(size);
+ let mut frame = Frame::hard(size);
// Only create a path if there are more than zero points.
if points.is_empty() {
diff --git a/crates/typst-library/src/visualize/shape.rs b/crates/typst-library/src/visualize/shape.rs
index 64d1ece6..3d4368f5 100644
--- a/crates/typst-library/src/visualize/shape.rs
+++ b/crates/typst-library/src/visualize/shape.rs
@@ -492,7 +492,7 @@ fn layout(
if kind.is_quadratic() {
size = Size::splat(size.min_by_side());
}
- frame = Frame::new(size);
+ frame = Frame::soft(size);
}
// Prepare stroke.