* claim: #8718 * Browser: the eye sits in a column at each row's right end (#8718) Tree rows draw the visibility eye right-aligned at the row's end, clear of the fold arrow and the radio and of a floating scroll bar; names stop short of it. Preferences > Interface > Eye next to the fold arrow (browser_eye_left) keeps the old position. Rows report their control positions so placement handles and inline rename follow the layout. * Docs: the browser's eye column and browser_eye_left (#8718) * Browser: the eye's tip shows by the eye at the row's end (#8718) * Browser: a gap keeps the fold arrow and the radio apart; the eye clears a floating scroll bar (#8718) The eye's old slot leaves a 10 pt gap instead of 4 pt, so the radio's hit area is 7.5 pt from the fold arrow's and History pattern rows step in from their sketch as far as browser children do. The eye's inset follows the scroll style: only a floating bar laid over the rows takes room. Rows publish indent:<label> where their depth puts them. * Tests: browser depth checks run on the default layout, by indent handles (#8718)
This commit is contained in:
@@ -136,4 +136,36 @@ mod tests {
|
||||
h.frames(3);
|
||||
assert!(crate::scenario::handle_at(&handle).is_some());
|
||||
}
|
||||
|
||||
/// Where a text starts, drawn inside `within`.
|
||||
fn text_left(h: &Harness, text: &str, within: egui::Rect) -> f32 {
|
||||
let mut at = None;
|
||||
for clipped in &h.shapes {
|
||||
crate::test_support::each_shape(&clipped.shape, &mut |s| {
|
||||
if let egui::Shape::Text(t) = s
|
||||
&& t.galley.text() == text
|
||||
&& within.contains(t.pos + t.galley.rect.center().to_vec2())
|
||||
{
|
||||
at = Some(t.pos.x + t.galley.rect.left());
|
||||
}
|
||||
});
|
||||
}
|
||||
at.unwrap_or_else(|| panic!("{text} in {within:?}"))
|
||||
}
|
||||
|
||||
/// #8718: in the vertical History a sketch's pattern rows step in from the sketch's name as far
|
||||
/// as they do in the browser, with the eye at the rows' end.
|
||||
#[test]
|
||||
fn left_history_patterns_step_in_from_their_sketch_like_the_browser() {
|
||||
let (mut h, sketch, rectangular, _) = harness(true);
|
||||
let label = format!("{} {}", crate::i18n::tr_label("Rectangular Pattern"), rectangular.strip_prefix("pat").unwrap_or(&rectangular));
|
||||
h.frame();
|
||||
let browser = crate::scenario::rect_of("browser:card").unwrap();
|
||||
let in_browser = text_left(&h, &label, browser) - text_left(&h, "Patterned Sketch", browser);
|
||||
let sketch_row = crate::scenario::rect_of("history:feature:Patterned Sketch").unwrap();
|
||||
let pattern_y = crate::scenario::handle_at(&format!("timeline:sketch-pattern:{sketch}:{rectangular}")).unwrap().y;
|
||||
let pattern_row = egui::Rect::from_x_y_ranges(sketch_row.x_range(), pattern_y - 8.0..=pattern_y + 8.0);
|
||||
let in_history = text_left(&h, &label, pattern_row) - text_left(&h, "Patterned Sketch", sketch_row);
|
||||
assert!((in_history - in_browser).abs() <= 2.0, "History steps in {in_history}, the browser {in_browser}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user