diff options
author | Minijackson <minijackson@riseup.net> | 2023-01-04 09:37:15 +0100 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2023-01-04 09:37:15 +0100 |
commit | c1ac90def08fa7a16c120e57c21f50abc743fd70 (patch) | |
tree | 799f543a7fbc020f2167f0cfc90130c472a407f4 /core | |
parent | 989ac33ced6210419795c50387a4c42a8e33b40f (diff) | |
download | diaphragm-c1ac90def08fa7a16c120e57c21f50abc743fd70.tar.gz diaphragm-c1ac90def08fa7a16c120e57c21f50abc743fd70.zip |
core/type: add middle points methods to Bound
Diffstat (limited to 'core')
-rw-r--r-- | core/src/types.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/src/types.rs b/core/src/types.rs index 96e059a..b3df84f 100644 --- a/core/src/types.rs +++ b/core/src/types.rs | |||
@@ -141,6 +141,10 @@ impl Bounds { | |||
141 | Point2D::new(self.right(solver), self.top) | 141 | Point2D::new(self.right(solver), self.top) |
142 | } | 142 | } |
143 | 143 | ||
144 | pub fn top_middle(&self, solver: &mut dyn SolverContext) -> Point2D { | ||
145 | Point2D::new(self.horiz_center(solver), self.top) | ||
146 | } | ||
147 | |||
144 | pub fn bottom_left(&self, solver: &mut dyn SolverContext) -> Point2D { | 148 | pub fn bottom_left(&self, solver: &mut dyn SolverContext) -> Point2D { |
145 | Point2D::new(self.left, self.bottom(solver)) | 149 | Point2D::new(self.left, self.bottom(solver)) |
146 | } | 150 | } |
@@ -149,6 +153,18 @@ impl Bounds { | |||
149 | Point2D::new(self.right(solver), self.bottom(solver)) | 153 | Point2D::new(self.right(solver), self.bottom(solver)) |
150 | } | 154 | } |
151 | 155 | ||
156 | pub fn bottom_middle(&self, solver: &mut dyn SolverContext) -> Point2D { | ||
157 | Point2D::new(self.horiz_center(solver), self.bottom(solver)) | ||
158 | } | ||
159 | |||
160 | pub fn middle_left(&self, solver: &mut dyn SolverContext) -> Point2D { | ||
161 | Point2D::new(self.left, self.vert_center(solver)) | ||
162 | } | ||
163 | |||
164 | pub fn middle_right(&self, solver: &mut dyn SolverContext) -> Point2D { | ||
165 | Point2D::new(self.right(solver), self.vert_center(solver)) | ||
166 | } | ||
167 | |||
152 | pub fn center(&self, solver: &mut dyn SolverContext) -> Point2D { | 168 | pub fn center(&self, solver: &mut dyn SolverContext) -> Point2D { |
153 | Point2D::new(self.horiz_center(solver), self.vert_center(solver)) | 169 | Point2D::new(self.horiz_center(solver), self.vert_center(solver)) |
154 | } | 170 | } |