|
@@ -18,7 +18,7 @@
|
|
|
|
|
|
|
|
use async_trait::async_trait;
|
|
use async_trait::async_trait;
|
|
|
use darkfi_serial::{SerialDecodable, SerialEncodable};
|
|
use darkfi_serial::{SerialDecodable, SerialEncodable};
|
|
|
-use std::ops::{Add, AddAssign, Div, Mul, Sub, SubAssign};
|
|
|
|
|
|
|
+use std::ops::{Add, AddAssign, Div, DivAssign, Mul, Sub, SubAssign};
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, SerialEncodable, SerialDecodable)]
|
|
#[derive(Clone, Copy, Debug, SerialEncodable, SerialDecodable)]
|
|
|
pub struct Dimension {
|
|
pub struct Dimension {
|
|
@@ -278,6 +278,15 @@ impl Div<f32> for Rectangle {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+impl DivAssign<f32> for Rectangle {
|
|
|
|
|
+ fn div_assign(&mut self, scale: f32) {
|
|
|
|
|
+ self.x /= scale;
|
|
|
|
|
+ self.y /= scale;
|
|
|
|
|
+ self.w /= scale;
|
|
|
|
|
+ self.h /= scale;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
impl std::fmt::Debug for Rectangle {
|
|
impl std::fmt::Debug for Rectangle {
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
write!(f, "({}, {}, {}, {})", self.x, self.y, self.w, self.h)
|
|
write!(f, "({}, {}, {}, {})", self.x, self.y, self.w, self.h)
|