From e6857f810e8868d95ebe78753568016b6dea12ca Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 8 Dec 2022 18:44:31 +0100 Subject: Copyable regions --- library/src/visualize/image.rs | 4 ++-- library/src/visualize/line.rs | 2 +- library/src/visualize/shape.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'library/src/visualize') diff --git a/library/src/visualize/image.rs b/library/src/visualize/image.rs index 48764c37..205c8a7d 100644 --- a/library/src/visualize/image.rs +++ b/library/src/visualize/image.rs @@ -41,14 +41,14 @@ impl Layout for ImageNode { &self, _: &mut Vt, styles: StyleChain, - regions: &Regions, + regions: Regions, ) -> SourceResult { let pxw = self.0.width() as f64; let pxh = self.0.height() as f64; let px_ratio = pxw / pxh; // Find out whether the image is wider or taller than the target size. - let &Regions { first, expand, .. } = regions; + let Regions { first, expand, .. } = regions; let region_ratio = first.x / first.y; let wide = px_ratio > region_ratio; diff --git a/library/src/visualize/line.rs b/library/src/visualize/line.rs index 505ad4df..0875fafc 100644 --- a/library/src/visualize/line.rs +++ b/library/src/visualize/line.rs @@ -41,7 +41,7 @@ impl Layout for LineNode { &self, _: &mut Vt, styles: StyleChain, - regions: &Regions, + regions: Regions, ) -> SourceResult { let stroke = styles.get(Self::STROKE).unwrap_or_default(); diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs index acb5a9e9..4517380a 100644 --- a/library/src/visualize/shape.rs +++ b/library/src/visualize/shape.rs @@ -76,7 +76,7 @@ impl Layout for ShapeNode { &self, vt: &mut Vt, styles: StyleChain, - regions: &Regions, + regions: Regions, ) -> SourceResult { let mut frame; if let Some(child) = &self.0 { @@ -89,7 +89,7 @@ impl Layout for ShapeNode { let child = child.clone().padded(inset.map(|side| side.map(Length::from))); let mut pod = Regions::one(regions.first, regions.base, regions.expand); - frame = child.layout(vt, styles, &pod)?.into_frame(); + frame = child.layout(vt, styles, pod)?.into_frame(); // Relayout with full expansion into square region to make sure // the result is really a square or circle. @@ -105,7 +105,7 @@ impl Layout for ShapeNode { pod.first = Size::splat(length); pod.expand = Axes::splat(true); - frame = child.layout(vt, styles, &pod)?.into_frame(); + frame = child.layout(vt, styles, pod)?.into_frame(); } } else { // The default size that a shape takes on if it has no child and -- cgit v1.2.3