summaryrefslogtreecommitdiff
path: root/src/library/shape.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-01-05 14:49:14 +0100
committerLaurenz <laurmaedje@gmail.com>2022-01-05 15:06:42 +0100
commitf7e8624b4cf31744d600167dd7f3a9d9d1626014 (patch)
tree0941c8db497befc47a666d3d1384db4ab9fc5133 /src/library/shape.rs
parent4c81a5d43eabd959dbb500a8076f99f21bd037bd (diff)
Refactor
Diffstat (limited to 'src/library/shape.rs')
-rw-r--r--src/library/shape.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/library/shape.rs b/src/library/shape.rs
index 76c03edb..c47885d2 100644
--- a/src/library/shape.rs
+++ b/src/library/shape.rs
@@ -3,7 +3,6 @@
use std::f64::consts::SQRT_2;
use super::prelude::*;
-use super::LinkNode;
/// `rect`: A rectangle with optional content.
pub fn rect(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
@@ -101,6 +100,12 @@ pub struct ShapeNode {
pub child: Option<PackedNode>,
}
+#[properties]
+impl ShapeNode {
+ /// An URL the shape should link to.
+ pub const LINK: Option<String> = None;
+}
+
impl Layout for ShapeNode {
fn layout(
&self,
@@ -170,7 +175,7 @@ impl Layout for ShapeNode {
}
// Apply link if it exists.
- if let Some(url) = styles.get_ref(LinkNode::URL) {
+ if let Some(url) = styles.get_ref(Self::LINK) {
frame.link(url);
}