Hex field in the colour picker owns Enter; items-virtualisation accepts rows that all lie in the room; drop DIAG prints

This commit is contained in:
Martin Ball committed 2026-11-18 18:43:43 +00:00
1 parent 73df6e7bec
commit 3155a1d380
4 files changed
+9 -20

No files matched your search

+3 -2
View File
@@ -124,10 +124,11 @@ impl<'a> Body<'a> {
}
}
/// The hex field, at `sizing` when given. The Full layout's first show focuses it.
/// The hex field, at `sizing` when given. The Full layout's first show focuses it. Enter in it
/// commits the typed digits and does not reach the dialog's OK, as in the production Colors dialog.
pub(super) fn hex_field(&self, ui: &mut Ui, pass: &Pass<'a>, words: &ColorPickerWords, sizing: Option<Sizing>, got: &mut Collected) {
let field =
TextField::hex(words.hex.as_str().to_owned(), Bind::given(pass.shows(pass.shown.color.to_rgba()))).empty(pass.shown.color.to_rgba());
TextField::hex(words.hex.as_str().to_owned(), Bind::given(pass.shows(pass.shown.color.to_rgba()))).empty(pass.shown.color.to_rgba()).submits();
let edit = match sizing {
Some(sizing) => field.sizing(sizing),
None => field,
-8
View File
@@ -659,14 +659,6 @@ impl StackDialog for ColorPickerDialog {
}
});
self.current = held.same().copied();
if self.layout == ColorPickerDialogLayout::Tabbed {
eprintln!(
"DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: held same={} picked={:?} closed={:?}",
self.current.is_some(),
shown.output.picked,
shown.output.closed
);
}
let (picked, closed) = (shown.output.picked, shown.output.closed);
let ok = (picked == Some(0) || closed == Some(CloseReason::Enter)) && self.current.is_some();
-10
View File
@@ -210,17 +210,7 @@ fn the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page() {
assert_eq!(dialog_field(&dialogs, "model"), Some(serde_json::json!(RgbModel.id())), "the field names the model shown");
assert!(fixture.by_label("Red").is_some(), "and the compact rows show that model's channels");
eprintln!(
"DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: before typing current={:?} open={}",
dialog_color(&dialogs),
dialogs.borrow().get::<ColorPickerDialog>().is_some()
);
type_into(&mut fixture, "Hex color", "336699");
eprintln!(
"DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: after typing current={:?} open={}",
dialog_color(&dialogs),
dialogs.borrow().get::<ColorPickerDialog>().is_some()
);
assert_eq!(dialog_color(&dialogs).as_deref(), Some("#336699"), "a hex typed on Custom is the colour");
let set = dialogs.borrow_mut().set_json_field(&ctx, id, "tab", serde_json::json!("standard"));
@@ -334,6 +334,12 @@ pub(super) fn long_collection_builds_rows_within_the_room_only(subject: &Subject
if ((size.div_ceil(across) - 1) as f32) * row <= room.y {
continue;
}
// Rows that overlap or differ in length (a honeycomb stacks them at three quarters of a cell, and its rows
// grow and shrink) make the estimate above too long. When every item is built and lies within the room, no
// row is out of view, so nothing was left to skip.
if shown.iter().all(|built| built.rect.max.y <= container.rect.max.y + 0.5) {
continue;
}
if shown.len() >= size {
return Err(format!("{}: all {size} rows are built though the room holds about {}", story.name, (room.y / row) as usize + 1));
}