Keep scenario authoring visible and restore exact caller context

This commit is contained in:
2026-09-10 12:03:17 -07:00
parent 81668f94ed
commit 3978bbe23c
7 changed files with 1720 additions and 511 deletions
+10 -9
View File
@@ -29,12 +29,12 @@ mod scenario_scroll {
use iced::advanced::{Clipboard, Layout, Shell, Widget, layout, renderer, widget};
use iced::{Length, Vector, overlay};
pub(super) fn observe<'a>(
pub(super) fn observe<'a, R: renderer::Renderer + 'a>(
context: scenario::Context,
area: scenario::ScrollArea,
restore: Option<scenario::ScrollRestore>,
content: impl Into<Element<'a, Message>>,
) -> Element<'a, Message> {
content: impl Into<Element<'a, Message, Theme, R>>,
) -> Element<'a, Message, Theme, R> {
Element::new(Observer {
content: content.into(),
context,
@@ -919,20 +919,21 @@ pub fn view(app: &App) -> Element<'_, Message> {
return out.push(label("Start with a Process, Scenario or State machine using Create element. Add occurrences or regions inside it to describe behavior.")).padding(24).into();
};
let e = &p.elements[&selected.id];
let compact_process = matches!(e.kind(), Kind::Process | Kind::FunctionalChain);
let compact_canvas = matches!(
e.kind(),
Kind::Process | Kind::FunctionalChain | Kind::Scenario
);
if e.kind() == Kind::StateMachine {
out = column![text("States & modes").size(20)].spacing(8);
} else if compact_process {
// The process canvas owns its compact header and remaining-height layout.
} else if compact_canvas {
// The process/scenario canvas owns its compact remaining-height layout.
out = column![].spacing(6);
} else if matches!(e.kind(), Kind::Process | Kind::FunctionalChain) {
out = column![text("Processes & functional chains").size(20)].spacing(8);
}
out = out.push(
pick_list(choices, Some(selected), Message::BehaviorOwner)
.width(Fill)
.text_size(13)
.padding(if compact_process { 6 } else { 10 }),
.padding(if compact_canvas { 6 } else { 10 }),
);
if matches!(e.kind(), Kind::Process | Kind::FunctionalChain) {
return topology::view(app, e.id, out);