diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs index 1d1b5452b..6ad1973c9 100644 --- a/crates/doc/src/lib.rs +++ b/crates/doc/src/lib.rs @@ -1373,7 +1373,8 @@ impl Document { /// inside or on its left or top edge, else the first (the last) that holds it by /// [`artboard_holds`]: on its right or bottom edge, or within a millionth of a point outside an /// edge. On an edge two artboards share, the artboard to the right of it or below it holds the - /// point. + /// point, except at the end of the edge that lies on that artboard's bottom or right edge, such + /// as the point where both artboards' bottom edges meet; there the first (the last) holds it. pub fn artboard_holding(&self, p: Point, topmost: bool) -> Option { let pick = |on: &dyn Fn(Rect) -> bool| { let on = |i: &usize| self.artboards.get(*i).is_some_and(|a| on(a.rect)); @@ -1881,9 +1882,13 @@ mod tests { assert_eq!(held(&d, 200.001, 50.0), (None, None)); assert_eq!(held(&d, 50.0, 200.001), (None, None)); // On an edge two artboards share, the artboard to the right of it or below it holds the - // point, in either list order. + // point, in either list order, except at the end of the edge that lies on that artboard's + // bottom or right edge. assert_eq!(held(&d, 100.0, 50.0), (Some(1), Some(1))); assert_eq!(held(&d, 50.0, 100.0), (Some(2), Some(2))); + // The bottom edges of artboards 0 and 1 meet at (100, 100), which is also artboard 2's top + // right corner: the first holds the point, or the last when `topmost`. + assert_eq!(held(&d, 100.0, 100.0), (Some(2), Some(0)), "shared corner"); d.artboards.swap(0, 1); assert_eq!(held(&d, 100.0, 50.0), (Some(0), Some(0))); // Where two artboards overlap, the topmost holds the point, or the first one when not diff --git a/crates/engine/src/tests_newdoc.rs b/crates/engine/src/tests_newdoc.rs index 82ca009d6..bada2ebba 100644 --- a/crates/engine/src/tests_newdoc.rs +++ b/crates/engine/src/tests_newdoc.rs @@ -330,8 +330,8 @@ fn rearrange_lays_out_by_layout_and_order() { } } -/// Art centered on an artboard's right or bottom edge moves with that artboard, and art on the edge -/// two artboards share moves with the artboard to the right of it. +/// Art centered on an artboard's right or bottom edge moves with that artboard, and art centered on +/// the edge two artboards share, away from its ends, moves with the artboard to the right of it. #[test] fn rearrange_moves_art_centered_on_an_artboard_edge() { let mut s = new_doc(json!({"width": 100, "height": 50, "artboards": 2, "artboardLayout": {"layout": "row", "spacing": 0}})); diff --git a/crates/engine/src/tests_textimport.rs b/crates/engine/src/tests_textimport.rs index 780983750..244b1d3d5 100644 --- a/crates/engine/src/tests_textimport.rs +++ b/crates/engine/src/tests_textimport.rs @@ -52,8 +52,8 @@ fn crlf_with_returns_removed_places_one_paragraph_per_block_as_area_type() { } /// Placed at a point on an artboard's right or bottom edge, the frame takes that artboard's size less -/// a 36 pt margin on each side; on the edge two artboards share, it takes the size of the artboard to -/// the right of it. +/// a 36 pt margin on each side; on the edge two artboards share, away from its ends, it takes the +/// size of the artboard to the right of it. #[test] fn type_placed_on_an_artboard_edge_takes_that_artboards_frame() { let mut s = session(); diff --git a/crates/svg/tests/css_rules.rs b/crates/svg/tests/css_rules.rs index 5ac99c596..036f1bd91 100644 --- a/crates/svg/tests/css_rules.rs +++ b/crates/svg/tests/css_rules.rs @@ -71,7 +71,8 @@ fn rectangle_gives_background_border_and_radius() { } /// An object centered on an artboard's right or bottom edge is positioned from that artboard's -/// top-left corner; on the edge two artboards share, from the one to the right of it. +/// top-left corner; on the edge two artboards share, away from its ends, from the one to the right +/// of it. #[test] fn position_is_from_the_artboard_whose_edge_holds_the_center() { let mut d = doc();