aboutsummaryrefslogtreecommitdiff
path: root/src/scaleable.rs
diff options
context:
space:
mode:
authorArne Dußin2020-12-15 00:46:54 +0100
committerArne Dußin2020-12-15 22:51:46 +0100
commit9799d3c6a8f0c242668203a1c70d7b6cfed3e855 (patch)
tree9116acbc886f680f82309a42b4e6147e65c1433b /src/scaleable.rs
parent3bc690803fb59493ea8180fd630d65b3e26642d0 (diff)
downloadgraf_karto-9799d3c6a8f0c242668203a1c70d7b6cfed3e855.tar.gz
graf_karto-9799d3c6a8f0c242668203a1c70d7b6cfed3e855.zip
Refactor to make interaction between tools easier
Diffstat (limited to 'src/scaleable.rs')
-rw-r--r--src/scaleable.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/scaleable.rs b/src/scaleable.rs
new file mode 100644
index 0000000..450e61e
--- /dev/null
+++ b/src/scaleable.rs
@@ -0,0 +1,11 @@
+use crate::math::Vec2;
+
+/// Trait representing something that covers an area and that can be resized accordingly.
+pub trait Scaleable {
+ /// Scale the object by the specified amount in horizontal and vertical direction (right and
+ /// downwards).
+ ///
+ /// # Panics
+ /// If at least one of the dimensions is zero or less, the object cannot be scaled and panics.
+ fn scale(&mut self, by: &Vec2<f64>);
+}