From 9799d3c6a8f0c242668203a1c70d7b6cfed3e855 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Tue, 15 Dec 2020 00:46:54 +0100 Subject: Refactor to make interaction between tools easier --- src/scaleable.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/scaleable.rs (limited to 'src/scaleable.rs') 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); +} -- cgit v1.2.3-70-g09d2