chiark / gitweb /
organise: Apply overlap limit positon to all methods
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Apr 2021 20:23:55 +0000 (21:23 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Apr 2021 20:23:55 +0000 (21:23 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/organise.rs

index f7c7789fd1cccff79c62a66e93d5f11c392bca64..e505082109e35a6bed5a645ebf67638129987277 100644 (file)
@@ -81,13 +81,19 @@ impl Attempt {
   #[throws(CoordinateOverflow)]
   fn br_tile(self, bbox: &Rect) -> Pos {
     let cnr = bbox.br();
-    match self {
-      A::Nonoverlap => (cnr + PosC::both(MARGIN_INSIDE))?,
+    let atleast = (HANG_TILE_SHOW - PosC::both(HANG_INSIDE))?;
+    let want = match self {
+      A::Nonoverlap => return (cnr + PosC::both(MARGIN_INSIDE))?,
       A::Inside     |
       A::Abut       => (bbox.tl() - bbox.tl().map(|v| v/ 2 ))?,
       A::AbutCompr  => (bbox.tl() - bbox.tl().map(|v| v/ 3 ))?,
-      A::Hanging    => (HANG_TILE_SHOW - PosC::both(HANG_INSIDE))?,
-    }
+      A::Hanging    => return atleast,
+    };
+    PosC::from_iter_2(
+      izip!(atleast.coords.iter(), want.coords.iter()).map(
+        |(v, atleast)| Ord::max(*v,*atleast)
+      )
+    )
   }
 }