Locate State picker from measured bounds in mounted Escape regression
This commit is contained in:
@@ -10,6 +10,11 @@ async fn press_escape(mounted: &mut Mounted, app: &mut App) -> Vec<Message> {
|
|||||||
std::slice::from_ref(&input),
|
std::slice::from_ref(&input),
|
||||||
mouse::Cursor::Unavailable,
|
mouse::Cursor::Unavailable,
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
statuses,
|
||||||
|
[iced::event::Status::Captured],
|
||||||
|
"the mounted picker must capture Escape before App subscriptions"
|
||||||
|
);
|
||||||
crate::app::escape::tests::subscriptions(app, input, statuses[0], &mut messages);
|
crate::app::escape::tests::subscriptions(app, input, statuses[0], &mut messages);
|
||||||
for message in messages.iter().cloned() {
|
for message in messages.iter().cloned() {
|
||||||
let task = app.update(message);
|
let task = app.update(message);
|
||||||
@@ -41,17 +46,11 @@ async fn mounted_state_missing_picker_escape_preserves_exact_document_then_reope
|
|||||||
send(&mut app, Message::BehaviorDiagram(choice));
|
send(&mut app, Message::BehaviorDiagram(choice));
|
||||||
let mut mounted = Mounted::new(&mut app).await;
|
let mut mounted = Mounted::new(&mut app).await;
|
||||||
assert_eq!(state_edit::unplaced(app.project(), diagram), vec![f.b]);
|
assert_eq!(state_edit::unplaced(app.project(), diagram), vec![f.b]);
|
||||||
let focus_id = iced::advanced::widget::Id::from("diagram-keyboard-owner");
|
// Locate the stable picker slot itself: selection controls may sit between
|
||||||
let (_, canvas, _) = mounted
|
// it and the canvas. The single menu option opens below this slot.
|
||||||
.geometry(&app)
|
let bounds = mounted.geometry(&app).bounds("state-missing-picker");
|
||||||
.focused
|
let picker = bounds.center();
|
||||||
.into_iter()
|
let option = iced::Point::new(picker.x, bounds.y + bounds.height * 1.5);
|
||||||
.find(|(id, _, _)| id.as_ref() == Some(&focus_id))
|
|
||||||
.unwrap();
|
|
||||||
// The existing picker is immediately above the measured canvas, separated
|
|
||||||
// by 8px. Its 12px text and 8px padding give a 31.6px row.
|
|
||||||
let picker = iced::Point::new(canvas.center_x(), canvas.y - 24.);
|
|
||||||
let option = iced::Point::new(picker.x, canvas.y + 8.);
|
|
||||||
let before = app.document.snapshot();
|
let before = app.document.snapshot();
|
||||||
let original = app.project().clone();
|
let original = app.project().clone();
|
||||||
let source = app.document.bundle().clone();
|
let source = app.document.bundle().clone();
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ pub fn view<'a>(app: &'a App, machine: Id, mut out: Column<'a, Message>) -> Elem
|
|||||||
.into();
|
.into();
|
||||||
out = out.push(
|
out = out.push(
|
||||||
column![
|
column![
|
||||||
missing_controls,
|
container(missing_controls).id("state-missing-picker"),
|
||||||
selection_controls(app),
|
selection_controls(app),
|
||||||
crate::diagram::focus::wrap(
|
crate::diagram::focus::wrap(
|
||||||
canvas.map(event),
|
canvas.map(event),
|
||||||
|
|||||||
Reference in New Issue
Block a user