Compare commits

..
374 changed files with 5610 additions and 71767 deletions
+167 -11
View File
@@ -53,6 +53,8 @@ pub struct RoutedEdge {
pub struct EdgeLabelGeometry {
/// Empty for edge kinds without a permanently displayed label.
pub text: String,
/// Dedicated State-canvas two-block presentation; raw summary stays in text.
pub state_layout: Option<StateLabelLayout>,
/// Effective arc-length fraction, including an automatic collision-avoidance
/// choice. Use this when the first label drag becomes authored metadata.
pub fraction: f32,
@@ -61,6 +63,108 @@ pub struct EdgeLabelGeometry {
pub bounds: RoutingBounds,
}
/// Derived hard-line layout for the dedicated State projection, never persisted.
/// Excerpts are chosen on raw text before display-only separator/tab expansion.
#[derive(Debug, Clone, PartialEq)]
pub struct StateLabelLayout {
pub title_lines: Vec<String>,
pub summary_lines: Vec<String>,
size: Size,
}
impl StateLabelLayout {
pub const FONT_SIZE: f32 = 10.0;
pub const LINE_HEIGHT: f32 = 12.0;
pub const HORIZONTAL_PADDING: f32 = 5.0;
pub const MIN_HEIGHT: f32 = 24.0;
/// `summary` is the existing raw, globally shortened routing summary.
/// Measurement receives each final display line at FONT_SIZE, without breaks.
/// Invalid measurements fall back to the deterministic approximate width.
pub fn new(title: &str, summary: &str, measure: &dyn Fn(&str) -> f32) -> Self {
let budget = (7 * summary.chars().count() + 6) / 6;
let title = if title.chars().count() > budget {
title
.chars()
.take(budget.saturating_sub(1))
.chain(std::iter::once('…'))
.collect()
} else {
title.to_owned()
};
let title_lines = state_display_lines(&title);
let summary_lines = state_display_lines(summary);
let width = title_lines
.iter()
.chain(&summary_lines)
.map(|line| {
let width = measure(line);
if width.is_finite() && width >= 0.0 {
width
} else {
approximate_state_line_width(line)
}
})
.fold(0.0_f32, f32::max);
let size = Size {
width: width + 2.0 * Self::HORIZONTAL_PADDING,
height: (Self::LINE_HEIGHT * (title_lines.len() + summary_lines.len()) as f32)
.max(Self::MIN_HEIGHT),
};
Self {
title_lines,
summary_lines,
size,
}
}
pub fn size(&self) -> Size {
self.size
}
/// Local origin relative to EdgeLabelGeometry.bounds.position.
pub fn title_line_position(&self, index: usize) -> Position {
Position {
x: Self::HORIZONTAL_PADDING,
y: index as f32 * Self::LINE_HEIGHT,
}
}
/// Local origin relative to EdgeLabelGeometry.bounds.position.
pub fn summary_line_position(&self, index: usize) -> Position {
Position {
x: Self::HORIZONTAL_PADDING,
y: (self.title_lines.len() + index) as f32 * Self::LINE_HEIGHT,
}
}
}
fn state_display_lines(raw: &str) -> Vec<String> {
if raw.is_empty() {
return Vec::new();
}
let mut lines = vec![String::new()];
let mut chars = raw.chars().peekable();
while let Some(ch) = chars.next() {
match ch {
'\r' => {
if chars.peek() == Some(&'\n') {
chars.next();
}
lines.push(String::new());
}
'\n' | '\u{85}' | '\u{2028}' | '\u{2029}' => lines.push(String::new()),
'\t' => lines.last_mut().unwrap().push_str(" "),
_ => lines.last_mut().unwrap().push(ch),
}
}
lines
}
fn approximate_state_line_width(line: &str) -> f32 {
line.chars().count() as f32 * 7.0
}
/// Derived labels and navigation markers for the two named association ends.
/// Canvas and SVG consume these same coordinates; no extra diagram state exists.
#[derive(Debug, Clone, PartialEq)]
@@ -161,6 +265,7 @@ pub fn association_end_geometry(
source_end,
label: EdgeLabelGeometry {
text,
state_layout: None,
fraction: if source_end { 0.0 } else { 1.0 },
anchor: tip,
center,
@@ -436,7 +541,24 @@ fn ancestors(id: Id, nodes: &BTreeMap<Id, &ProjectedNode>, out: &mut BTreeSet<Id
/// Search caps are presentation limits, reported on the affected edge, never
/// semantic errors or a reason to discard an authored point.
pub fn route_diagram(project: &Project, diagram: &Diagram, view: &ProjectedView) -> RoutedView {
route_diagram_impl(project, diagram, view, None)
route_diagram_with_state_label_measurement(
project,
diagram,
view,
&approximate_state_line_width,
)
}
/// Route with frontend line measurements for dedicated State labels before collision placement.
/// The legacy entrypoint uses a deterministic 7-units-per-scalar approximation,
/// not a promise of shaped glyph containment. All other label kinds are unchanged.
pub fn route_diagram_with_state_label_measurement(
project: &Project,
diagram: &Diagram,
view: &ProjectedView,
measure: &dyn Fn(&str) -> f32,
) -> RoutedView {
route_diagram_impl(project, diagram, view, None, measure)
}
/// Transient route/label editing with unchanged projected nodes and ports.
@@ -451,7 +573,26 @@ pub fn route_edge_preview(
baseline: &RoutedView,
edge: Id,
) -> RoutedView {
route_diagram_impl(project, diagram, view, Some((baseline, edge)))
route_edge_preview_with_state_label_measurement(
project,
diagram,
view,
baseline,
edge,
&approximate_state_line_width,
)
}
/// Preview counterpart using the same State text measurer as the settled scene.
pub fn route_edge_preview_with_state_label_measurement(
project: &Project,
diagram: &Diagram,
view: &ProjectedView,
baseline: &RoutedView,
edge: Id,
measure: &dyn Fn(&str) -> f32,
) -> RoutedView {
route_diagram_impl(project, diagram, view, Some((baseline, edge)), measure)
}
fn route_diagram_impl(
@@ -459,6 +600,7 @@ fn route_diagram_impl(
diagram: &Diagram,
view: &ProjectedView,
preview: Option<(&RoutedView, Id)>,
measure: &dyn Fn(&str) -> f32,
) -> RoutedView {
let nodes: BTreeMap<_, _> = view.nodes.iter().map(|n| (n.id, n)).collect();
let rectangles: Vec<_> = nodes.values().map(|n| Rect::node(n)).collect();
@@ -639,13 +781,14 @@ fn route_diagram_impl(
.flatten();
routed.label = make_label(
project,
diagram.view_options.exchange_labels,
diagram,
edge.id,
&routed.points,
authored_label,
&obstacles,
&previous_labels,
&previous,
measure,
);
}
if !routed.label.text.is_empty() {
@@ -1345,6 +1488,7 @@ fn label_text(project: &Project, edge: Id) -> String {
fn empty_label() -> EdgeLabelGeometry {
EdgeLabelGeometry {
text: String::new(),
state_layout: None,
fraction: 0.5,
anchor: pos(0.0, 0.0),
center: pos(0.0, 0.0),
@@ -1362,14 +1506,16 @@ fn empty_label() -> EdgeLabelGeometry {
#[allow(clippy::too_many_arguments)]
fn make_label(
project: &Project,
labels: crate::view_options::ExchangeLabels,
diagram: &Diagram,
edge: Id,
points: &[Position],
authored: Option<&crate::EdgeLabel>,
obstacles: &[Rect],
previous_labels: &[RoutingBounds],
strokes: &[Segment],
measure: &dyn Fn(&str) -> f32,
) -> EdgeLabelGeometry {
let labels = diagram.view_options.exchange_labels;
let text = if labels != crate::view_options::ExchangeLabels::Name
&& project
.relations
@@ -1385,14 +1531,23 @@ fn make_label(
} else {
label_text(project, edge)
};
let size = Size {
width: if text.is_empty() {
0.0
} else {
text.chars().count() as f32 * 7.0 + 16.0
let state_layout = (diagram.projection.state_machine().is_some()
&& project
.relations
.get(&edge)
.is_some_and(|r| r.kind() == RelationKind::StateTransition))
.then(|| StateLabelLayout::new(project.named(edge), &text, measure));
let size = state_layout.as_ref().map_or_else(
|| Size {
width: if text.is_empty() {
0.0
} else {
text.chars().count() as f32 * 7.0 + 16.0
},
height: if text.is_empty() { 0.0 } else { 24.0 },
},
height: if text.is_empty() { 0.0 } else { 24.0 },
};
StateLabelLayout::size,
);
let mut offset = authored.map_or(pos(0.0, -18.0), |l| l.offset);
let geometry = |fraction, offset: Position| {
let anchor = point_along_polyline(points, fraction).unwrap_or(pos(0.0, 0.0));
@@ -1474,6 +1629,7 @@ fn make_label(
let (anchor, center, bounds) = geometry(fraction, offset);
EdgeLabelGeometry {
text,
state_layout,
fraction,
anchor,
center,
+145
View File
@@ -0,0 +1,145 @@
use oa_core::{projection::project_diagram, routing::*, *};
fn fixture() -> (Project, Id, Id) {
let mut project = language::parse(include_str!(
"../../../harness/experiments/edge-attachments-20260922/native-fixture.arcadia"
))
.unwrap();
let edge = Id::parse_str("ea202922-0033-4000-8000-000000000041").unwrap();
let diagram = Id::parse_str("ea202922-0033-4000-8000-000000000200").unwrap();
let relation = project.relations.get_mut(&edge).unwrap();
relation.name = "Ready\nfor review".into();
if let RelationBody::StateTransition { guard, .. } = &mut relation.body {
*guard = "request_ready".into();
}
(project, diagram, edge)
}
#[test]
fn state_two_block_layout_separates_lines_and_keeps_authored_geometry_and_project() {
let (project, diagram, edge) = fixture();
let before = project.clone();
let diagram = &project.diagrams[&diagram];
let view = project_diagram(&project, diagram);
let routed = route_diagram(&project, diagram, &view);
let edge_geometry = &routed.edges[&edge];
let label = &edge_geometry.label;
let layout = label.state_layout.as_ref().unwrap();
assert_eq!(layout.title_lines, ["Ready", "for review"]);
assert_eq!(
layout.summary_lines,
["External · Completion [request_ready]"]
);
assert_eq!(label.text, "External · Completion [request_ready]");
assert_eq!(layout.title_line_position(1), Position { x: 5., y: 12. });
assert_eq!(layout.summary_line_position(0), Position { x: 5., y: 24. });
assert_eq!(
label.bounds.size,
Size {
width: 269.,
height: 36.
}
);
let authored = diagram
.routes
.iter()
.find(|r| r.edge == edge)
.unwrap()
.label
.as_ref()
.unwrap();
assert_eq!(label.fraction, authored.fraction);
let anchor = point_along_polyline(&edge_geometry.points, authored.fraction).unwrap();
assert_eq!(label.anchor, anchor);
assert_eq!(
label.center,
Position {
x: anchor.x + authored.offset.x,
y: anchor.y + authored.offset.y
}
);
assert_eq!(project, before);
}
#[test]
fn state_display_breaks_tabs_and_blank_lines_are_single_sourced() {
let summary = "A sufficiently long unchanged summary";
for title in [
"Ready\nfor review",
"Ready\r\nfor review",
"Ready\rfor review",
"Ready\u{85}for review",
"Ready\u{2028}for review",
"Ready\u{2029}for review",
] {
let layout = StateLabelLayout::new(title, summary, &|s| s.chars().count() as f32);
assert_eq!(layout.title_lines, ["Ready", "for review"]);
assert_eq!(layout.summary_line_position(0).y, 24.);
}
let layout = StateLabelLayout::new("Ready\n\nfor\treview\n", summary, &|s| {
s.chars().count() as f32
});
assert_eq!(layout.title_lines, ["Ready", "", "for review", ""]);
assert_eq!(layout.summary_line_position(0).y, 48.);
assert_eq!(layout.size().height, 60.);
let empty = StateLabelLayout::new("", "", &|_| 0.);
assert!(empty.title_lines.is_empty() && empty.summary_lines.is_empty());
assert_eq!(empty.size().height, 24.);
}
#[test]
fn state_summary_raw_prefix_and_title_budget_survive_display_normalization() {
let (mut project, diagram, edge) = fixture();
let relation = project.relations.get_mut(&edge).unwrap();
relation.name = "T".repeat(80);
if let RelationBody::StateTransition { guard, .. } = &mut relation.body {
*guard = format!("first\r\n{}", "guard".repeat(20));
}
let full = state_transition_summary(&project, &project.relations[&edge]);
let raw: String = full.chars().take(47).chain(std::iter::once('…')).collect();
let d = &project.diagrams[&diagram];
let routed = route_diagram(&project, d, &project_diagram(&project, d));
let label = &routed.edges[&edge].label;
assert_eq!(label.text, raw);
assert!(label.text.contains("\r\n"));
let layout = label.state_layout.as_ref().unwrap();
assert_eq!(layout.title_lines, [format!("{}…", "T".repeat(56))]);
assert_eq!(
layout.summary_lines,
raw.replace("\r\n", "\n")
.split('\n')
.map(str::to_owned)
.collect::<Vec<_>>()
);
assert_eq!(label.text.chars().count(), 48);
}
#[test]
fn supplied_measurement_controls_settled_and_preview_state_bounds_only() {
let (project, diagram, edge) = fixture();
let d = &project.diagrams[&diagram];
let view = project_diagram(&project, d);
let baseline = route_diagram(&project, d, &view);
let wide = |_: &str| 400.;
let measured = route_diagram_with_state_label_measurement(&project, d, &view, &wide);
let label = &measured.edges[&edge].label;
assert_eq!(
label.bounds.size,
Size {
width: 410.,
height: 36.
}
);
assert_eq!(label.center, baseline.edges[&edge].label.center);
assert_eq!(measured.edges[&edge].points, baseline.edges[&edge].points);
let preview =
route_edge_preview_with_state_label_measurement(&project, d, &view, &measured, edge, &wide);
assert_eq!(preview.edges[&edge].label, *label);
let mut ordinary = d.clone();
ordinary.projection = ProjectionKind::Allocation;
let ordinary_measured =
route_diagram_with_state_label_measurement(&project, &ordinary, &view, &wide);
let ordinary_default = route_diagram(&project, &ordinary, &view);
assert!(ordinary_measured.edges[&edge].label.state_layout.is_none());
assert_eq!(ordinary_measured, ordinary_default);
}
+3 -105
View File
@@ -6,8 +6,6 @@ mod architecture_authoring_tests;
mod behavior_removal_tests;
mod checkpoints;
#[cfg(test)]
mod context_help_tests;
#[cfg(test)]
mod diagram_focus_tests;
pub(crate) mod diagram_removal;
#[cfg(test)]
@@ -378,10 +376,6 @@ pub enum Message {
ExactStrings(bool),
Page(Page),
Guide(crate::guide::Event),
ContextHelp(crate::guide::Topic),
CloseContextHelp,
ContextHelpScroll(crate::guide::ContextScroll),
Help,
Traceability(crate::views::traceability::Event),
ReviewLayerTraces,
Behavior(crate::behavior::Event),
@@ -527,7 +521,6 @@ pub struct App {
/// Home resumes this page; explicit Architecture navigation remains separate.
last_workspace_page: Page,
pub guide: crate::guide::State,
pub context_help: bool,
pub traceability: crate::views::traceability::State,
pub behavior: crate::behavior::State,
pub data_state: crate::data_view::State,
@@ -650,7 +643,6 @@ impl App {
page: Page::Diagram,
last_workspace_page: Page::Diagram,
guide: crate::guide::State::default(),
context_help: false,
traceability: Default::default(),
behavior: Default::default(),
data_state: Default::default(),
@@ -1302,11 +1294,6 @@ impl App {
iced::time::every(std::time::Duration::from_secs(10)).map(|_| Message::CheckpointTick),
window::close_requests().map(|id| Message::Request(Pending::Close(id))),
window::resize_events().map(|(_, size)| Message::WindowResized(size)),
if self.context_help {
iced::event::listen_with(crate::guide::context_scroll_key)
} else {
Subscription::none()
},
iced::event::listen_with(|event, _, _| {
matches!(
event,
@@ -1333,7 +1320,7 @@ impl App {
return Some(Message::Escape);
}
if key == keyboard::Key::Named(keyboard::key::Named::F1) {
return Some(Message::Help);
return Some(Message::Page(Page::Guide));
}
if key == keyboard::Key::Named(keyboard::key::Named::F3) {
return Some(Message::SourceNavigation(
@@ -1361,55 +1348,6 @@ impl App {
])
}
pub fn update(&mut self, message: Message) -> Task<Message> {
if let Message::ContextHelpScroll(scroll) = message {
return if self.context_help {
crate::guide::context_scroll_task(scroll)
} else {
Task::none()
};
}
// Help owns user input before any canvas/reference fast path can act.
// Passive results may finish; they retain their normal lifetime checks.
if self.context_help
&& !matches!(
message,
Message::Guide(_)
| Message::CloseContextHelp
| Message::Escape
| Message::Request(Pending::Close(_))
| Message::CheckpointWritten(..)
| Message::CheckpointTick
| Message::CheckpointLoaded(..)
| Message::WindowResized(_)
| Message::CanvasResized(_)
| Message::DiagramRevealViewport(..)
| Message::SourceViewport(_)
| Message::Lint(_)
| Message::Linted(..)
| Message::Saved(_)
| Message::Hosted(crate::hosted::Event::Completed(..))
| Message::Loaded(_)
| Message::IncludesLoaded(..)
| Message::SavePath(_)
| Message::SourceRecovered(_)
| Message::Exported(_)
| Message::SourceSymbolsReady(_)
| Message::SourceRenameReady(_)
| Message::DiagramUsagesReady(_)
| Message::ScenarioCanvas(
behavior::scenario::CanvasEvent::Scrolled(..)
| behavior::scenario::CanvasEvent::Restored(..)
| behavior::scenario::CanvasEvent::Viewport(..)
)
| Message::TopologyCanvas(
behavior::topology::CanvasEvent::Scrolled(..)
| behavior::topology::CanvasEvent::Viewport(..)
)
| Message::StateDiagram(behavior::state_edit::Event::Viewport(..))
)
{
return Task::none();
}
let preview_read_only = self.process_preview_primary().is_some();
let selection_boundary = self.multiselect_boundary();
// Reject delayed gestures before they can retire newer input ownership.
@@ -1962,10 +1900,6 @@ impl App {
message,
Message::Escape | Message::Request(Pending::Close(_))
) {
if self.context_help {
self.context_help = false;
return Task::none();
}
if self.hosted.visible {
self.hosted.visible = false;
return Task::none();
@@ -2157,7 +2091,6 @@ impl App {
}
pub(crate) fn scenario_focus_owner(&self) -> Option<crate::behavior::scenario::focus::Stamp> {
if self.busy
|| self.context_help
|| self.hosted.visible
|| self.workflow.is_some()
|| self.architecture.is_some()
@@ -2854,35 +2787,6 @@ impl App {
);
}
}
Message::ContextHelp(topic) => {
self.guide.update(crate::guide::Event::Topic(topic));
self.context_help = true;
return iced::widget::operation::snap_to(
crate::guide::ARTICLE_SCROLL_ID,
iced::widget::scrollable::RelativeOffset::START,
);
}
Message::CloseContextHelp => {
self.context_help = false;
}
Message::ContextHelpScroll(_) => {}
Message::Help => {
let topic = match self.page {
Page::Diagram => Some(crate::guide::Topic::Nesting),
Page::Behavior => self.behavior.active_owner.and_then(|id| {
self.project()
.elements
.get(&id)
.map(|element| match element.kind() {
Kind::StateMachine => crate::guide::Topic::States,
Kind::Scenario => crate::guide::Topic::Scenarios,
_ => crate::guide::Topic::Chains,
})
}),
_ => None,
};
return self.update(topic.map_or(Message::Page(Page::Guide), Message::ContextHelp));
}
Message::ExactStrings(enabled) => {
if let Some(d) = &mut self.draft {
match d.set_exact(enabled) {
@@ -5337,7 +5241,7 @@ impl App {
if route.waypoints.len() >= 128 {
return;
}
let geometry = oa_core::routing::route_diagram(self.project(), diagram, &view);
let geometry = crate::state_label::route_diagram(self.project(), diagram, &view);
let edge = &geometry.edges[&self.selected];
// Mandatory port leads are inside the card's clearance. A pin
// starts beyond those leads, including coincident short stubs.
@@ -5417,17 +5321,11 @@ impl App {
self.pan = iced::Vector::new(30., 30.);
return;
}
let mut geometry = oa_core::routing::route_diagram(
let geometry = crate::state_label::route_diagram(
self.project(),
&self.project().diagrams[&self.active_diagram.unwrap()],
&view,
);
crate::diagram::apply_label_experiment(
self.project(),
&self.project().diagrams[&self.active_diagram.unwrap()],
&view,
&mut geometry,
);
let left = geometry.bounds.position.x;
let top = geometry.bounds.position.y;
let right = left + geometry.bounds.size.width;
+4 -10
View File
@@ -16,7 +16,6 @@ use std::{
pub const FINISH_EDIT: &str =
"Finish or cancel the current edit before selecting or moving elements.";
const ARRANGE_ARMED: &str = "Arrange next drag armed · presentation only · Esc cancels";
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Stamp {
@@ -636,7 +635,6 @@ impl App {
}
pub(crate) fn allocation_input_owner(&self) -> bool {
self.page == Page::Diagram
&& !self.context_help
&& self
.active_diagram
.and_then(|id| self.project().diagrams.get(&id))
@@ -701,12 +699,7 @@ impl App {
| Message::DiagramUsagesReady(_)
| Message::DiagramRevealViewport(..)
) {
let clear_armed_status =
self.allocation_drag.arrange_next && self.status == ARRANGE_ARMED;
self.allocation_drag.retire();
if clear_armed_status {
self.status = "Arrange cancelled".into();
}
}
}
pub(super) fn allocation_boundary(&self) -> impl PartialEq + use<> {
@@ -848,7 +841,8 @@ impl App {
self.allocation_drag.retire();
if self.allocation_drag_clean() {
self.allocation_drag.arrange_next = true;
self.status = ARRANGE_ARMED.into();
self.status =
"Arrange next drag armed · presentation only · Esc cancels".into();
} else {
self.status = FINISH_EDIT.into();
}
@@ -926,7 +920,7 @@ impl App {
};
let frozen = affected.map(|affected| {
let d = &self.project().diagrams[&diagram];
let routed = routing::route_diagram(self.project(), d, &view);
let routed = crate::state_label::route_diagram(self.project(), d, &view);
Arc::new(Frozen::capture(
self.project(),
d,
@@ -1072,7 +1066,7 @@ impl App {
self.reconcile_multiselect();
}
} else {
let routed = Arc::new(routing::route_diagram(candidate.project(), placed.diagram(), placed.view()));
let routed = Arc::new(crate::state_label::route_diagram(candidate.project(), placed.diagram(), placed.view()));
preview = Some(Arc::new(Preview { token, candidate, placement: placed.into_preview(), routed }));
}
Ok(label)
@@ -190,7 +190,6 @@ async fn actual_keyboard_arrange_shortcut_consumes_once_escape_cancels_and_dirty
)
.await;
assert!(!f.app.allocation_drag.arrange_next);
assert_eq!(f.app.status, "Arrange cancelled");
mounted
.batch(
&mut f.app,
@@ -1,723 +0,0 @@
//! Context help is a reading overlay, not a workspace navigation or edit.
use super::*;
use crate::diagram_usage::Target;
use crate::guide::Topic;
fn send(app: &mut App, message: Message) {
// Do not poll I/O tasks: exercise the same admission boundary as the UI.
let _ = app.update(message);
}
fn architecture() -> (App, Id, Id, Id) {
let mut project = Project::empty();
let a = project
.add_element(Kind::Function, Layer::Sa, "Send", None)
.unwrap();
let b = project
.add_element(Kind::Function, Layer::Sa, "Receive", None)
.unwrap();
let diagram = project.ensure_diagram(Layer::Sa);
project.diagrams.get_mut(&diagram).unwrap().projection = ProjectionKind::FunctionalDataflow;
let a = project.place(diagram, a, Position { x: 20., y: 20. });
let b = project.place(diagram, b, Position { x: 400., y: 20. });
let mut app = App::with_project(project);
app.page = Page::Diagram;
app.layer = Layer::Sa;
app.active_diagram = Some(diagram);
app.selected = diagram;
app.refresh_draft();
app.reconcile_multiselect();
(app, diagram, a, b)
}
fn choose(app: &mut App, placement: Id, choice: multiselect::Choice) {
let context = app.multiselect_context().unwrap();
send(
app,
Message::DiagramSelection(multiselect::Event::Choose(
context,
Target::Placement(placement),
choice,
)),
);
}
#[test]
fn context_help_preserves_group_property_draft_camera_and_model() {
let (mut app, diagram, a, b) = architecture();
choose(&mut app, a, multiselect::Choice::Replace);
choose(&mut app, b, multiselect::Choice::Toggle);
send(
&mut app,
Message::Field("/name".into(), "Uncommitted name 雨".into()),
);
assert!(app.draft_dirty());
app.zoom = 0.73;
app.pan = iced::Vector::new(31., -57.);
let selected = app.selected;
let selection = app.multiselect_snapshot().unwrap().targets().to_vec();
assert_eq!(selection.len(), 2);
let draft = serde_json::to_value(app.draft.as_ref().unwrap().recovery_snapshot()).unwrap();
let before = app.document.snapshot();
let camera = (app.zoom, app.pan);
send(&mut app, Message::ContextHelp(Topic::Nesting));
assert!(app.context_help);
for message in [
Message::Page(Page::Catalog),
Message::Select(diagram),
Message::Apply,
Message::RevertProperties,
Message::Undo,
Message::Delete,
Message::Field("/name".into(), "Background mutation".into()),
] {
send(&mut app, message);
}
assert!(app.context_help);
send(
&mut app,
Message::Guide(crate::guide::Event::Topic(Topic::Exchanges)),
);
assert_eq!(app.guide.topic, Topic::Exchanges);
send(&mut app, Message::CloseContextHelp);
assert!(!app.context_help);
assert_eq!(app.page, Page::Diagram);
assert_eq!(app.active_diagram, Some(diagram));
assert_eq!(app.selected, selected);
assert_eq!(
app.multiselect_snapshot().unwrap().targets(),
selection.as_slice()
);
assert_eq!((app.zoom, app.pan), camera);
assert_eq!(
serde_json::to_value(app.draft.as_ref().unwrap().recovery_snapshot()).unwrap(),
draft
);
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
assert!(!app.document.can_undo());
}
#[test]
fn context_help_escape_preserves_pending_behavior_form_and_blocks_submit() {
use crate::behavior::states;
let mut project = Project::empty();
let system = project
.add_element(Kind::System, Layer::Sa, "System", None)
.unwrap();
let machine = project
.add_element(Kind::StateMachine, Layer::Sa, "Modes", Some(system))
.unwrap();
let region = project
.add_element(Kind::Region, Layer::Sa, "Main", Some(machine))
.unwrap();
let state = project
.add_element(Kind::State, Layer::Sa, "Ready", Some(region))
.unwrap();
let mut app = App::with_project(project);
send(&mut app, Message::Select(state));
send(&mut app, Message::Page(Page::Behavior));
send(
&mut app,
Message::Behavior(behavior::Event::States(states::Event::Start(
machine,
states::Tool::Transition,
state,
))),
);
send(
&mut app,
Message::Behavior(behavior::Event::States(states::Event::Name(
"Pending transition 雨".into(),
))),
);
assert!(app.behavior.has_pending());
let draft = app.behavior.recovery_snapshot().unwrap();
let before = app.document.snapshot();
let selected = app.selected;
send(&mut app, Message::Help);
assert!(app.context_help);
assert_eq!(app.guide.topic, Topic::States);
for event in [
states::Event::Cancel,
states::Event::Submit,
states::Event::Name("Lost".into()),
] {
send(&mut app, Message::Behavior(behavior::Event::States(event)));
}
send(&mut app, Message::Page(Page::Catalog));
send(&mut app, Message::Escape);
assert!(!app.context_help);
assert_eq!(app.page, Page::Behavior);
assert_eq!(app.selected, selected);
assert_eq!(app.behavior.active_owner, Some(machine));
assert!(app.behavior.has_pending());
assert_eq!(app.behavior.recovery_snapshot().unwrap(), draft);
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
}
#[test]
fn context_help_retains_source_draft_and_rejects_background_source_input() {
let (mut app, diagram, _, _) = architecture();
send(&mut app, Message::Page(Page::Text));
send(
&mut app,
Message::SourceEdit(text_editor::Action::SelectAll),
);
send(
&mut app,
Message::SourceEdit(text_editor::Action::Edit(text_editor::Edit::Paste(
Arc::new("invalid unfinished source 雨".into()),
))),
);
assert!(app.source_dirty());
send(&mut app, Message::Page(Page::Diagram));
let source = app.source_editor.text();
let version = app.source_version;
let before = app.document.snapshot();
send(&mut app, Message::Help);
assert!(app.context_help);
assert_eq!(app.guide.topic, Topic::Nesting);
for message in [
Message::ApplySource,
Message::RevertSource,
Message::SourceEdit(text_editor::Action::Edit(text_editor::Edit::Paste(
Arc::new("overwrite".into()),
))),
] {
send(&mut app, message);
}
send(&mut app, Message::Escape);
assert_eq!(app.page, Page::Diagram);
assert_eq!(app.active_diagram, Some(diagram));
assert!(app.source_dirty());
assert_eq!(app.source_editor.text(), source);
assert_eq!(app.source_version, version);
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
}
#[test]
fn context_help_f1_selects_scenario_topic_without_leaving_the_workspace() {
let fixture = behavior::scenario::direct_tests::fixture();
let mut app = App::with_project(fixture.project);
send(&mut app, Message::Select(fixture.owner));
send(&mut app, Message::Page(Page::Behavior));
let before = app.document.snapshot();
send(&mut app, Message::Help);
assert!(app.context_help);
assert_eq!(app.guide.topic, Topic::Scenarios);
assert_eq!(app.page, Page::Behavior);
assert!(app.scenario_focus_owner().is_none());
assert!(!behavior::canvas_workspace::keyboard_owner_enabled(&app));
send(&mut app, Message::Escape);
assert!(!app.context_help);
assert_eq!(app.selected, fixture.owner);
assert_eq!(app.behavior.active_owner, Some(fixture.owner));
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
}
#[test]
fn context_help_disables_allocation_input_including_early_work_drag_dispatch() {
let mut project = Project::empty();
let diagram = project.ensure_diagram(Layer::Oa);
project.diagrams.get_mut(&diagram).unwrap().projection = ProjectionKind::Allocation;
let mut app = App::with_project(project);
assert!(app.allocation_input_owner());
send(
&mut app,
Message::WorkDrag(allocation_drag::Event::ArrangeNext),
);
assert!(app.allocation_drag.arrange_next);
send(&mut app, Message::Help);
assert!(app.context_help);
assert!(!app.allocation_input_owner());
assert!(!app.allocation_drag.arrange_next);
assert_eq!(app.status, "Arrange cancelled");
let before = app.document.snapshot();
send(
&mut app,
Message::WorkDrag(allocation_drag::Event::ArrangeNext),
);
assert!(!app.allocation_drag.arrange_next);
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
send(&mut app, Message::Escape);
assert!(app.allocation_input_owner());
}
#[test]
fn context_help_rejects_a_reference_picker_open_queued_from_the_inspector() {
let mut project = Project::empty();
let owner = project
.add_element(Kind::DataType, Layer::Oa, "Record", None)
.unwrap();
if let Some(SharedBody::DataType { definition, .. }) =
project.elements.get_mut(&owner).unwrap().shared_mut()
{
*definition = DataTypeDefinition::Record { supertype: None };
}
let mut app = App::with_project(project);
send(&mut app, Message::Select(owner));
let request = app.draft.as_ref().unwrap().reference_open(
app.project(),
"/body/Oa/Shared/DataType/definition/Record/supertype",
iced::Rectangle {
x: 790.,
y: 400.,
width: 278.,
height: 32.,
},
);
let before = serde_json::to_value(app.draft.as_ref().unwrap().recovery_snapshot()).unwrap();
send(&mut app, Message::ContextHelp(Topic::Nesting));
assert!(app.context_help);
send(&mut app, Message::FieldReferenceOpen(request));
assert!(!app.reference_input_active());
send(&mut app, Message::Escape);
assert!(!app.context_help);
assert_eq!(
serde_json::to_value(app.draft.as_ref().unwrap().recovery_snapshot()).unwrap(),
before
);
}
#[test]
fn context_help_accepts_live_process_viewport_and_rejects_stale_measurements() {
use crate::behavior::topology::CanvasEvent;
let mut project = Project::empty();
let owner = project
.add_element(Kind::Process, Layer::Oa, "Response process", None)
.unwrap();
let mut app = App::with_project(project);
send(&mut app, Message::Select(owner));
send(&mut app, Message::Page(Page::Behavior));
let context = app.topology_context().unwrap();
send(
&mut app,
Message::TopologyCanvas(CanvasEvent::Viewport(context, iced::Size::new(640., 480.))),
);
let initial = app.behavior.topology.camera_boundary();
let before = app.document.snapshot();
send(&mut app, Message::Help);
assert!(app.context_help);
assert_eq!(app.guide.topic, Topic::Chains);
let resized = iced::Size::new(420., 330.);
let context = app.topology_context().unwrap();
send(
&mut app,
Message::TopologyCanvas(CanvasEvent::Viewport(context, resized)),
);
let measured = app.behavior.topology.camera_boundary();
assert!(
measured != initial,
"Help must admit passive viewport measurements"
);
assert!(app.context_help);
let epoch = app.canvas_epoch;
for field in 0..3 {
let mut stale = app.topology_context().unwrap();
match field {
0 => stale.document = Id::new_v4(),
1 => stale.owner = Id::new_v4(),
_ => stale.revision += 1,
}
send(
&mut app,
Message::TopologyCanvas(CanvasEvent::Viewport(stale, iced::Size::new(999., 777.))),
);
assert!(app.behavior.topology.camera_boundary() == measured);
assert_eq!(app.canvas_epoch, epoch);
}
send(&mut app, Message::CloseContextHelp);
assert!(!app.context_help);
assert!(app.behavior.topology.camera_boundary() == measured);
let context = app.topology_context().unwrap();
let epoch = app.canvas_epoch;
send(
&mut app,
Message::TopologyCanvas(CanvasEvent::Viewport(context, resized)),
);
assert_eq!(
app.canvas_epoch, epoch,
"The size observed behind Help is already current"
);
let context = app.topology_context().unwrap();
send(
&mut app,
Message::TopologyCanvas(CanvasEvent::Viewport(context, iced::Size::new(700., 500.))),
);
assert!(app.behavior.topology.camera_boundary() != measured);
assert_eq!(app.page, Page::Behavior);
assert_eq!(app.selected, owner);
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
assert!(!app.document.can_undo());
}
async fn help_key(
mounted: &mut crate::behavior::canvas_workspace::tests::Mounted,
app: &mut App,
event: iced::Event,
) -> Vec<Message> {
let (mut messages, statuses) = mounted.input_with_status(
app,
std::slice::from_ref(&event),
iced::mouse::Cursor::Unavailable,
);
super::escape::tests::subscriptions(app, event, statuses[0], &mut messages);
for message in messages.iter().cloned() {
let task = app.update(message);
mounted.perform(app, task).await;
}
messages
}
#[tokio::test]
async fn mounted_context_help_keyboard_scroll_preserves_inspector_focus_and_exact_caret() {
use crate::behavior::canvas_workspace::tests::{Mounted, character, key};
use iced::keyboard::key::Named;
let (mut app, diagram, a, _) = architecture();
let element = app.project().diagrams[&diagram].nodes[&a].element;
send(&mut app, Message::Select(element));
let before = app.document.snapshot();
let mut mounted = Mounted::new(&mut app).await;
let field = mounted
.geometry(&app)
.text_inputs
.into_iter()
.filter(|bounds| bounds.x > app.window_size.width - 320.)
.min_by(|a, b| a.y.total_cmp(&b.y))
.expect("visible Inspector Name input");
mounted.click(&mut app, field.center()).await;
help_key(&mut mounted, &mut app, key(Named::Home)).await;
for character_value in "DRAFT ".chars() {
help_key(
&mut mounted,
&mut app,
character(&character_value.to_string()),
)
.await;
}
help_key(&mut mounted, &mut app, key(Named::ArrowLeft)).await;
assert_eq!(
app.draft.as_ref().unwrap().inputs["/name"].raw,
"DRAFT Send"
);
let camera = (app.zoom, app.pan);
help_key(&mut mounted, &mut app, key(Named::F1)).await;
assert!(app.context_help);
let article = iced::advanced::widget::Id::new(crate::guide::ARTICLE_SCROLL_ID);
let geometry = mounted.geometry(&app);
let background_scrolls = geometry
.scrolls
.iter()
.filter(|(id, _)| **id != article)
.map(|(id, (_, offset))| (id.clone(), *offset))
.collect::<Vec<_>>();
assert_eq!(geometry.scrolls[&article].1.y, 0.);
help_key(&mut mounted, &mut app, key(Named::PageDown)).await;
let down = mounted.geometry(&app).scrolls[&article].1.y;
assert!(down > 0., "PageDown scrolls the mounted Help article");
help_key(&mut mounted, &mut app, key(Named::End)).await;
let end = mounted.geometry(&app).scrolls[&article].1.y;
assert!(end > down);
help_key(&mut mounted, &mut app, key(Named::PageDown)).await;
assert_eq!(mounted.geometry(&app).scrolls[&article].1.y, end);
help_key(&mut mounted, &mut app, key(Named::PageUp)).await;
assert!(mounted.geometry(&app).scrolls[&article].1.y < end);
help_key(&mut mounted, &mut app, key(Named::Home)).await;
assert_eq!(mounted.geometry(&app).scrolls[&article].1.y, 0.);
help_key(&mut mounted, &mut app, key(Named::ArrowDown)).await;
assert_eq!(mounted.geometry(&app).scrolls[&article].1.y, 40.);
help_key(&mut mounted, &mut app, key(Named::ArrowUp)).await;
help_key(&mut mounted, &mut app, key(Named::PageUp)).await;
let geometry = mounted.geometry(&app);
assert_eq!(geometry.scrolls[&article].1.y, 0.);
for (id, offset) in background_scrolls {
assert_eq!(
geometry.scrolls[&id].1, offset,
"Help only scrolls its own article"
);
}
for character_value in "IGNORED".chars() {
help_key(
&mut mounted,
&mut app,
character(&character_value.to_string()),
)
.await;
}
let messages = mounted
.batch(
&mut app,
&[
iced::Event::InputMethod(iced::advanced::input_method::Event::Preedit(
"雨".into(),
None,
)),
iced::Event::InputMethod(iced::advanced::input_method::Event::Commit("雨".into())),
],
iced::mouse::Cursor::Unavailable,
)
.await;
assert!(!messages.iter().any(|m| matches!(m, Message::Field(..))));
assert_eq!(
app.draft.as_ref().unwrap().inputs["/name"].raw,
"DRAFT Send"
);
help_key(&mut mounted, &mut app, key(Named::Escape)).await;
assert!(!app.context_help);
help_key(&mut mounted, &mut app, character("X")).await;
assert_eq!(
app.draft.as_ref().unwrap().inputs["/name"].raw,
"DRAFTX Send",
"Return keeps the actual mid-string caret without refocusing a guessed field"
);
assert_eq!((app.zoom, app.pan), camera);
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
let messages = help_key(&mut mounted, &mut app, key(Named::PageDown)).await;
assert!(
!messages
.iter()
.any(|m| matches!(m, Message::ContextHelpScroll(_)))
);
assert!(
iced_runtime::task::into_stream(
app.update(Message::ContextHelpScroll(crate::guide::ContextScroll::End,))
)
.is_none(),
"A late Help scroll cannot operate after closing"
);
}
#[tokio::test]
async fn mounted_context_help_observes_modifier_release_before_plain_canvas_click() {
use crate::behavior::canvas_workspace::tests::{Mounted, key};
use iced::{
keyboard::{Event, Modifiers, key::Named},
mouse,
};
let (mut app, diagram, a, b) = architecture();
choose(&mut app, a, multiselect::Choice::Replace);
app.window_size = iced::Size::new(2000., 1400.);
let mut mounted = Mounted::new(&mut app).await;
app.zoom = 1.;
app.pan = iced::Vector::ZERO;
app.fit_to_view = false;
mounted.settle(&mut app).await;
mounted
.batch(
&mut app,
&[iced::Event::Keyboard(Event::ModifiersChanged(
Modifiers::SHIFT,
))],
mouse::Cursor::Unavailable,
)
.await;
help_key(&mut mounted, &mut app, key(Named::F1)).await;
assert!(app.context_help);
mounted
.batch(
&mut app,
&[iced::Event::Keyboard(Event::ModifiersChanged(
Modifiers::empty(),
))],
mouse::Cursor::Unavailable,
)
.await;
help_key(&mut mounted, &mut app, key(Named::Escape)).await;
let bounds = mounted
.geometry(&app)
.bounds(crate::allocation_input::CANVAS_ID);
let node = projection::project_view(app.project(), diagram)
.nodes
.into_iter()
.find(|node| node.id == b)
.unwrap();
let at = iced::Point::new(
bounds.x + node.position.x + 40.,
bounds.y + node.position.y + 35.,
);
mounted.click(&mut app, at).await;
assert_eq!(
app.multiselect_snapshot().unwrap().targets(),
&[Target::Placement(b)],
"Shift released during Help must not add the next card to the previous selection"
);
}
#[tokio::test]
async fn mounted_context_help_retires_held_pan_without_replaying_its_release() {
use crate::behavior::canvas_workspace::tests::{Mounted, key};
use iced::{keyboard::key::Named, mouse};
let (mut app, _, _, _) = architecture();
let mut mounted = Mounted::new(&mut app).await;
let canvas = mounted
.geometry(&app)
.bounds(crate::allocation_input::CANVAS_ID);
let start = canvas.center();
let moved = start + iced::Vector::new(20., 10.);
mounted
.batch(
&mut app,
&[
iced::Event::Mouse(mouse::Event::CursorMoved { position: start }),
iced::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Middle)),
iced::Event::Mouse(mouse::Event::CursorMoved { position: moved }),
],
mouse::Cursor::Available(moved),
)
.await;
let camera = (app.zoom, app.pan);
let before = app.document.snapshot();
help_key(&mut mounted, &mut app, key(Named::F1)).await;
assert!(app.context_help);
mounted
.batch(
&mut app,
&[iced::Event::Mouse(mouse::Event::ButtonReleased(
mouse::Button::Middle,
))],
mouse::Cursor::Unavailable,
)
.await;
help_key(&mut mounted, &mut app, key(Named::Escape)).await;
let next = moved + iced::Vector::new(90., 50.);
let messages = mounted
.batch(
&mut app,
&[iced::Event::Mouse(mouse::Event::CursorMoved {
position: next,
})],
mouse::Cursor::Available(next),
)
.await;
assert!(!messages.iter().any(|m| matches!(m, Message::Pan(_))));
assert_eq!(
(app.zoom, app.pan),
camera,
"Moving without a held button cannot resume the pre-Help pan"
);
assert!(Arc::ptr_eq(&before, &app.document.snapshot()));
}
#[tokio::test]
async fn context_help_barrier_retires_text_selection_drag_without_changing_the_caret() {
use iced::advanced::{Layout, layout, widget};
use iced::{Element, Event, Rectangle, mouse};
type InputState = iced::widget::text_input::State<
<iced::Renderer as iced::advanced::text::Renderer>::Paragraph,
>;
fn input(open: bool) -> Element<'static, Message> {
crate::guide::protect_workspace(
open,
iced::widget::text_input("Name", "A long retained property name")
.on_input(|value| Message::Field("/name".into(), value))
.width(400)
.padding(8)
.into(),
)
}
fn dispatch(
root: &mut Element<'_, Message>,
tree: &mut widget::Tree,
node: &layout::Node,
renderer: &iced::Renderer,
event: Event,
cursor: mouse::Cursor,
) -> Vec<Message> {
let mut messages = Vec::new();
root.as_widget_mut().update(
tree,
&event,
Layout::new(node),
cursor,
renderer,
&mut iced::advanced::clipboard::Null,
&mut iced::advanced::Shell::new(&mut messages),
&Rectangle::new(iced::Point::ORIGIN, iced::Size::new(400., 60.)),
);
messages
}
let mounted = crate::behavior::canvas_workspace::tests::Mounted::unshown().await;
let renderer = &mounted.renderer;
let mut root = input(false);
let mut tree = widget::Tree::new(root.as_widget());
let node = root.as_widget_mut().layout(
&mut tree,
renderer,
&layout::Limits::new(iced::Size::ZERO, iced::Size::new(400., 60.)),
);
let start = iced::Point::new(20., 18.);
let end = iced::Point::new(110., 18.);
for event in [
mouse::Event::CursorMoved { position: start },
mouse::Event::ButtonPressed(mouse::Button::Left),
mouse::Event::CursorMoved { position: end },
] {
let cursor = if matches!(event, mouse::Event::CursorMoved { position } if position == end) {
mouse::Cursor::Available(end)
} else {
mouse::Cursor::Available(start)
};
dispatch(
&mut root,
&mut tree,
&node,
renderer,
Event::Mouse(event),
cursor,
);
}
let caret = tree.children[0].state.downcast_ref::<InputState>().cursor();
assert!(
tree.children[0]
.state
.downcast_ref::<InputState>()
.is_focused()
);
root = input(true);
tree.diff(root.as_widget());
let messages = dispatch(
&mut root,
&mut tree,
&node,
renderer,
Event::Window(iced::window::Event::RedrawRequested(
std::time::Instant::now(),
)),
mouse::Cursor::Unavailable,
);
assert!(
messages.is_empty(),
"Gesture retirement discards release actions"
);
dispatch(
&mut root,
&mut tree,
&node,
renderer,
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)),
mouse::Cursor::Unavailable,
);
root = input(false);
tree.diff(root.as_widget());
let later = iced::Point::new(300., 18.);
dispatch(
&mut root,
&mut tree,
&node,
renderer,
Event::Mouse(mouse::Event::CursorMoved { position: later }),
mouse::Cursor::Available(later),
);
let state = tree.children[0].state.downcast_ref::<InputState>();
assert!(state.is_focused());
assert_eq!(
state.cursor(),
caret,
"An unheld pointer no longer extends the pre-Help text selection"
);
}
+1 -2
View File
@@ -14,8 +14,7 @@ pub(crate) fn root<'a, R: renderer::Renderer + 'a>(
content: Element<'a, Message, Theme, R>,
) -> Element<'a, Message, Theme, R> {
let modal = app.text_workspace.menu().is_none()
&& (app.context_help
|| app.behavior.creation.has_pending()
&& (app.behavior.creation.has_pending()
|| app.diagram_usages.is_some()
|| app.behavior.source_active()
|| (app.page == Page::Text
+1 -1
View File
@@ -85,7 +85,7 @@ impl App {
};
let diagram = &self.project().diagrams[&context.diagram];
let view = projection::project_diagram(self.project(), diagram);
let bounds = routing::route_diagram(self.project(), diagram, &view).bounds;
let bounds = crate::state_label::route_diagram(self.project(), diagram, &view).bounds;
let viewport = self.behavior.diagram.viewport.unwrap_or(iced::Size::new(
(self.window_size.width - 610.).max(280.),
(self.window_size.height - 320.).max(240.),
@@ -16,7 +16,6 @@ pub fn keyboard_enabled(app: &crate::app::App) -> bool {
/// Passive I/O suspends commands without changing the logical input owner.
pub(crate) fn keyboard_owner_enabled(app: &crate::app::App) -> bool {
!app.hosted.visible
&& !app.context_help
&& app.workflow.is_none()
&& app.file_prompt.is_none()
&& !app.delete_pending
+86 -27
View File
@@ -744,7 +744,7 @@ pub(crate) fn diagram_usages(
}
}
}
for edge in routing::route_diagram(project, diagram, view)
for edge in crate::state_label::route_diagram(project, diagram, view)
.edges
.values()
{
@@ -754,10 +754,10 @@ pub(crate) fn diagram_usages(
if edge.id == subject || edge.label.text.is_empty() {
continue;
}
// Routing already shortens external summaries before the canvas applies
// its width limit. Compare against precisely that doubly shortened text.
let painted = short(&edge.label.text, edge.label.bounds.size.width - 10., 10.);
if let Some(role) = transition_label_role_in_text(project, relation, subject, &painted) {
// The shared plan paints the complete retained raw summary. Keep its
// original prefix here: display normalization must not shift field offsets.
let painted = &edge.label.text;
if let Some(role) = transition_label_role_in_text(project, relation, subject, painted) {
result.push(Usage {
subject,
surface: Surface::Saved(diagram.id),
@@ -1078,7 +1078,7 @@ impl StateCanvas<'_> {
}
let view = projection::project_diagram(self.project, &diagram);
let routed = if let Some(gesture) = state.bend.as_ref().filter(|_| bend_preview.is_some()) {
routing::route_edge_preview(
crate::state_label::route_edge_preview(
self.project,
&diagram,
&view,
@@ -1086,7 +1086,7 @@ impl StateCanvas<'_> {
gesture.route.edge,
)
} else {
routing::route_diagram(self.project, &diagram, &view)
crate::state_label::route_diagram(self.project, &diagram, &view)
};
let symbol_labels = symbol_labels(self.project, &view, &routed);
let scene = Arc::new(Scene {
@@ -1153,6 +1153,19 @@ impl StateCanvas<'_> {
.map(|n| n.element)
}
fn hit(&self, scene: &Scene, world: Point) -> Option<Hit> {
// State labels paint opaque backgrounds above nodes and rows. Select
// the last painted label at an overlapping pixel, including its padding.
// Endpoint/bend handling remains ahead of this ordinary hit path.
if let Some(edge) = scene.routed.edges.values().rev().find(|edge| {
edge.label.state_layout.is_some()
&& Rectangle::new(
point(edge.label.bounds.position),
Size::new(edge.label.bounds.size.width, edge.label.bounds.size.height),
)
.contains(world)
}) {
return Some(Hit::Transition(edge.id));
}
let node = self.node_at(scene, world);
if let Some(node) = node {
if let Some((relation, _)) = state_action_rows(self.project, node)
@@ -1497,9 +1510,7 @@ impl StateCanvas<'_> {
format!("{} · {} · right-click to edit", r.name, routing::state_transition_summary(self.project, r))
}
}).unwrap_or_default(),
// General gestures are available in Help; keep this stable slot
// for the active operation or the item under the pointer.
_ => String::new(),
_ => "Select / move · drag a vertex · drag selected transition endpoints to reconnect · middle-drag to pan".into(),
},
}
}
@@ -2109,21 +2120,29 @@ impl canvas::Program<Event> for StateCanvas<'_> {
Size::new(label.bounds.size.width, label.bounds.size.height),
Color::WHITE,
);
let width = label.bounds.size.width - 10.;
label_text(
frame,
short(self.project.named(edge.id), width, 10.),
point(label.bounds.position) + Vector::new(5., 0.),
10.,
color,
);
label_text(
frame,
short(&label.text, width, 10.),
point(label.bounds.position) + Vector::new(5., 12.),
10.,
style::MUTED,
);
if let Some(plan) = &label.state_layout {
for (line, offset, ink) in plan
.title_lines
.iter()
.enumerate()
.map(|(index, line)| (line, plan.title_line_position(index), color))
.chain(plan.summary_lines.iter().enumerate().map(|(index, line)| {
(line, plan.summary_line_position(index), style::MUTED)
}))
{
frame.fill_text(Text {
content: line.clone(),
position: point(label.bounds.position)
+ Vector::new(offset.x, offset.y),
size: routing::StateLabelLayout::FONT_SIZE.into(),
line_height: iced::widget::text::LineHeight::Absolute(
routing::StateLabelLayout::LINE_HEIGHT.into(),
),
color: ink,
..Default::default()
});
}
}
if active
&& self
.current_selection()
@@ -2597,6 +2616,7 @@ mod tests {
include!("state_bend_tests.rs");
include!("state_multiselect_canvas_tests.rs");
include!("state_label_canvas_tests.rs");
struct Fixture {
project: Project,
@@ -2805,6 +2825,45 @@ mod tests {
assert!(!retained_label_field("1234A678", "1234…", 4));
}
#[test]
fn state_label_usage_keeps_raw_crlf_prefix_for_later_typed_fields() {
let mut f = fixture();
let first = f
.project
.add_element(Kind::Event, Layer::Sa, "漢\r\nB", None)
.unwrap();
let second = f
.project
.add_element(Kind::Event, Layer::Sa, "Visible", None)
.unwrap();
let edge = f
.project
.relate(RelationKind::StateTransition, "Ready\nfor review", f.a, f.b);
if let RelationBody::StateTransition { triggers, .. } =
&mut f.project.relations.get_mut(&edge).unwrap().body
{
*triggers = vec![first, second];
}
let diagram = &f.project.diagrams[&f.diagram];
let view = projection::project_diagram(&f.project, diagram);
let routed = crate::state_label::route_diagram(&f.project, diagram, &view);
let label = &routed.edges[&edge].label;
assert_eq!(label.text, "External · 漢\r\nB OR Visible");
assert_eq!(
label.state_layout.as_ref().unwrap().summary_lines,
["External · 漢", "B OR Visible"]
);
let usages = diagram_usages(&f.project, diagram, &view, second);
assert!(
usages
.iter()
.any(|u| u.target == Target::Edge(edge) && u.role == "transition trigger")
);
// Feeding normalized display text to raw-prefix matching would lose
// the second field at CRLF. Its raw name and source remain unchanged.
assert_eq!(f.project.named(first), "漢\r\nB");
}
#[test]
fn diagram_usage_external_labels_obey_routing_cutoff_while_internal_rows_retain_full_summary() {
use crate::diagram_usage::Target;
@@ -2839,9 +2898,9 @@ mod tests {
}
let diagram = &f.project.diagrams[&f.diagram];
let view = projection::project_diagram(&f.project, diagram);
let routed = routing::route_diagram(&f.project, diagram, &view);
let routed = crate::state_label::route_diagram(&f.project, diagram, &view);
let edge = &routed.edges[&external];
let painted = short(&edge.label.text, edge.label.bounds.size.width - 10., 10.);
let painted = &edge.label.text;
// Independent painted-text oracle: 11 prefix characters + 35 As, then
// only the space before OR survives the routing limit.
assert_eq!(edge.label.text, format!("External · {} …", "A".repeat(35)));
+1 -1
View File
@@ -328,7 +328,7 @@ pub fn bend_route(
}
let stored = project.diagrams.get(&diagram)?;
let view = projection::project_diagram(project, stored);
let geometry = oa_core::routing::route_diagram(project, stored, &view)
let geometry = crate::state_label::route_diagram(project, stored, &view)
.edges
.remove(&relation)?;
(!geometry.custom_suspended).then_some(geometry)
@@ -0,0 +1,463 @@
// Included in state_canvas::tests. Fixed world points exercise the real scene
// and Program input, rather than choosing a successful point from returned bounds.
fn multiline_label_fixture() -> (Fixture, Id, Id) {
let mut f = fixture();
let work = f
.project
.add_element(Kind::Function, Layer::Sa, "Record request", None)
.unwrap();
let action = f
.project
.relate(RelationKind::StateAction, "Record shared work", f.a, work);
if let RelationBody::StateAction { phase, .. } =
&mut f.project.relations.get_mut(&action).unwrap().body
{
*phase = StateActionKind::Entry;
}
let generated = f
.project
.relate(RelationKind::StateTransition, "Ready\nfor review", f.b, f.c);
let edge = Id::from_u128(36_001);
let mut relation = f.project.relations.remove(&generated).unwrap();
relation.id = edge;
if let RelationBody::StateTransition { guard, .. } = &mut relation.body {
*guard = "request_ready".into();
}
f.project.relations.insert(edge, relation);
// B is (760,180), 224x94. Its bottom midpoint is (872,274).
// Fraction zero plus this authored offset fixes the label center at (440,260),
// over A's entry row (y244..270), independently of text width/routing choices.
f.project
.diagrams
.get_mut(&f.diagram)
.unwrap()
.routes
.push(EdgeRoute {
edge,
waypoints: vec![],
source_attachment: Some(EdgeAttachment {
side: PortAnchorSide::Bottom,
offset: 0.5,
}),
target_attachment: Some(EdgeAttachment {
side: PortAnchorSide::Top,
offset: 0.5,
}),
label: Some(EdgeLabel {
fraction: 0.,
offset: Position { x: -432., y: -14. },
}),
});
validate_candidate(&f.project).unwrap();
(f, edge, action)
}
#[test]
fn state_multiline_label_owns_covered_row_and_node_pixels_but_not_exposed_row() {
let (f, edge, action) = multiline_label_fixture();
let before = f.project.clone();
for zoom in [0.5, 1., 2.] {
let canvas = canvas(&f, Tool::Select, zoom); // Nonzero pan and canvas origin.
let scene = canvas.scene(&State::default()).unwrap();
let label = &scene.routed.edges[&edge].label;
let layout = label
.state_layout
.as_ref()
.expect("dedicated State label plan");
assert_eq!(layout.title_lines, ["Ready", "for review"]);
assert_eq!(
layout.summary_lines,
["External · Completion [request_ready]"]
);
assert_eq!(label.center, Position { x: 440., y: 260. });
assert_eq!(label.bounds.size.height, 36.);
let node = scene.view.nodes.iter().find(|n| n.element == f.a).unwrap();
let row = state_action_rows(&f.project, node)[0].1;
assert!(row.contains(Point::new(440., 260.)));
assert!(!row.contains(Point::new(440., 272.)));
// Second title cell covers a row; summary covers the State header below it.
for at in [Point::new(440., 260.), Point::new(440., 272.)] {
assert_eq!(canvas.hit(&scene, at), Some(Hit::Transition(edge)));
let events = click(&canvas, &mut State::default(), at);
assert!(
matches!(events.as_slice(), [Event::Select(context, id)]
if *context == canvas.context && *id == edge),
"{events:?}"
);
}
let exposed = Point::new(200., 260.);
assert!(row.contains(exposed));
assert_eq!(
canvas.hit(&scene, exposed),
Some(Hit::Row {
placement: node.id,
relation: action
})
);
let events = click(&canvas, &mut State::default(), exposed);
assert!(
matches!(events.as_slice(), [Event::Select(_, id)] if *id == action),
"{events:?}"
);
for (at, object, target) in [
(Point::new(440., 272.), edge, Target::Edge(edge)),
(
exposed,
action,
Target::StateRow {
placement: node.id,
relation: action,
},
),
] {
let mut state = State::default();
let at = screen(&canvas, at);
motion(&canvas, &mut state, at, at);
assert!(
matches!(input(&canvas, &mut state, mouse::Event::ButtonPressed(mouse::Button::Right), at),
Some(Event::ContextMenu { object: actual, selection_target: Some(actual_target), .. })
if actual == object && actual_target == target)
);
}
}
assert_eq!(
f.project, before,
"Hit testing and input cannot author layout or semantics"
);
}
#[test]
fn state_overlapping_label_background_selects_last_painted_even_if_lower_is_selected() {
let (mut f, lower, _) = multiline_label_fixture();
let upper = Id::from_u128(36_002);
let mut relation = f.project.relations[&lower].clone();
relation.id = upper;
relation.alias = "second_multiline_transition".into();
f.project.relations.insert(upper, relation);
let mut route = f.project.diagrams[&f.diagram].routes[0].clone();
route.edge = upper;
// Reverse authored route order: stable edge paint order must still decide.
f.project
.diagrams
.get_mut(&f.diagram)
.unwrap()
.routes
.insert(0, route);
validate_candidate(&f.project).unwrap();
let mut canvas = canvas(&f, Tool::Select, 1.);
canvas.selected = lower;
let selection = group_selection(&canvas, [Target::Edge(lower)]);
canvas.selection = Some(&selection);
let scene = canvas.scene(&State::default()).unwrap();
assert_eq!(
scene.routed.edges[&lower].label.bounds,
scene.routed.edges[&upper].label.bounds
);
let at = Point::new(440., 260.);
assert_eq!(canvas.hit(&scene, at), Some(Hit::Transition(upper)));
let events = click(&canvas, &mut State::default(), at);
assert!(
matches!(events.as_slice(), [Event::Selection(SelectionEvent::Choose(_, Target::Edge(id), Choice::Replace))]
if *id == upper),
"{events:?}"
);
}
#[test]
fn state_multiline_label_and_exposed_row_keep_shift_identity_and_refuse_mixed_drag() {
let (f, edge, action) = multiline_label_fixture();
let before = f.project.clone();
let mut canvas = canvas(&f, Tool::Select, 0.75);
let row = Target::StateRow {
placement: placement(&f, f.a),
relation: action,
};
let selection = group_selection(&canvas, [Target::Edge(edge), row.clone()]);
let snapshot = selection
.snapshot(selection_context(canvas.context))
.unwrap();
canvas.selection = Some(&selection);
canvas.selected = edge;
for (world, target) in [
(Point::new(440., 260.), Target::Edge(edge)),
(Point::new(200., 260.), row),
] {
let at = screen(&canvas, world);
let mut state = State::default();
assert!(
canvas::Program::update(
&canvas,
&mut state,
&canvas::Event::Keyboard(keyboard::Event::ModifiersChanged(
keyboard::Modifiers::SHIFT
)),
bounds(),
mouse::Cursor::Unavailable
)
.is_none()
);
motion(&canvas, &mut state, at, at);
assert!(
matches!(input(&canvas, &mut state, mouse::Event::ButtonPressed(mouse::Button::Left), at),
Some(Event::Selection(SelectionEvent::Choose(context, actual, Choice::Toggle)))
if context == selection_context(canvas.context) && actual == target)
);
assert!(state.group.is_none() && state.press.is_none() && state.bend.is_none());
assert!(
input(
&canvas,
&mut state,
mouse::Event::ButtonReleased(mouse::Button::Left),
at
)
.is_none()
);
let mut state = State::default();
motion(&canvas, &mut state, at, at);
assert!(
input(
&canvas,
&mut state,
mouse::Event::ButtonPressed(mouse::Button::Left),
at
)
.is_none()
);
assert!(state.group.is_some() && state.press.is_none() && state.bend.is_none());
let end = at + Vector::new(30., 20.);
motion(&canvas, &mut state, end, end);
assert!(canvas.group_preview_key(&state, Some(bounds())).is_none());
assert!(
matches!(input(&canvas, &mut state, mouse::Event::ButtonReleased(mouse::Button::Left), end),
Some(Event::Selection(SelectionEvent::Refuse(actual, _))) if actual == snapshot)
);
assert!(state.group.is_none() && state.bend_preview.is_none());
}
assert_eq!(
selection
.snapshot(selection_context(canvas.context))
.unwrap(),
snapshot
);
assert_eq!(f.project, before);
}
#[test]
fn state_multiline_label_group_preview_replaces_old_hit_rectangle_and_cancel_restores_it() {
let (f, edge, action) = multiline_label_fixture();
let before = f.project.clone();
let mut canvas = canvas(&f, Tool::Select, 0.75);
let selection = group_selection(
&canvas,
[
Target::Placement(placement(&f, f.b)),
Target::Placement(placement(&f, f.c)),
],
);
canvas.selection = Some(&selection);
canvas.selected = f.c;
let mut state = State::default();
let baseline = canvas.scene(&state).unwrap();
let old = Point::new(440., 260.);
let moved = Point::new(440., 580.);
assert_eq!(canvas.hit(&baseline, old), Some(Hit::Transition(edge)));
let start = screen(&canvas, Point::new(780., 200.));
let end = start + Vector::new(0., 320. * canvas.scale());
motion(&canvas, &mut state, start, end);
assert!(
input(
&canvas,
&mut state,
mouse::Event::ButtonPressed(mouse::Button::Left),
end
)
.is_none()
);
assert!(state.group.is_some());
motion(&canvas, &mut state, end, end);
let preview = canvas.scene_with_bounds(&state, Some(bounds())).unwrap();
assert_eq!(
preview.routed.edges[&edge].label.center,
Position { x: 440., y: 580. }
);
assert_eq!(
preview.routed.edges[&edge].label.state_layout,
baseline.routed.edges[&edge].label.state_layout
);
assert_eq!(canvas.hit(&preview, moved), Some(Hit::Transition(edge)));
assert_eq!(
canvas.hit(&preview, old),
Some(Hit::Row {
placement: placement(&f, f.a),
relation: action
})
);
assert_eq!(f.project, before, "Group preview is derived only");
assert!(
group_key(
&canvas,
&mut state,
keyboard::key::Named::Escape,
keyboard::Modifiers::empty()
)
.is_none()
);
assert!(state.group.is_none());
let restored = canvas.scene_with_bounds(&state, Some(bounds())).unwrap();
assert_eq!(
restored.routed.edges[&edge].label,
baseline.routed.edges[&edge].label
);
assert_eq!(canvas.hit(&restored, old), Some(Hit::Transition(edge)));
assert_ne!(canvas.hit(&restored, moved), Some(Hit::Transition(edge)));
assert!(
input(
&canvas,
&mut state,
mouse::Event::ButtonReleased(mouse::Button::Left),
end
)
.is_none()
);
assert_eq!(f.project, before);
}
#[test]
fn state_multiline_label_group_commit_matches_fixed_project_and_one_step_history() {
let (f, edge, _) = multiline_label_fixture();
let b = placement(&f, f.b);
let c = placement(&f, f.c);
let before = f.project.clone();
// Declare the complete expected model before driving input. No event, preview,
// movement planner or resulting document supplies the expected displacement.
let mut expected = before.clone();
for id in [b, c] {
let node = expected
.diagrams
.get_mut(&f.diagram)
.unwrap()
.nodes
.get_mut(&id)
.unwrap();
node.position.x += 40.;
node.position.y += 40.;
}
let original_route = before.diagrams[&f.diagram].routes[0].clone();
let mut document = Document::from_project(before.clone(), Default::default()).unwrap();
let original_source = document.bundle().clone();
let mut view_canvas = canvas(&f, Tool::Select, 0.75);
let selection = group_selection(&view_canvas, [Target::Placement(b), Target::Placement(c)]);
let snapshot = selection
.snapshot(selection_context(view_canvas.context))
.unwrap();
view_canvas.selection = Some(&selection);
view_canvas.selected = f.c;
let mut state = State::default();
let baseline = view_canvas.scene(&state).unwrap();
let baseline_label = &baseline.routed.edges[&edge].label;
assert_eq!(baseline_label.center, Position { x: 440., y: 260. });
// Explicit 0.75 scale: thirty screen pixels is the declared forty world
// units. The nonzero pan/origin and ordered pointer helpers stay in play.
let start = screen(&view_canvas, Point::new(780., 200.));
let end = start + Vector::new(30., 30.);
motion(&view_canvas, &mut state, start, end);
assert!(
input(
&view_canvas,
&mut state,
mouse::Event::ButtonPressed(mouse::Button::Left),
end
)
.is_none()
);
assert!(state.group.is_some());
motion(&view_canvas, &mut state, end, end);
let preview = view_canvas
.scene_with_bounds(&state, Some(bounds()))
.unwrap();
let preview_label = &preview.routed.edges[&edge].label;
assert_eq!(preview_label.center, Position { x: 480., y: 300. });
assert_eq!(
preview_label.bounds.position,
Position {
x: baseline_label.bounds.position.x + 40.,
y: baseline_label.bounds.position.y + 40.,
}
);
assert_eq!(preview_label.bounds.size, baseline_label.bounds.size);
assert_eq!(preview_label.state_layout, baseline_label.state_layout);
assert_eq!(
f.project, before,
"Preview must not author its derived label"
);
let event = input(
&view_canvas,
&mut state,
mouse::Event::ButtonReleased(mouse::Button::Left),
end,
)
.unwrap();
let Event::Selection(SelectionEvent::Move(actual_snapshot, delta)) = event else {
panic!("Expected a group movement event, got {event:?}");
};
assert_eq!(actual_snapshot, snapshot);
assert_eq!(delta, Position { x: 40., y: 40. });
assert!(state.group.is_none() && state.press.is_none());
assert!(
input(
&view_canvas,
&mut state,
mouse::Event::ButtonReleased(mouse::Button::Left),
end
)
.is_none()
);
// This is the same production snapshot-to-command boundary used by App's
// SelectionEvent::Move handler; App admission has its existing separate tests.
let ids = crate::app::multiselect::placements(&actual_snapshot).unwrap();
let command =
oa_core::diagram_edit::translate_placements(document.project(), f.diagram, &ids, delta)
.unwrap();
document.execute(command).unwrap();
assert_eq!(document.project(), &expected);
assert_eq!(
document.project().diagrams[&f.diagram].routes[0],
original_route,
"Authored fraction, offset, attachments and empty waypoints remain exact"
);
let committed = StateCanvas {
project: document.project(),
..canvas(&f, Tool::Select, 0.75)
}
.scene(&State::default())
.unwrap();
assert_eq!(
committed.routed.edges[&edge].label, *preview_label,
"Measured settled label, including raw text and every line cell, matches preview"
);
let edited_source = document.bundle().clone();
assert_ne!(
edited_source, original_source,
"The group move is a real source edit"
);
assert!(document.undo());
assert_eq!(document.project(), &before);
assert_eq!(document.bundle(), &original_source);
assert!(
!document.undo(),
"One group release produces exactly one history entry"
);
assert!(document.redo());
assert_eq!(document.project(), &expected);
assert_eq!(document.bundle(), &edited_source);
assert!(!document.redo());
assert_eq!(
selection
.snapshot(selection_context(view_canvas.context))
.unwrap(),
snapshot
);
assert_eq!(f.project, before);
}
+9 -9
View File
@@ -225,13 +225,13 @@ fn selection_controls(app: &App) -> Element<'_, Message> {
}
controls = controls
.push(action(
"Clear",
"Clear selection",
Message::DiagramSelection(SelectionEvent::Clear(snapshot.context())),
))
.push(
label(format!(
"Properties: {} only",
crate::views::short(app.project().named(app.selected), 10)
"Properties edit only {}",
crate::views::short(app.project().named(app.selected), 18)
))
.wrapping(iced::widget::text::Wrapping::None),
);
@@ -241,12 +241,12 @@ fn selection_controls(app: &App) -> Element<'_, Message> {
} else {
"Use Select / move to select multiple elements"
};
controls
.push(crate::views::diagram_help(
crate::guide::Topic::States,
hint,
))
.into()
column![
controls,
label(hint).wrapping(iced::widget::text::Wrapping::None)
]
.height(56)
.into()
}
fn transition_details(machine: Id, selected: Id) -> Element<'static, Message> {
@@ -585,13 +585,15 @@ fn selection_controls(app: &App) -> Element<'_, Message> {
.wrapping(iced::widget::text::Wrapping::None),
);
}
// Keep the row even with an empty set so selection never moves the canvas.
controls
.push(crate::views::diagram_help(
crate::guide::Topic::Chains,
"Shift-click toggles selection. Drag selected local cards to reorder; reused previews are read-only.",
))
.into()
// These two rows exist even with an empty set so selection never moves the
// canvas viewport or changes the camera's interpretation of the pointer.
column![
controls,
label("Shift+click toggles · drag selected cards to reorder · previews are read-only")
.wrapping(iced::widget::text::Wrapping::None)
]
.height(56)
.into()
}
fn editor_panel<'a, R: iced::advanced::text::Renderer + 'a>(
+219 -130
View File
@@ -1,6 +1,7 @@
use crate::{
app::Message,
route_edit::{self, Context, Event as RouteEvent, Gesture, Handle, point, position},
state_label::route_diagram,
style,
views::short,
};
@@ -13,7 +14,7 @@ use iced::{
};
use oa_core::{
projection::{ProjectedNode, ProjectedView, project_view},
routing::{RoutedView, route_diagram},
routing::{RoutedView, StateLabelLayout},
*,
};
use std::{
@@ -34,12 +35,12 @@ mod lifecycle_tests;
#[path = "diagram/port_hit_tests.rs"]
mod port_hit_tests;
#[cfg(test)]
#[path = "diagram/state_label_input_tests.rs"]
mod state_label_input_tests;
#[cfg(test)]
#[path = "diagram/view_options_tests.rs"]
mod view_options_tests;
#[path = "diagram/label_layout_experiment.rs"]
mod label_layout_experiment;
#[path = "diagram/port_labels.rs"]
mod port_labels;
pub use port_labels::PortLabels;
@@ -91,14 +92,8 @@ pub struct State {
cache: RefCell<Option<CachedScene>>,
}
struct Scene {
label_layout: Option<label_layout_experiment::Layout>,
profile: label_layout_experiment::Profile,
font_version: Option<iced::advanced::graphics::text::Version>,
work: Option<Arc<crate::app::allocation_drag::Preview>>,
view: ProjectedView,
/// Core routing is the gesture baseline. Presentation-only wrapping must
/// never become a frozen label in a later core preview.
core_routed: Arc<RoutedView>,
routed: Arc<RoutedView>,
}
struct CachedScene {
@@ -334,7 +329,12 @@ impl DiagramCanvas<'_> {
request.bend = Some(index);
return request;
}
if let Some(port) = self.hit_port(&scene.view, local) {
if let Some(edge) = self.hit_state_label(&scene.routed, local) {
request.object = edge;
request.route_point =
routing::project_onto_polyline(&scene.routed.edges[&edge].points, position(world))
.map(|p| p.point);
} else if let Some(port) = self.hit_port(&scene.view, local) {
request.object = port.element;
} else if let Some(node) = self.hit(&scene.view, local) {
request.object = self.project.diagrams[&self.diagram].nodes[&node].element;
@@ -433,13 +433,35 @@ impl DiagramCanvas<'_> {
})
.map(|(end, owner, _)| (end, owner))
}
fn hit_state_label(&self, routed: &RoutedView, p: Point) -> Option<Id> {
let world = self.world(p);
// State labels paint after nodes, in BTree order. Hit the frontmost first.
routed
.edges
.values()
.rev()
.find(|edge| {
edge.label.state_layout.is_some()
&& !edge.label.text.is_empty()
&& Rectangle::new(
point(edge.label.bounds.position),
Size::new(edge.label.bounds.size.width, edge.label.bounds.size.height),
)
.contains(world)
})
.map(|edge| edge.id)
}
fn hit_label(&self, routed: &RoutedView, p: Point) -> Option<Id> {
if let Some(edge) = self.hit_state_label(routed, p) {
return Some(edge);
}
let p = self.world(p);
routed
.edges
.values()
.filter(|edge| {
!edge.label.text.is_empty()
edge.label.state_layout.is_none()
&& !edge.label.text.is_empty()
&& Rectangle::new(
point(edge.label.bounds.position),
Size::new(edge.label.bounds.size.width, edge.label.bounds.size.height),
@@ -523,14 +545,6 @@ impl DiagramCanvas<'_> {
}
}
fn scene(&self, state: &State) -> Arc<Scene> {
self.scene_with_profile(state, label_layout_experiment::profile())
}
fn scene_with_profile(
&self,
state: &State,
profile: label_layout_experiment::Profile,
) -> Arc<Scene> {
let font_version = label_layout_experiment::font_version(profile);
if let Some(preview) = self.work_preview()
&& state
.work
@@ -539,32 +553,13 @@ impl DiagramCanvas<'_> {
{
if let Some(scene) = state.work_cache.borrow().as_ref()
&& scene.work.as_ref().is_some_and(|p| Arc::ptr_eq(p, preview))
&& scene.profile == profile
&& scene.font_version == font_version
{
return scene.clone();
}
let core_routed = preview.routed.clone();
let mut routed = core_routed.clone();
let label_layout = if profile == label_layout_experiment::Profile::Baseline {
None
} else {
label_layout_experiment::apply(
preview.project(),
&preview.placement.diagram,
&preview.placement.view,
Arc::make_mut(&mut routed),
profile,
)
};
let scene = Arc::new(Scene {
label_layout,
profile,
font_version,
work: Some(preview.clone()),
view: preview.placement.view.clone(),
core_routed,
routed,
routed: preview.routed.clone(),
});
*state.work_cache.borrow_mut() = Some(scene.clone());
return scene;
@@ -590,8 +585,6 @@ impl DiagramCanvas<'_> {
&& cache.preview == preview
&& cache.route == route
&& cache.port == port
&& cache.scene.profile == profile
&& cache.scene.font_version == font_version
{
return cache.scene.clone();
}
@@ -601,13 +594,13 @@ impl DiagramCanvas<'_> {
self.project.diagrams[&self.diagram].clone()
};
let view = self.projected(&diagram);
let core_routed = Arc::new(
let routed = Arc::new(
if let Some(gesture) = state
.route_drag
.as_ref()
.filter(|g| g.context == self.context)
{
oa_core::routing::route_edge_preview(
crate::state_label::route_edge_preview(
self.project,
&diagram,
&view,
@@ -618,25 +611,9 @@ impl DiagramCanvas<'_> {
route_diagram(self.project, &diagram, &view)
},
);
let mut routed = core_routed.clone();
let label_layout = if profile == label_layout_experiment::Profile::Baseline {
None
} else {
label_layout_experiment::apply(
self.project,
&diagram,
&view,
Arc::make_mut(&mut routed),
profile,
)
};
let scene = Arc::new(Scene {
label_layout,
profile,
font_version,
work: None,
view,
core_routed,
routed,
});
*state.cache.borrow_mut() = Some(CachedScene {
@@ -649,23 +626,7 @@ impl DiagramCanvas<'_> {
scene
}
fn begin_route(&self, state: &mut State, world: Point, handle: Handle, route: EdgeRoute) {
self.begin_route_with_profile(
state,
world,
handle,
route,
label_layout_experiment::profile(),
);
}
fn begin_route_with_profile(
&self,
state: &mut State,
world: Point,
handle: Handle,
route: EdgeRoute,
profile: label_layout_experiment::Profile,
) {
let baseline = self.scene_with_profile(state, profile).core_routed.clone();
let baseline = self.scene(state).routed.clone();
state.route_drag = Some(Gesture {
context: self.context,
start: world,
@@ -1032,8 +993,11 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
);
}
let label = &edge.label;
if self.hit(view, p).is_none()
&& !label.text.is_empty()
if (if label.state_layout.is_some() {
self.hit_state_label(&scene.routed, p) == Some(edge.id)
} else {
self.hit(view, p).is_none()
}) && !label.text.is_empty()
&& Rectangle::new(
point(label.bounds.position),
Size::new(label.bounds.size.width, label.bounds.size.height),
@@ -1052,6 +1016,9 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
return Some(Action::capture());
}
}
if let Some(edge) = self.hit_state_label(&scene.routed, p) {
return Some(Action::publish(Message::Select(edge)).and_capture());
}
if let Some(port) = self.hit_port(view, p) {
if self.editable
&& let Some(owner) = view.nodes.iter().find(|n| n.id == port.owner)
@@ -1418,34 +1385,23 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
Stroke::default().with_color(color).with_width(1.7),
);
}
if !routed.label.text.is_empty() {
if routed.label.state_layout.is_none() && !routed.label.text.is_empty() {
let label = &routed.label;
f.fill_rectangle(
point(label.bounds.position),
Size::new(label.bounds.size.width, label.bounds.size.height),
Color::WHITE,
);
if let Some(layout) = scene
.label_layout
.as_ref()
.filter(|_| edge.id == label_layout_experiment::edge_id())
{
for line in layout.canvas_lines(if active { style::TEAL } else { style::MUTED })
{
f.fill_text(line);
}
} else {
f.fill_text(Text {
content: label.text.clone(),
position: point(label.center),
color: if active { style::TEAL } else { style::MUTED },
size: 13.into(),
align_x: iced::widget::text::Alignment::Center,
align_y: iced::alignment::Vertical::Center,
max_width: f32::INFINITY,
..Default::default()
});
}
f.fill_text(Text {
content: label.text.clone(),
position: point(label.center),
color: if active { style::TEAL } else { style::MUTED },
size: 13.into(),
align_x: iced::widget::text::Alignment::Center,
align_y: iced::alignment::Vertical::Center,
max_width: f32::INFINITY,
..Default::default()
});
}
if let Some(relation) = project.relations.get(&edge.id) {
for end in routing::association_end_geometry(relation, routed) {
@@ -1568,6 +1524,47 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
f.fill(&Path::circle(center, 1.5), color);
}
}
// State labels follow nodes, matching the dedicated State canvas layer.
for routed in scene.routed.edges.values() {
let label = &routed.label;
let active = self.selected == routed.id
|| highlighted.contains(&routed.id)
|| self.selection_contains(crate::diagram_usage::Target::Edge(routed.id));
if label.state_layout.is_some() && !label.text.is_empty() {
f.fill_rectangle(
point(label.bounds.position),
Size::new(label.bounds.size.width, label.bounds.size.height),
Color::WHITE,
);
if let Some(plan) = &label.state_layout {
for (lines, title) in [(&plan.title_lines, true), (&plan.summary_lines, false)]
{
for (index, line) in lines.iter().enumerate() {
let offset = if title {
plan.title_line_position(index)
} else {
plan.summary_line_position(index)
};
f.fill_text(Text {
content: line.clone(),
position: point(label.bounds.position)
+ Vector::new(offset.x, offset.y),
color: if title {
if active { style::TEAL } else { style::INK }
} else {
style::MUTED
},
size: StateLabelLayout::FONT_SIZE.into(),
line_height: iced::widget::text::LineHeight::Absolute(
StateLabelLayout::LINE_HEIGHT.into(),
),
..Default::default()
});
}
}
}
}
}
if let Some(bounds) = self.navigation_focus {
f.stroke(
&Path::rectangle(bounds.position(), bounds.size()),
@@ -2024,30 +2021,35 @@ impl std::fmt::Display for ExportError {
}
impl std::error::Error for ExportError {}
/// Private opt-in trial adapter for consumers that already own routed geometry.
pub(crate) fn apply_label_experiment(
p: &Project,
diagram: &Diagram,
view: &ProjectedView,
routed: &mut RoutedView,
) {
let _ = label_layout_experiment::apply(
p,
diagram,
view,
routed,
label_layout_experiment::profile(),
fn edge_label_svg(label: &routing::EdgeLabelGeometry) -> String {
if label.text.is_empty() {
return String::new();
}
let mut svg = format!(
"<rect x=\"{}\" y=\"{}\" width=\"{}\" height=\"{}\" fill=\"white\"/>",
label.bounds.position.x,
label.bounds.position.y,
label.bounds.size.width,
label.bounds.size.height
);
if let Some(plan) = &label.state_layout {
for (lines, title) in [(&plan.title_lines, true), (&plan.summary_lines, false)] {
for (index, line) in lines.iter().enumerate() {
let offset = if title {
plan.title_line_position(index)
} else {
plan.summary_line_position(index)
};
svg.push_str(&format!("<text x=\"{}\" y=\"{}\" dominant-baseline=\"text-before-edge\" xml:space=\"preserve\" font-family=\"sans-serif\" font-size=\"{}\" fill=\"{}\">{}</text>", label.bounds.position.x + offset.x, label.bounds.position.y + offset.y, StateLabelLayout::FONT_SIZE, hex(if title { style::INK } else { style::MUTED }), escape(line)));
}
}
} else {
svg.push_str(&format!("<text x=\"{}\" y=\"{}\" text-anchor=\"middle\" dominant-baseline=\"central\" font-family=\"sans-serif\" font-size=\"13\" fill=\"#637487\">{}</text>",label.center.x,label.center.y,escape(&label.text)));
}
svg
}
pub fn export_svg(p: &Project, diagram: Id) -> Result<String, ExportError> {
export_svg_with_profile(p, diagram, label_layout_experiment::profile())
}
fn export_svg_with_profile(
p: &Project,
diagram: Id,
profile: label_layout_experiment::Profile,
) -> Result<String, ExportError> {
let d = p
.diagrams
.get(&diagram)
@@ -2056,8 +2058,7 @@ fn export_svg_with_profile(
return Err(ExportError::UnsupportedScenario(diagram));
}
let view = project_view(p, diagram);
let mut routed = route_diagram(p, d, &view);
let label_layout = label_layout_experiment::apply(p, d, &view, &mut routed, profile);
let routed = route_diagram(p, d, &view);
let left = routed.bounds.position.x - 30.;
let top = routed.bounds.position.y - 30.;
let right = routed.bounds.position.x + routed.bounds.size.width + 30.;
@@ -2134,13 +2135,8 @@ fn export_svg_with_profile(
.join(" ");
svg.push_str(&format!("<path data-edge=\"{}\" d=\"{path}\" fill=\"none\" stroke=\"#8999a9\" stroke-width=\"1.5\"{dashed}{arrow}><title>{}</title></path>",edge.id,escape(p.named(edge.id))));
let label = &route.label;
if let Some(layout) = label_layout
.as_ref()
.filter(|_| edge.id == label_layout_experiment::edge_id())
{
svg.push_str(&layout.svg());
} else if !label.text.is_empty() {
svg.push_str(&format!("<rect x=\"{}\" y=\"{}\" width=\"{}\" height=\"{}\" fill=\"white\"/><text x=\"{}\" y=\"{}\" text-anchor=\"middle\" dominant-baseline=\"central\" font-family=\"sans-serif\" font-size=\"13\" fill=\"#637487\">{}</text>",label.bounds.position.x,label.bounds.position.y,label.bounds.size.width,label.bounds.size.height,label.center.x,label.center.y,escape(&label.text)));
if label.state_layout.is_none() {
svg.push_str(&edge_label_svg(label));
}
if let Some(relation) = p.relations.get(&edge.id) {
for end in routing::association_end_geometry(relation, route) {
@@ -2199,6 +2195,11 @@ fn export_svg_with_profile(
}
svg.push_str("</g>");
}
for route in routed.edges.values() {
if route.label.state_layout.is_some() {
svg.push_str(&edge_label_svg(&route.label));
}
}
svg.push_str("</svg>");
Ok(svg)
}
@@ -3056,6 +3057,94 @@ mod tests {
);
assert!(state.route_drag.is_none());
}
#[test]
fn state_svg_paints_separate_escaped_lines_at_shared_layout_origins() {
let plan = StateLabelLayout::new(
"Ready\r\nfor <review>&",
"External\nCompletion [ready]",
&|line| line.len() as f32 * 8.0,
);
let label = routing::EdgeLabelGeometry {
text: "External\nCompletion [ready]".into(),
fraction: 0.5,
anchor: Position { x: 0.0, y: 0.0 },
center: Position { x: 0.0, y: 0.0 },
bounds: routing::RoutingBounds {
position: Position { x: 100.0, y: 200.0 },
size: plan.size(),
},
state_layout: Some(plan),
};
let svg = edge_label_svg(&label);
assert_eq!(svg.matches("<text ").count(), 4);
for (y, color, text) in [
(200, "#18212c", "Ready"),
(212, "#18212c", "for &lt;review&gt;&amp;"),
(224, "#4b5968", "External"),
(236, "#4b5968", "Completion [ready]"),
] {
assert!(svg.contains(&format!("<text x=\"105\" y=\"{y}\" dominant-baseline=\"text-before-edge\" xml:space=\"preserve\" font-family=\"sans-serif\" font-size=\"10\" fill=\"{color}\">{text}</text>")), "{svg}");
}
assert!(svg.contains("height=\"48\""));
assert!(!svg.contains("text-anchor=\"middle\""));
}
#[test]
fn state_export_routes_measured_multiline_label_above_nodes() {
let mut p = Project::empty();
let owner = p
.add_element(Kind::Entity, Layer::Oa, "Crew", None)
.unwrap();
let machine = p
.add_element(Kind::StateMachine, Layer::Oa, "Modes", Some(owner))
.unwrap();
let region = p
.add_element(Kind::Region, Layer::Oa, "Main", Some(machine))
.unwrap();
let a = p
.add_element(Kind::State, Layer::Oa, "Source state", Some(region))
.unwrap();
let b = p
.add_element(Kind::State, Layer::Oa, "Target state", Some(region))
.unwrap();
let edge = p.relate(RelationKind::StateTransition, "Ready\nfor <review>&", a, b);
let diagram = Id::new_v4();
p.diagrams.insert(
diagram,
Diagram {
id: diagram,
alias: "state_export".into(),
name: "State export".into(),
description: String::new(),
layer: Layer::Oa,
projection: ProjectionKind::StateMachine { machine },
view_options: Default::default(),
nodes: BTreeMap::new(),
layout: None,
routes: vec![],
},
);
p.place(diagram, a, Position { x: 100.0, y: 100.0 });
p.place(diagram, b, Position { x: 600.0, y: 100.0 });
let view = project_view(&p, diagram);
let routed = route_diagram(&p, &p.diagrams[&diagram], &view);
let label = &routed.edges[&edge].label;
let plan = label.state_layout.as_ref().unwrap();
assert_eq!(plan.title_lines, ["Ready", "for <review>&"]);
assert_eq!(plan.summary_lines.len(), 1);
assert_eq!(label.bounds.size.height, 36.0);
let svg = export_svg(&p, diagram).unwrap();
let label_svg = edge_label_svg(label);
assert!(svg.ends_with(&format!("{label_svg}</svg>")));
assert!(svg.find("Target state</text>").unwrap() < svg.find("Ready</text>").unwrap());
assert!(svg.contains("for &lt;review&gt;&amp;</text>"));
assert!(svg.contains(&format!(
"x=\"{}\" y=\"{}\" dominant-baseline=\"text-before-edge\"",
label.bounds.position.x + 5.0,
label.bounds.position.y + 24.0
)));
}
#[test]
fn routed_svg_has_same_polyline_label_and_bounds_as_canvas_scene() {
let (mut p, diagram, edge) = route_fixture();
@@ -421,19 +421,14 @@ fn coincident_attachment_handles_honor_explicit_end_choice() {
EdgeEnd::Target,
)));
let c = canvas(&app, 1.);
let core_routed = Arc::new(route_diagram(
c.project,
&c.project.diagrams[&c.diagram],
&projection::project_view(c.project, c.diagram),
));
let mut scene = Scene {
label_layout: None,
profile: label_layout_experiment::Profile::Baseline,
font_version: None,
work: None,
view: projection::project_view(c.project, c.diagram),
routed: core_routed.clone(),
core_routed,
routed: Arc::new(route_diagram(
c.project,
&c.project.diagrams[&c.diagram],
&projection::project_view(c.project, c.diagram),
)),
};
let routed = Arc::make_mut(&mut scene.routed);
let edge = routed.edges.get_mut(&c.selected).unwrap();
@@ -1,767 +0,0 @@
//! Explicit, one-fixture visual experiment. No persisted formatting policy.
use super::*;
use iced::advanced::{graphics::text as graphics_text, text as shaped};
use shaped::Paragraph as _;
use std::sync::{Mutex, OnceLock};
const DIAGRAM: u128 = 0x00000000003840008000000000000001;
const EDGE: u128 = 0x63009b5f539e5914b630ec6b7fefb4d5;
pub(super) fn edge_id() -> Id {
Id::from_u128(EDGE)
}
const NAME: &str = "Technician service conversation";
const FONT_SIZE: f32 = 13.;
const ADVANCE: f32 = 16.;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub(super) enum Profile {
#[default]
Baseline,
E,
F,
}
pub(super) fn profile() -> Profile {
static PROFILE: OnceLock<Profile> = OnceLock::new();
*PROFILE.get_or_init(
|| match std::env::var("ARCADIA_LABEL_EXPERIMENT").as_deref() {
Ok("E") => Profile::E,
Ok("F") => Profile::F,
_ => Profile::Baseline,
},
)
}
#[derive(Clone, Debug, PartialEq)]
struct MeasuredLine {
text: &'static str,
width: f32,
baseline: f32,
family: String,
}
#[derive(Clone, Debug, PartialEq)]
pub(super) struct Line {
pub text: &'static str,
pub position: Position,
pub baseline_y: f32,
pub width: f32,
pub family: String,
}
#[derive(Clone, Debug, PartialEq)]
pub(super) struct Layout {
pub canonical_text: String,
pub lines: Vec<Line>,
pub geometry: routing::EdgeLabelGeometry,
/// Authored moves retain their shape even outside the automatic guard.
pub clear: bool,
}
pub(super) fn font_version(profile: Profile) -> Option<graphics_text::Version> {
(profile != Profile::Baseline).then(|| {
graphics_text::font_system()
.read()
.expect("Read font system")
.version()
})
}
fn measured(profile: Profile) -> Option<Arc<Vec<MeasuredLine>>> {
type Entry = (Profile, graphics_text::Version, Arc<Vec<MeasuredLine>>);
static CACHE: OnceLock<Mutex<Vec<Entry>>> = OnceLock::new();
let version = font_version(profile)?;
let mut cache = CACHE.get_or_init(|| Mutex::new(Vec::new())).lock().ok()?;
if let Some((_, _, lines)) = cache
.iter()
.find(|(p, v, _)| *p == profile && *v == version)
{
return Some(lines.clone());
}
let strings: &[&'static str] = match profile {
Profile::Baseline => return None,
Profile::E => &["Technician service", "conversation"],
Profile::F => &["Technician", "service", "conversation"],
};
let mut lines = Vec::new();
for &content in strings {
let paragraph = graphics_text::Paragraph::with_text(shaped::Text {
content,
bounds: Size::INFINITE,
size: FONT_SIZE.into(),
line_height: shaped::LineHeight::Absolute(ADVANCE.into()),
font: iced::Font::default(),
align_x: shaped::Alignment::Left,
align_y: iced::alignment::Vertical::Top,
shaping: shaped::Shaping::Basic,
wrapping: shaped::Wrapping::None,
});
let mut runs = paragraph.buffer().layout_runs();
let run = runs.next()?;
if runs.next().is_some() || run.rtl || run.glyphs.is_empty() {
return None;
}
let width = paragraph.min_width();
if !width.is_finite() || width <= 0. || paragraph.min_height() > ADVANCE + 0.01 {
return None;
}
// This fixed English witness must resolve to one actual font face.
// Mixed fallback is not silently exported as a generic SVG font.
let font_id = run.glyphs.first()?.font_id;
if run.glyphs.iter().any(|glyph| glyph.font_id != font_id) {
return None;
}
let family = graphics_text::font_system()
.write()
.ok()?
.raw()
.db()
.face(font_id)?
.families
.first()?
.0
.clone();
lines.push(MeasuredLine {
text: content,
width,
baseline: run.line_y,
family,
});
}
let lines = Arc::new(lines);
cache.retain(|(_, v, _)| *v == version);
cache.push((profile, version, lines.clone()));
Some(lines)
}
/// Runs before any scene consumer; never edits the model or any routed points.
pub(super) fn apply(
project: &Project,
diagram: &Diagram,
view: &ProjectedView,
routed: &mut RoutedView,
profile: Profile,
) -> Option<Layout> {
if profile == Profile::Baseline || diagram.id.as_u128() != DIAGRAM {
return None;
}
let id = Id::from_u128(EDGE);
let edge = routed.edges.get(&id)?;
if edge.label.text != NAME
|| project.relations.get(&id)?.name != NAME
|| edge.custom_suspended
|| view
.nodes
.iter()
.any(|node| node.visual_parent.is_some() || node.collapsed)
{
return None;
}
let metrics = measured(profile)?;
let width = metrics.iter().map(|line| line.width).fold(0., f32::max) + 16.;
let height = 8. + ADVANCE * metrics.len() as f32;
let authored = diagram
.routes
.iter()
.find(|route| route.edge == id)
.and_then(|route| route.label.as_ref());
let fraction = authored.map_or(if profile == Profile::E { 0.5 } else { 0.55 }, |label| {
label.fraction
});
let anchor = routing::point_along_polyline(&edge.points, fraction)?;
let offset = authored.map_or(
Position {
x: if profile == Profile::E {
0.
} else {
18. + width / 2.
},
y: 0.,
},
|label| label.offset,
);
let center = Position {
x: anchor.x + offset.x,
y: anchor.y + offset.y,
};
let bounds = routing::RoutingBounds {
position: Position {
x: center.x - width / 2.,
y: center.y - height / 2.,
},
size: oa_core::Size { width, height },
};
let clear = guarded(project, view, routed, id, bounds, profile);
if authored.is_none() && !clear {
return None;
}
let geometry = routing::EdgeLabelGeometry {
text: edge.label.text.clone(),
fraction,
anchor,
center,
bounds,
};
let lines = metrics
.iter()
.enumerate()
.map(|(index, line)| {
let top = bounds.position.y + 4. + ADVANCE * index as f32;
Line {
text: line.text,
position: Position {
x: center.x - line.width / 2.,
y: top,
},
baseline_y: top + line.baseline,
width: line.width,
family: line.family.clone(),
}
})
.collect();
let layout = Layout {
canonical_text: edge.label.text.clone(),
lines,
geometry,
clear,
};
routed.edges.get_mut(&id)?.label = layout.geometry.clone();
// Retain conservative existing bounds; add authored placements outside them.
// The fixed automatic witnesses are inside the unchanged node extents.
let old = routed.bounds;
let left = old.position.x.min(bounds.position.x);
let top = old.position.y.min(bounds.position.y);
let right = (old.position.x + old.size.width).max(bounds.position.x + width);
let bottom = (old.position.y + old.size.height).max(bounds.position.y + height);
routed.bounds = routing::RoutingBounds {
position: Position { x: left, y: top },
size: oa_core::Size {
width: right - left,
height: bottom - top,
},
};
Some(layout)
}
fn rectangle(bounds: routing::RoutingBounds, padding: f32) -> Rectangle {
Rectangle {
x: bounds.position.x - padding,
y: bounds.position.y - padding,
width: bounds.size.width + 2. * padding,
height: bounds.size.height + 2. * padding,
}
}
fn overlap(a: Rectangle, b: Rectangle) -> bool {
a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y
}
fn crossing(bounds: Rectangle, span: &[Position]) -> bool {
let [a, b] = [span[0], span[1]];
if a.x == b.x {
a.x >= bounds.x
&& a.x <= bounds.x + bounds.width
&& a.y.min(b.y) <= bounds.y + bounds.height
&& a.y.max(b.y) >= bounds.y
} else if a.y == b.y {
a.y >= bounds.y
&& a.y <= bounds.y + bounds.height
&& a.x.min(b.x) <= bounds.x + bounds.width
&& a.x.max(b.x) >= bounds.x
} else {
// The bounded witness supports orthogonal geometry only.
true
}
}
fn guarded(
project: &Project,
view: &ProjectedView,
routed: &RoutedView,
id: Id,
bounds: routing::RoutingBounds,
profile: Profile,
) -> bool {
let label = rectangle(bounds, 0.);
if view.nodes.iter().any(|node| {
overlap(
label,
Rectangle {
x: node.position.x - 12.,
y: node.position.y - 12.,
width: node.size.width + 24.,
height: node.size.height + 24.,
},
)
}) {
return false;
}
let stroke_bounds = rectangle(bounds, 3.);
let mut own_crossings = Vec::new();
for edge in routed.edges.values() {
if edge.id != id
&& !edge.label.text.is_empty()
&& overlap(label, rectangle(edge.label.bounds, 4.))
{
return false;
}
if let Some(relation) = project.relations.get(&edge.id) {
for end in routing::association_end_geometry(relation, edge) {
if !end.label.text.is_empty() && overlap(label, rectangle(end.label.bounds, 4.)) {
return false;
}
}
}
for span in edge.points.windows(2) {
if crossing(stroke_bounds, span) {
if edge.id != id || profile == Profile::F {
return false;
}
own_crossings.push(span);
}
}
}
if profile == Profile::E {
let [span] = own_crossings.as_slice() else {
return false;
};
let [a, b] = [span[0], span[1]];
// One complete straight crossing, not a bend, lead, tip, or shared run.
(a.x == b.x
&& a.y.min(b.y) < stroke_bounds.y
&& a.y.max(b.y) > stroke_bounds.y + stroke_bounds.height)
|| (a.y == b.y
&& a.x.min(b.x) < stroke_bounds.x
&& a.x.max(b.x) > stroke_bounds.x + stroke_bounds.width)
} else {
true
}
}
impl Layout {
pub(super) fn canvas_lines(&self, color: Color) -> impl Iterator<Item = Text> + '_ {
self.lines.iter().map(move |line| Text {
content: line.text.into(),
position: point(line.position),
color,
size: FONT_SIZE.into(),
line_height: shaped::LineHeight::Absolute(ADVANCE.into()),
font: iced::Font::default(),
align_x: shaped::Alignment::Left,
align_y: iced::alignment::Vertical::Top,
shaping: shaped::Shaping::Basic,
max_width: f32::INFINITY,
})
}
pub(super) fn svg(&self) -> String {
let bounds = self.geometry.bounds;
let mut out = format!(
"<g data-label-experiment=\"wrapped\"><title>{}</title><rect x=\"{}\" y=\"{}\" width=\"{}\" height=\"{}\" fill=\"white\"/>",
escape(&self.canonical_text),
bounds.position.x,
bounds.position.y,
bounds.size.width,
bounds.size.height
);
for line in &self.lines {
out.push_str(&format!("<text x=\"{}\" y=\"{}\" font-family=\"{}\" font-size=\"13\" fill=\"#637487\">{}</text>",
line.position.x, line.baseline_y, escape(&line.family), escape(line.text)));
}
out.push_str("</g>");
out
}
}
#[cfg(test)]
mod tests {
use super::*;
fn fixture() -> (Project, Id) {
let p: Project = serde_json::from_slice(include_bytes!(
"../../../../harness/experiments/wrapped-label-20261001/fixture/eight-card.json"
))
.unwrap();
(p, Id::from_u128(DIAGRAM))
}
fn canvas(p: &Project, diagram: Id) -> DiagramCanvas<'_> {
DiagramCanvas {
selection: None,
allocation: None,
project: p,
view_index: None,
diagram,
selected: edge_id(),
navigation_focus: None,
zoom: 1.,
pan: Vector::ZERO,
context: Context {
document: p.id,
diagram,
revision: 0,
epoch: 0,
},
selected_bend: None,
selected_attachment: None,
editable: true,
placing: false,
connection: None,
}
}
#[test]
fn baseline_is_exact_and_wrapping_changes_only_target_derived_geometry() {
let (p, id) = fixture();
let before = serde_json::to_vec(&p).unwrap();
let diagram = &p.diagrams[&id];
let view = project_view(&p, id);
let baseline = route_diagram(&p, diagram, &view);
assert_eq!(baseline.edges.len(), 12);
let mut unchanged = baseline.clone();
assert!(apply(&p, diagram, &view, &mut unchanged, Profile::Baseline).is_none());
assert_eq!(unchanged, baseline);
for profile in [Profile::E, Profile::F] {
let mut routed = baseline.clone();
let layout =
apply(&p, diagram, &view, &mut routed, profile).expect("Measured witness must fit");
assert!(layout.clear);
assert_eq!(layout.canonical_text, NAME);
assert_eq!(
layout
.lines
.iter()
.map(|line| line.text)
.collect::<Vec<_>>()
.join(" "),
NAME
);
assert_eq!(routed.edges[&edge_id()].label.text, NAME);
for (id, old) in &baseline.edges {
assert_eq!(routed.edges[id].points, old.points);
if *id != edge_id() {
assert_eq!(&routed.edges[id], old);
}
}
let mut restored = routed.clone();
restored.edges.get_mut(&edge_id()).unwrap().label =
baseline.edges[&edge_id()].label.clone();
assert_eq!(
restored, baseline,
"No paths, ports, solver state, other labels or scene extents change"
);
assert_eq!(
layout.geometry.bounds.size.height,
8. + ADVANCE * layout.lines.len() as f32
);
let max_width = layout
.lines
.iter()
.map(|line| line.width)
.fold(0., f32::max);
assert_eq!(layout.geometry.bounds.size.width, max_width + 16.);
assert!(
layout
.lines
.iter()
.all(|line| !line.family.is_empty() && line.width > 0.)
);
if profile == Profile::F {
assert_eq!(layout.geometry.fraction, 0.55);
assert!(
(layout.geometry.bounds.position.x - layout.geometry.anchor.x - 18.).abs()
< 0.001
);
assert!(
layout.geometry.bounds.size.width < 114.5,
"Measured F loses own-is-closer margin"
);
} else {
assert_eq!(layout.geometry.fraction, 0.5);
assert_eq!(layout.geometry.center, layout.geometry.anchor);
}
println!(
"{profile:?}: bounds={:?}; lines={:?}",
layout.geometry.bounds, layout.lines
);
}
assert_eq!(serde_json::to_vec(&p).unwrap(), before);
}
#[test]
fn measured_backing_canvas_svg_picking_and_focus_share_geometry() {
let (p, id) = fixture();
let c = canvas(&p, id);
for profile in [Profile::E, Profile::F] {
let state = State::default();
let scene = c.scene_with_profile(&state, profile);
let layout = scene.label_layout.as_ref().unwrap();
let bounds = rectangle(layout.geometry.bounds, 0.);
let texts = layout.canvas_lines(Color::BLACK).collect::<Vec<_>>();
let svg = super::super::export_svg_with_profile(&p, id, profile).unwrap();
assert!(svg.contains(&layout.svg()));
assert_eq!(
crate::diagram_usage::edge_focus_bounds(&scene.routed.edges[&edge_id()]),
bounds
);
for (line, text) in layout.lines.iter().zip(texts) {
assert_eq!(text.content, line.text);
assert_eq!(text.position, point(line.position));
assert_eq!(text.size.0, FONT_SIZE);
assert_eq!(
text.line_height,
shaped::LineHeight::Absolute(ADVANCE.into())
);
assert!(line.position.x >= bounds.x + 7.99);
assert!(line.position.x + line.width <= bounds.x + bounds.width - 7.99);
assert_eq!(
c.hit_label(
&scene.routed,
Point::new(line.position.x + line.width / 2., line.position.y + 8.)
),
Some(edge_id())
);
assert!(svg.contains(&format!(
"x=\"{}\" y=\"{}\" font-family=\"{}\"",
line.position.x,
line.baseline_y,
escape(&line.family)
)));
}
assert_eq!(
c.hit_label(&scene.routed, Point::new(bounds.x + 1., bounds.y + 1.)),
Some(edge_id())
);
}
}
#[test]
fn automatic_guard_refuses_foreign_coincident_stroke_and_card() {
let (p, id) = fixture();
let diagram = &p.diagrams[&id];
let view = project_view(&p, id);
let baseline = route_diagram(&p, diagram, &view);
for profile in [Profile::E, Profile::F] {
let mut valid = baseline.clone();
let layout = apply(&p, diagram, &view, &mut valid, profile).unwrap();
let mut blocked = baseline.clone();
let foreign = blocked
.edges
.keys()
.copied()
.find(|id| *id != edge_id())
.unwrap();
let bounds = layout.geometry.bounds;
blocked.edges.get_mut(&foreign).unwrap().points = vec![
Position {
x: layout.geometry.center.x,
y: bounds.position.y - 40.,
},
Position {
x: layout.geometry.center.x,
y: bounds.position.y + bounds.size.height + 40.,
},
];
let snapshot = blocked.clone();
assert!(apply(&p, diagram, &view, &mut blocked, profile).is_none());
assert_eq!(blocked, snapshot);
let mut occluded_view = view.clone();
occluded_view.nodes[0].position = bounds.position;
let mut routed = baseline.clone();
assert!(apply(&p, diagram, &occluded_view, &mut routed, profile).is_none());
assert_eq!(routed, baseline);
}
}
#[test]
fn authored_fraction_offset_keep_shape_even_during_conflicting_move() {
let (mut p, id) = fixture();
let view = project_view(&p, id);
for profile in [Profile::E, Profile::F] {
let original = route_diagram(&p, &p.diagrams[&id], &view);
let mut automatic = original.clone();
let initial = apply(&p, &p.diagrams[&id], &view, &mut automatic, profile).unwrap();
let offset = Position {
x: initial.geometry.center.x - initial.geometry.anchor.x + 17.,
y: -9.,
};
p.diagrams.get_mut(&id).unwrap().routes = vec![EdgeRoute {
edge: edge_id(),
source_attachment: None,
target_attachment: None,
waypoints: vec![],
label: Some(EdgeLabel {
fraction: initial.geometry.fraction,
offset,
}),
}];
let c = canvas(&p, id);
let state = State::default();
let scene = c.scene_with_profile(&state, profile);
let moved = scene.label_layout.as_ref().unwrap();
assert_eq!(
moved.lines.iter().map(|line| line.text).collect::<Vec<_>>(),
initial
.lines
.iter()
.map(|line| line.text)
.collect::<Vec<_>>()
);
assert_eq!(moved.geometry.fraction, initial.geometry.fraction);
assert!((moved.geometry.center.x - moved.geometry.anchor.x - offset.x).abs() < 0.001);
assert!((moved.geometry.center.y - moved.geometry.anchor.y - offset.y).abs() < 0.001);
let mut preview = State {
context: Some(c.context),
..State::default()
};
preview.route_drag = Some(Gesture {
context: c.context,
start: point(moved.geometry.center),
handle: Handle::Label { original: offset },
route: p.diagrams[&id].routes[0].clone(),
changed: true,
baseline: scene.core_routed.clone(),
});
preview
.route_drag
.as_mut()
.unwrap()
.route
.label
.as_mut()
.unwrap()
.offset
.x += 100.;
let dragged = c.scene_with_profile(&preview, profile);
let layout = dragged.label_layout.as_ref().unwrap();
assert_eq!(layout.lines.len(), moved.lines.len());
assert!(
(layout.geometry.center.x - layout.geometry.anchor.x - offset.x - 100.).abs()
< 0.001
);
for (id, edge) in &scene.routed.edges {
assert_eq!(dragged.routed.edges[id].points, edge.points);
}
p.diagrams.get_mut(&id).unwrap().routes.clear();
}
}
#[test]
fn different_edge_preview_guard_rejection_restores_complete_core_geometry() {
// Exercise the actual gesture capture and core preview, with a pure
// explicit profile. Moving another label onto the wrapped target must
// reject wrapping, leaving the full original one-line target geometry.
// All twelve point arrays and every other frozen label remain exact.
let (p, id) = fixture();
let view = project_view(&p, id);
let core = route_diagram(&p, &p.diagrams[&id], &view);
let foreign = core
.edges
.values()
.find(|edge| edge.id != edge_id() && !edge.label.text.is_empty())
.unwrap();
let original_offset = Position {
x: foreign.label.center.x - foreign.label.anchor.x,
y: foreign.label.center.y - foreign.label.anchor.y,
};
let c = DiagramCanvas {
selected: foreign.id,
..canvas(&p, id)
};
for profile in [Profile::E, Profile::F] {
let mut state = State {
context: Some(c.context),
..State::default()
};
let initial = c.scene_with_profile(&state, profile);
let target = initial
.label_layout
.as_ref()
.expect("Initial witness must wrap");
c.begin_route_with_profile(
&mut state,
point(foreign.label.center),
Handle::Label {
original: original_offset,
},
EdgeRoute {
edge: foreign.id,
source_attachment: None,
target_attachment: None,
waypoints: vec![],
label: Some(EdgeLabel {
fraction: foreign.label.fraction,
offset: original_offset,
}),
},
profile,
);
state
.route_drag
.as_mut()
.unwrap()
.move_to(point(target.geometry.center), 1.);
let diagram = c.preview_diagram(&state);
let expected = routing::route_edge_preview(&p, &diagram, &view, &core, foreign.id);
let mut guard_probe = expected.clone();
assert!(
apply(&p, &diagram, &view, &mut guard_probe, profile).is_none(),
"Foreign label now overlaps target: wrapping must be refused"
);
assert_eq!(guard_probe, expected);
let actual = c.scene_with_profile(&state, profile);
assert!(actual.label_layout.is_none());
for (edge, before) in &core.edges {
assert_eq!(
actual.routed.edges[edge].points, before.points,
"Label drag must not reroute"
);
if *edge != foreign.id && *edge != edge_id() {
assert_eq!(
actual.routed.edges[edge].label, before.label,
"Other labels remain frozen"
);
}
}
assert_eq!(
actual.routed.edges[&edge_id()].label,
core.edges[&edge_id()].label,
"No Layout means original complete one-line target geometry, never stale wrapped hit bounds"
);
assert_eq!(
*actual.routed, expected,
"Fallback is the complete core preview result"
);
}
}
#[test]
fn scene_and_measurement_cache_reuse_and_geometry_invalidation() {
let (p, id) = fixture();
let c = canvas(&p, id);
let mut state = State::default();
let first = c.scene_with_profile(&state, Profile::F);
state.pointer = Some(Point::new(100., 200.));
let changed_camera = DiagramCanvas {
pan: Vector::new(40., 30.),
zoom: 0.5,
selected: p.id,
..c
};
assert!(Arc::ptr_eq(
&first,
&changed_camera.scene_with_profile(&state, Profile::F)
));
assert!(Arc::ptr_eq(
&measured(Profile::F).unwrap(),
&measured(Profile::F).unwrap()
));
let other_profile = c.scene_with_profile(&state, Profile::E);
assert!(!Arc::ptr_eq(&first, &other_profile));
let next_revision = DiagramCanvas {
context: Context {
revision: 1,
..c.context
},
..c
};
assert!(!Arc::ptr_eq(
&other_profile,
&next_revision.scene_with_profile(&state, Profile::E)
));
let plain = c.scene_with_profile(&state, Profile::Baseline);
assert!(plain.label_layout.is_none());
assert!(Arc::ptr_eq(&plain.core_routed, &plain.routed));
assert_eq!(
*plain.routed,
route_diagram(&p, &p.diagrams[&id], &plain.view)
);
}
}
@@ -196,8 +196,27 @@ impl DiagramCanvas<'_> {
let pointer = cursor.position()?;
let local = Point::new(pointer.x - bounds.x, pointer.y - bounds.y);
let scene = self.scene(state);
let world = self.world(local);
// Preserve foreground selected handles without bypassing Shift or the
// mixed-group admission/refusal lifecycle below.
let state_handle = self.project.diagrams[&self.diagram]
.projection
.state_machine()
.is_some()
&& scene.routed.edges.get(&self.selected).is_some_and(|edge| {
!edge.custom_suspended
&& (self.attachment_at(&scene, world).is_some()
|| edge
.pins
.iter()
.any(|pin| world.distance(point(*pin)) <= 8. / self.zoom))
});
let target = if self.allocation_surface() {
self.allocation_press_target(&scene, local)
} else if state_handle {
Some(Target::Edge(self.selected))
} else if let Some(id) = self.hit_state_label(&scene.routed, local) {
Some(Target::Edge(id))
} else if let Some(port) = self.hit_port(&scene.view, local) {
Some(Target::Port {
port: port.element,
@@ -0,0 +1,230 @@
use super::*;
use crate::{
app::multiselect::{Choice, Event, context},
diagram_selection::Selection,
diagram_usage::Target,
};
fn fixture() -> (Project, Id, Id, Id, Id) {
let mut p = Project::empty();
let owner = p
.add_element(Kind::Entity, Layer::Oa, "Crew", None)
.unwrap();
let machine = p
.add_element(Kind::StateMachine, Layer::Oa, "Modes", Some(owner))
.unwrap();
let region = p
.add_element(Kind::Region, Layer::Oa, "Main", Some(machine))
.unwrap();
let a = p
.add_element(Kind::State, Layer::Oa, "A", Some(region))
.unwrap();
let b = p
.add_element(Kind::State, Layer::Oa, "B", Some(region))
.unwrap();
let mut edges = [
p.relate(RelationKind::StateTransition, "Ready\nfor review", a, b),
p.relate(RelationKind::StateTransition, "Ready\nfor review", a, b),
];
edges.sort();
let diagram = Id::new_v4();
p.diagrams.insert(
diagram,
Diagram {
id: diagram,
alias: "state_input".into(),
name: "State input".into(),
description: String::new(),
layer: Layer::Oa,
projection: ProjectionKind::StateMachine { machine },
view_options: Default::default(),
nodes: BTreeMap::new(),
layout: None,
routes: edges
.iter()
.map(|edge| EdgeRoute {
edge: *edge,
source_attachment: None,
target_attachment: None,
waypoints: vec![Position { x: 200., y: 150. }],
label: None,
})
.collect(),
},
);
let node = p.place(diagram, a, Position { x: 100., y: 100. });
p.place(diagram, b, Position { x: 650., y: 100. });
let routed = route_diagram(&p, &p.diagrams[&diagram], &project_view(&p, diagram));
for route in &mut p.diagrams.get_mut(&diagram).unwrap().routes {
let label = &routed.edges[&route.edge].label;
route.label = Some(EdgeLabel {
fraction: label.fraction,
offset: Position {
x: 200. - label.anchor.x,
y: 150. - label.anchor.y,
},
});
}
(p, diagram, edges[0], edges[1], node)
}
fn canvas(p: &Project, diagram: Id, selected: Id, zoom: f32) -> DiagramCanvas<'_> {
DiagramCanvas {
selection: None,
project: p,
view_index: None,
diagram,
selected,
navigation_focus: None,
zoom,
pan: Vector::new(100., 100.),
context: Context {
document: p.id,
diagram,
revision: 0,
epoch: 0,
},
selected_bend: None,
selected_attachment: None,
editable: true,
placing: false,
connection: None,
allocation: None,
}
}
fn screen(canvas: &DiagramCanvas<'_>, y: f32) -> Point {
Point::new(
200. * canvas.zoom + canvas.pan.x,
y * canvas.zoom + canvas.pan.y,
)
}
fn pointer(
canvas: &DiagramCanvas<'_>,
state: &mut State,
event: mouse::Event,
at: Point,
) -> Option<Message> {
canvas::Program::update(
canvas,
state,
&canvas::Event::Mouse(event),
Rectangle::with_size(Size::new(1800., 1200.)),
mouse::Cursor::Available(at),
)
.and_then(|a| a.into_inner().0)
}
#[test]
fn state_generic_front_label_beats_node_and_selected_back_label_at_three_zooms() {
for zoom in [0.5, 1., 1.5] {
let (p, diagram, low, high, _) = fixture();
let mut canvas = canvas(&p, diagram, low, zoom);
// Ten world pixels below center remains on both labels but avoids bends.
let at = screen(&canvas, 160.);
let scene = canvas.scene(&State::default());
assert!(canvas.hit(&scene.view, at).is_some());
assert_eq!(canvas.hit_label(&scene.routed, at), Some(high));
// Selected bends have a screen radius: move further down at half zoom.
let at = if zoom == 0.5 {
screen(&canvas, 167.)
} else {
at
};
assert_eq!(
canvas
.context_request(
&State::default(),
at,
Rectangle::with_size(Size::new(1800., 1200.))
)
.object,
high
);
let mut state = State::default();
assert!(
matches!(pointer(&canvas, &mut state, mouse::Event::ButtonPressed(mouse::Button::Left), at), Some(Message::Select(id)) if id == high)
);
assert!(state.drag.is_none() && state.route_drag.is_none());
canvas.selected = high;
let mut state = State::default();
pointer(
&canvas,
&mut state,
mouse::Event::ButtonPressed(mouse::Button::Left),
at,
);
assert!(matches!(
state.route_drag.as_ref().map(|g| &g.handle),
Some(Handle::Label { .. })
));
canvas.editable = false;
let mut state = State::default();
assert!(
matches!(pointer(&canvas, &mut state, mouse::Event::ButtonPressed(mouse::Button::Left), at), Some(Message::Select(id)) if id == high)
);
assert!(state.drag.is_none() && state.route_drag.is_none());
}
}
#[test]
fn state_generic_shift_label_and_handle_keep_exact_targets_and_mixed_refusal() {
let (p, diagram, low, high, node) = fixture();
let base = canvas(&p, diagram, low, 1.);
let mut single_state = State::default();
assert!(
matches!(pointer(&base, &mut single_state, mouse::Event::ButtonPressed(mouse::Button::Left), screen(&base, 150.)), Some(Message::Route(RouteEvent::SelectBend(id, 0))) if id == low)
);
assert!(matches!(
single_state.route_drag.as_ref().map(|g| &g.handle),
Some(Handle::Bend(0))
));
let mut selection = Selection::new(context(base.context).scope);
selection.add(Target::Edge(low), |_| true);
selection.add(Target::Placement(node), |_| true);
let canvas = DiagramCanvas {
selection: Some(&selection),
..base
};
for (y, expected) in [(160., high), (150., low)] {
let mut state = State {
modifiers: iced::keyboard::Modifiers::SHIFT,
..State::default()
};
assert!(
matches!(pointer(&canvas, &mut state, mouse::Event::ButtonPressed(mouse::Button::Left), screen(&canvas,y)), Some(Message::DiagramSelection(Event::Choose(_, Target::Edge(id), Choice::Toggle))) if id == expected)
);
assert!(state.drag.is_none() && state.route_drag.is_none());
}
let mut state = State::default();
let at = screen(&canvas, 150.);
assert_eq!(
canvas
.context_request(&state, at, Rectangle::with_size(Size::new(1800., 1200.)))
.bend,
Some(0)
);
pointer(
&canvas,
&mut state,
mouse::Event::ButtonPressed(mouse::Button::Left),
at,
);
assert!(state.group.is_some() && state.route_drag.is_none());
let moved = at + Vector::new(20., 20.);
pointer(
&canvas,
&mut state,
mouse::Event::CursorMoved { position: moved },
moved,
);
assert!(matches!(
pointer(
&canvas,
&mut state,
mouse::Event::ButtonReleased(mouse::Button::Left),
moved
),
Some(Message::DiagramSelection(Event::Refuse(_, _)))
));
assert!(state.route_drag.is_none() && state.drag.is_none());
}
+1 -2
View File
@@ -6,8 +6,7 @@ impl DiagramCanvas<'_> {
pub(crate) fn work_dirty_point(&self, bounds: Rectangle, screen: Point) -> bool {
let diagram = &self.project.diagrams[&self.diagram];
let view = self.projected(diagram);
let mut routed = routing::route_diagram(self.project, diagram, &view);
super::apply_label_experiment(self.project, diagram, &view, &mut routed);
let routed = crate::state_label::route_diagram(self.project, diagram, &view);
self.work_dirty_press(
&view,
&routed,
+4 -12
View File
@@ -327,11 +327,7 @@ pub(crate) fn saved_usages_for(p: &Project, subject: Id, only_diagram: Option<Id
"state machine view"
}
.into(),
bounds: {
let mut routed = routing::route_diagram(p, diagram, &view);
crate::diagram::apply_label_experiment(p, diagram, &view, &mut routed);
routed_bounds(routed.bounds)
},
bounds: routed_bounds(crate::state_label::route_diagram(p, diagram, &view).bounds),
});
}
for node in &view.nodes {
@@ -411,13 +407,9 @@ pub(crate) fn saved_usages_for(p: &Project, subject: Id, only_diagram: Option<Id
}
}
if view.edges.iter().any(|edge| edge.id == subject)
&& let Some(edge) = {
let mut routed = routing::route_diagram(p, diagram, &view);
crate::diagram::apply_label_experiment(p, diagram, &view, &mut routed);
routed
}
.edges
.get(&subject)
&& let Some(edge) = crate::state_label::route_diagram(p, diagram, &view)
.edges
.get(&subject)
{
usages.push(Usage {
subject,
+4 -25
View File
@@ -48,11 +48,6 @@ pub enum Event {
pub(crate) const ARTICLE_SCROLL_ID: &str = "engineering-guide-article";
mod context_help;
pub(crate) use context_help::{
ContextScroll, context_scroll_key, context_scroll_task, protect_workspace,
};
impl State {
/// Returns whether navigation selected a different article.
pub fn update(&mut self, event: Event) -> bool {
@@ -315,7 +310,7 @@ fn article(topic: Topic) -> Article {
"Use the diagram selector or + View to work with a focused diagram. View properties edits its name, perspective, projection and Saved view visibility. Apply changes commits the view settings.",
"Choose Containment for semantic children, Architecture · allocated work for responsibilities, Functional dataflow for work and exchanges, or Missions & capabilities for outcomes. All relationships explores one layer; OA ↔ SA traceability can show placed elements from both layers and their correspondence lines alongside ordinary relationships.",
"Select an element and edit Semantic parent to change ownership. Use the Allocation palette tool to connect a performer to existing unallocated leaf work in Containment. The relationship can appear as a line there; Architecture · allocated work shows responsibility through nesting instead. Saved visibility filters can hide a line without removing the relationship.",
"Scroll to zoom and use Fit to frame the current view. In allocated-work views, dragging work changes its assignment and placement together. Choose Arrange or press Alt+A to move work without changing responsibility for that one drag; Escape cancels the armed action. Auto-layout arranges the whole view. Export SVG produces a shareable view.",
"Scroll to zoom and use Fit to frame the current view. In allocated-work views, dragging work changes its assignment and placement together. Choose Arrange next drag or press Alt+A to move work without changing responsibility for that one drag; Escape cancels the armed action. Auto-layout arranges the whole view. Export SVG produces a shareable view.",
"Select a diagram node to access Placement, Fold / unfold and Hide. With the canvas focused, Delete hides its placement; Shift+Delete asks to remove the model element. Other views retain a hidden element. Undo restores either change.",
],
),
@@ -339,7 +334,7 @@ fn article(topic: Topic) -> Article {
"Finish or cancel property and source edits, then drag an Activity or Function body in Architecture · allocated work. Aim at exposed performer space, including a collapsed performer's header. Read Destination above the canvas and the outlined target before releasing; release outside the canvas or press Escape to cancel.",
"Use Shift-click to add or remove cards from the selection, or right-click a card and choose Add to selection. Drag any selected work card to assign the whole work selection to one performer. Independent work can start on different performers. The inspector keeps its primary element during the drag; right-click a selected card and choose Inspect this element to change that primary without losing the group.",
"The move preserves work ownership and identities. A composite work card moves its leaves together when they have one coherent responsibility; if its own leaves are distributed across performers, choose specific leaves instead. Role responsibilities remain explicit: an outward drag that would leave a role-derived performer explains why it cannot remove that responsibility.",
"To move work and performers together without changing responsibility, select their cards and choose Arrange or press Alt+A. This moves the selected work subtrees and each selected performer's contained cards together, if the complete layout stays readable and clear. Ports and connections cannot join a placement move. Dragging only performer cards normally moves them and their contained cards without changing assignments.",
"To move work and performers together without changing responsibility, select their cards and choose Arrange next drag or press Alt+A. This moves the selected work subtrees and each selected performer's contained cards together, if the complete layout stays readable and clear. Ports and connections cannot join a placement move. Dragging only performer cards normally moves them and their contained cards without changing assignments.",
"Make room when work cards would overlap, and move the view or zoom in if the moving work is not readable. The destination name stays above the canvas while the target outline stays fixed during the drag. Hover Destination to inspect a long name: outside the canvas, the tooltip explicitly identifies the last target, and releasing cancels. Return to the canvas to choose the drop. A refused drop keeps the model and history unchanged. One Undo reverses an accepted assignment and placement together; Save all writes the corresponding source changes.",
],
),
@@ -468,10 +463,6 @@ fn article(topic: Topic) -> Article {
summary: "An operational Process or system Functional chain connects contributions of existing work and exchanges, including alternatives and reusable procedures. It explains how work contributes to an outcome.",
keywords: "process functional chain ordered occurrence sequence path involvement dataflow exchange repeated steps caller contextual qualified assembly common work focus reuse",
sections: &[
explain(
"Select a group",
"Use Select, then Shift-click to add or remove contributions from the selection. Drag selected local cards to reorder them in the same column. Reused previews are read-only; open their referenced definition to edit. Properties affect only the primary selected item. Help or F1 opens this guide without leaving the diagram; Close or Escape returns to editing.",
),
walkthrough(
"Describe a path through exchanges",
&[
@@ -578,10 +569,6 @@ fn article(topic: Topic) -> Article {
summary: "Describe the conditions in which the operation or system behaves differently. States and modes belong to regions within a state machine.",
keywords: "state machine mode region initial final transition trigger guard effect entry exit do availability degraded nominal diagram draw reconnect local internal timed fold unfold placement pan zoom undo",
sections: &[
explain(
"Select a group",
"Choose Select / move, then Shift-click to add or remove elements from the selection. Properties affect only the primary selected item; Hide selected removes placements from this view. Help or F1 opens this guide without leaving the diagram; Close or Escape returns to editing.",
),
walkthrough(
"Build a state machine",
&[
@@ -1169,14 +1156,6 @@ fn topic_button(topic: Topic, selected: bool) -> iced::widget::Button<'static, M
}
fn article_view(topic: Topic) -> Element<'static, Message> {
article_content(topic, true)
}
pub(crate) fn context_view(state: &State) -> Element<'static, Message> {
article_content(state.topic, false)
}
fn article_content(topic: Topic, navigation: bool) -> Element<'static, Message> {
let article = article(topic);
let mut content = column![
text(topic.category()).size(11).color(style::MUTED),
@@ -1215,14 +1194,14 @@ fn article_content(topic: Topic, navigation: bool) -> Element<'static, Message>
}
content = content.push(container(body).padding(20).width(Fill).style(style::card));
}
if navigation && let Some((page, label)) = article.destination {
if let Some((page, label)) = article.destination {
content = content.push(
button(text(label).size(13))
.padding([11, 15])
.on_press(Message::Page(page)),
);
}
if navigation && topic == Topic::FirstProject {
if topic == Topic::FirstProject {
content = content.push(text("For a worked model, open the water-pressure walkthrough. Copy the whole examples/release1 folder and open the copied project.arcadia before editing; read its README.md. If you use Save as, also copy evidence/ beside the new entry: Save as copies model source, not external artifact targets.").size(13));
content = content.push(
button(text("Open water-pressure walkthrough").size(13))
-282
View File
@@ -1,282 +0,0 @@
//! Modal reading input and preservation of the mounted editing workspace.
use super::ARTICLE_SCROLL_ID;
use crate::app::Message;
use iced::Element;
#[derive(Debug, Clone, Copy)]
pub(crate) enum ContextScroll {
LineUp,
LineDown,
PageUp,
PageDown,
Home,
End,
}
pub(crate) fn context_scroll_key(
event: iced::Event,
status: iced::event::Status,
_: iced::window::Id,
) -> Option<Message> {
use iced::keyboard::{Event, Key, key::Named};
let iced::Event::Keyboard(Event::KeyPressed { key, modifiers, .. }) = event else {
return None;
};
if status == iced::event::Status::Captured || !modifiers.is_empty() {
return None;
}
let scroll = match key {
Key::Named(Named::ArrowUp) => ContextScroll::LineUp,
Key::Named(Named::ArrowDown) => ContextScroll::LineDown,
Key::Named(Named::PageUp) => ContextScroll::PageUp,
Key::Named(Named::PageDown) => ContextScroll::PageDown,
Key::Named(Named::Home) => ContextScroll::Home,
Key::Named(Named::End) => ContextScroll::End,
_ => return None,
};
Some(Message::ContextHelpScroll(scroll))
}
pub(crate) fn context_scroll_task(scroll: ContextScroll) -> iced::Task<Message> {
struct Scroll(ContextScroll);
impl<T> iced::advanced::widget::Operation<T> for Scroll {
fn traverse(
&mut self,
visit: &mut dyn FnMut(&mut dyn iced::advanced::widget::Operation<T>),
) {
visit(self);
}
fn scrollable(
&mut self,
id: Option<&iced::advanced::widget::Id>,
bounds: iced::Rectangle,
content_bounds: iced::Rectangle,
_: iced::Vector,
state: &mut dyn iced::advanced::widget::operation::Scrollable,
) {
use iced::advanced::widget::operation::scrollable::{AbsoluteOffset, RelativeOffset};
if id != Some(&iced::advanced::widget::Id::new(ARTICLE_SCROLL_ID)) {
return;
}
match self.0 {
ContextScroll::Home | ContextScroll::End => state.snap_to(RelativeOffset {
x: None,
y: Some(if matches!(self.0, ContextScroll::End) {
1.
} else {
0.
}),
}),
scroll => {
let y = match scroll {
ContextScroll::LineUp => -40.,
ContextScroll::LineDown => 40.,
ContextScroll::PageUp => -bounds.height * 0.9,
ContextScroll::PageDown => bounds.height * 0.9,
_ => unreachable!(),
};
// Iced clamps this movement to the actual content bounds.
state.scroll_by(AbsoluteOffset { x: 0., y }, bounds, content_bounds);
}
}
}
}
iced::advanced::widget::operate(Scroll(scroll))
}
/// Keep the mounted editor and its caret, but prevent modal input from reaching
/// widget-internal state before the App message guard can reject edits.
pub(crate) fn protect_workspace<'a, R: iced::advanced::renderer::Renderer + 'a>(
help_open: bool,
content: Element<'a, Message, iced::Theme, R>,
) -> Element<'a, Message, iced::Theme, R> {
Element::new(WorkspaceInput { help_open, content })
}
struct WorkspaceInput<'a, R> {
help_open: bool,
content: Element<'a, Message, iced::Theme, R>,
}
#[derive(Default)]
struct WorkspaceInputState {
help_open: bool,
}
impl<R: iced::advanced::renderer::Renderer> iced::advanced::Widget<Message, iced::Theme, R>
for WorkspaceInput<'_, R>
{
fn tag(&self) -> iced::advanced::widget::tree::Tag {
iced::advanced::widget::tree::Tag::of::<WorkspaceInputState>()
}
fn state(&self) -> iced::advanced::widget::tree::State {
iced::advanced::widget::tree::State::new(WorkspaceInputState::default())
}
fn children(&self) -> Vec<iced::advanced::widget::Tree> {
vec![iced::advanced::widget::Tree::new(self.content.as_widget())]
}
fn diff(&self, tree: &mut iced::advanced::widget::Tree) {
tree.diff_children(std::slice::from_ref(&self.content));
}
fn size(&self) -> iced::Size<iced::Length> {
self.content.as_widget().size()
}
fn size_hint(&self) -> iced::Size<iced::Length> {
self.content.as_widget().size_hint()
}
fn layout(
&mut self,
tree: &mut iced::advanced::widget::Tree,
renderer: &R,
limits: &iced::advanced::layout::Limits,
) -> iced::advanced::layout::Node {
self.content
.as_widget_mut()
.layout(&mut tree.children[0], renderer, limits)
}
fn operate(
&mut self,
tree: &mut iced::advanced::widget::Tree,
layout: iced::advanced::Layout<'_>,
renderer: &R,
operation: &mut dyn iced::advanced::widget::Operation,
) {
self.content
.as_widget_mut()
.operate(&mut tree.children[0], layout, renderer, operation);
}
fn update(
&mut self,
tree: &mut iced::advanced::widget::Tree,
event: &iced::Event,
layout: iced::advanced::Layout<'_>,
cursor: iced::mouse::Cursor,
renderer: &R,
clipboard: &mut dyn iced::advanced::Clipboard,
shell: &mut iced::advanced::Shell<'_, Message>,
viewport: &iced::Rectangle,
) {
let entering = {
let state = tree.state.downcast_mut::<WorkspaceInputState>();
let entering = self.help_open && !state.help_open;
state.help_open = self.help_open;
entering
};
if entering {
// Retire held gestures without executing their release actions.
// Text controls keep their real caret/focus; drawing tools remain
// selected, but an old drag cannot resume when Help is dismissed.
for event in [
iced::mouse::Event::CursorLeft,
iced::mouse::Event::ButtonReleased(iced::mouse::Button::Left),
iced::mouse::Event::ButtonReleased(iced::mouse::Button::Middle),
iced::mouse::Event::ButtonReleased(iced::mouse::Button::Right),
] {
let mut discarded = Vec::new();
let mut cancellation = iced::advanced::Shell::new(&mut discarded);
self.content.as_widget_mut().update(
&mut tree.children[0],
&iced::Event::Mouse(event),
layout,
iced::mouse::Cursor::Unavailable,
renderer,
clipboard,
&mut cancellation,
viewport,
);
shell.request_redraw_at(cancellation.redraw_request());
if cancellation.is_layout_invalid() {
shell.invalidate_layout();
}
if cancellation.are_widgets_invalid() {
shell.invalidate_widgets();
}
}
}
if self.help_open
&& matches!(
event,
iced::Event::Keyboard(
iced::keyboard::Event::KeyPressed { .. }
| iced::keyboard::Event::KeyReleased { .. }
) | iced::Event::Mouse(_)
| iced::Event::Touch(_)
| iced::Event::InputMethod(_)
)
{
return;
}
// ModifiersChanged and passive window/redraw events still reach the
// editor, so releasing Shift during Help cannot stick on return.
self.content.as_widget_mut().update(
&mut tree.children[0],
event,
layout,
cursor,
renderer,
clipboard,
shell,
viewport,
);
}
fn draw(
&self,
tree: &iced::advanced::widget::Tree,
renderer: &mut R,
theme: &iced::Theme,
style: &iced::advanced::renderer::Style,
layout: iced::advanced::Layout<'_>,
cursor: iced::mouse::Cursor,
viewport: &iced::Rectangle,
) {
self.content.as_widget().draw(
&tree.children[0],
renderer,
theme,
style,
layout,
cursor,
viewport,
);
}
fn mouse_interaction(
&self,
tree: &iced::advanced::widget::Tree,
layout: iced::advanced::Layout<'_>,
cursor: iced::mouse::Cursor,
viewport: &iced::Rectangle,
renderer: &R,
) -> iced::mouse::Interaction {
if self.help_open {
iced::mouse::Interaction::None
} else {
self.content.as_widget().mouse_interaction(
&tree.children[0],
layout,
cursor,
viewport,
renderer,
)
}
}
fn overlay<'b>(
&'b mut self,
tree: &'b mut iced::advanced::widget::Tree,
layout: iced::advanced::Layout<'b>,
renderer: &R,
viewport: &iced::Rectangle,
translation: iced::Vector,
) -> Option<iced::advanced::overlay::Element<'b, Message, iced::Theme, R>> {
if self.help_open {
None
} else {
self.content.as_widget_mut().overlay(
&mut tree.children[0],
layout,
renderer,
viewport,
translation,
)
}
}
}
+1
View File
@@ -34,6 +34,7 @@ mod source_navigation;
mod source_rename;
mod source_tree;
mod source_workspace;
mod state_label;
mod style;
#[cfg(test)]
mod tests;
+81
View File
@@ -0,0 +1,81 @@
//! Desktop routing uses the same font/shaping defaults as canvas text.
use iced::advanced::{
graphics::text::Paragraph,
text::{self, Paragraph as _},
};
use oa_core::{
Diagram, Id, Project,
projection::ProjectedView,
routing::{self, RoutedView, StateLabelLayout},
};
fn measure_line(line: &str) -> f32 {
let defaults = iced::widget::canvas::Text::default();
Paragraph::with_text(text::Text {
content: line,
bounds: iced::Size::INFINITE,
size: StateLabelLayout::FONT_SIZE.into(),
line_height: text::LineHeight::Absolute(StateLabelLayout::LINE_HEIGHT.into()),
font: defaults.font,
align_x: defaults.align_x,
align_y: defaults.align_y,
shaping: defaults.shaping,
wrapping: text::Wrapping::None,
})
.min_width()
}
pub fn route_diagram(project: &Project, diagram: &Diagram, view: &ProjectedView) -> RoutedView {
routing::route_diagram_with_state_label_measurement(project, diagram, view, &measure_line)
}
pub fn route_edge_preview(
project: &Project,
diagram: &Diagram,
view: &ProjectedView,
baseline: &RoutedView,
edge: Id,
) -> RoutedView {
routing::route_edge_preview_with_state_label_measurement(
project,
diagram,
view,
baseline,
edge,
&measure_line,
)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn wide_glyphs_use_shaped_width_instead_of_character_estimate() {
let wide = "W".repeat(40);
let narrow = "i".repeat(40);
let width = measure_line(&wide);
assert!(width > measure_line(&narrow) * 2.0);
assert!(width > 40.0 * 7.0);
let plan = StateLabelLayout::new(&wide, &wide, &measure_line);
assert_eq!(
plan.size().width,
width + 2.0 * StateLabelLayout::HORIZONTAL_PADDING
);
}
#[test]
fn unicode_fallback_and_combining_text_have_finite_measured_bounds() {
for line in ["漢字 Ελληνικά العربية", "e\u{301} cafe\u{301}", "🙂 🧭"]
{
let width = measure_line(line);
assert!(width.is_finite() && width > 0.0, "{line:?}: {width}");
let plan = StateLabelLayout::new(line, line, &measure_line);
assert_eq!(
plan.size().width,
width + 2.0 * StateLabelLayout::HORIZONTAL_PADDING
);
}
assert!(measure_line("e\u{301}") < measure_line("ee"));
}
}
+110 -151
View File
@@ -25,23 +25,6 @@ pub fn action<'a>(s: &str, m: Message) -> widget::Button<'a, Message> {
.on_press(m)
.style(style::nav)
}
/// Optional instructions belong beside the work, without taking a canvas row.
/// The button also opens keyboard-accessible help; the tooltip is only a preview.
pub(crate) fn diagram_help<'a>(
topic: crate::guide::Topic,
hint: impl Into<String>,
) -> View<'a, Message> {
tooltip(
action("Help · F1", Message::ContextHelp(topic)),
container(text(hint.into()).size(12))
.padding(10)
.max_width(360)
.style(style::card),
tooltip::Position::Bottom,
)
.into()
}
pub fn short(s: &str, limit: usize) -> String {
let s = s.split_whitespace().collect::<Vec<_>>().join(" ");
if s.graphemes(true).count() > limit {
@@ -257,23 +240,11 @@ pub fn view(app: &App) -> View<'_, Message> {
if !matches!(app.page, Page::Home | Page::Text | Page::Guide) {
body = body.push(inspector(app));
}
let diagram_feedback = diagram_feedback(app);
// Keep operation outcomes visible even while a drawing hint is active.
let (status, status_detail) = if app.busy {
("Working…".into(), "Working…".into())
} else if let Some(feedback) = diagram_feedback.filter(|feedback| *feedback != app.status) {
(
format!("{} · {}", short(&app.status, 60), short(&feedback, 80)),
format!("{}\n{}", app.status, feedback),
)
} else {
(short(&app.status, 145), app.status.clone())
};
let footer = container(
row![
container(tooltip(
text(status).size(11).wrapping(widget::text::Wrapping::None),
container(text(status_detail).size(12))
text(short(if app.busy { "Working…" } else { &app.status }, 145)).size(11),
container(text(if app.busy { "Working…" } else { &app.status }).size(12))
.padding(10)
.max_width(600)
.style(style::card),
@@ -296,25 +267,6 @@ pub fn view(app: &App) -> View<'_, Message> {
.padding([4, 16])
.style(style::panel);
let root = crate::allocation_input::root(app, column![header, task_nav, body, footer]);
let root = crate::guide::protect_workspace(app.context_help, root);
if app.context_help {
return modal_width(
root,
column![
row![
text("Diagram help").size(18),
Space::new().width(Fill),
action("Close · Esc", Message::CloseContextHelp),
]
.align_y(iced::Center),
crate::guide::context_view(&app.guide),
]
.spacing(12)
.height((app.window_size.height - 140.).max(300.))
.into(),
(app.window_size.width - 80.).min(900.),
);
}
if app.architecture.as_ref().is_some_and(|s| s.modal()) {
return modal_width(
root,
@@ -410,8 +362,7 @@ pub fn view(app: &App) -> View<'_, Message> {
(app.window_size.width - 32.).clamp(120., 760.),
);
}
// Match modal_width's first child so help does not recreate the editor tree.
widget::stack![root].into()
root
}
fn modal<'a>(base: View<'a, Message>, content: View<'a, Message>) -> View<'a, Message> {
modal_width(base, content, 800.)
@@ -496,7 +447,7 @@ fn diagram(app: &App) -> View<'_, Message> {
.active_diagram
.and_then(|id| app.project().diagrams.get(&id))
.map(|d| d.projection);
let mut modes = row![
let modes = row![
label("View content"),
pick_list(
[
@@ -511,15 +462,7 @@ fn diagram(app: &App) -> View<'_, Message> {
Message::Projection
)
.padding(8)
.text_size(12),
diagram_help(
crate::guide::Topic::Nesting,
if projection == Some(ProjectionKind::Traceability) {
"Shows OA and SA elements with correspondence lines. Place both ends of a trace to show it; port traces use their owner cards. Open Help for trace visibility and editing controls."
} else {
"Shift-click to add or remove selection. Right-click for actions; drag to arrange; scroll to zoom. Drag a connection line, bend or label to move it; Insert adds a bend and Escape cancels. Open Help for full editing controls."
},
)
.text_size(12)
]
.spacing(10)
.align_y(iced::Center);
@@ -612,26 +555,6 @@ fn diagram(app: &App) -> View<'_, Message> {
.center(Fill)
.into()
};
if projection == Some(ProjectionKind::Allocation) {
modes = modes.push(tooltip(
action(
if app.allocation_drag.arrange_next {
"Arrange ✓"
} else {
"Arrange"
},
Message::WorkDrag(crate::app::allocation_drag::Event::ArrangeNext),
),
container(text(format!(
"Arrange next drag · {}. Move work within its current allocation; Escape cancels.",
crate::allocation_input::ARRANGE_SHORTCUT
)))
.padding(10)
.max_width(420)
.style(style::card),
tooltip::Position::Bottom,
));
}
let mut tools = column![toolbar].spacing(8);
if app.active_diagram.is_some() {
tools = tools.push(modes);
@@ -645,50 +568,82 @@ fn diagram(app: &App) -> View<'_, Message> {
.feedback
.as_ref()
.map(|feedback| feedback.destination_identity())
.unwrap_or_else(|| "—".into());
.unwrap_or_else(|| "None · drag work to choose".into());
let inspection = app
.allocation_drag
.feedback
.as_ref()
.map(|feedback| feedback.inspection_identity())
.unwrap_or_else(|| destination.clone());
let destination_control = container(tooltip(
text(format!("Destination: {}", short(&destination, 28)))
.size(13)
.wrapping(widget::text::Wrapping::None),
container(text(inspection).size(13))
.padding(10)
.max_width(420)
.style(style::card),
tooltip::Position::Top,
))
.id("allocation-destination")
.height(26)
.width(Fill)
.clip(true);
tools = tools.push(destination_control);
tools = tools.push(
container(tooltip(
text(format!("Destination: {}", short(&destination, 28)))
.size(13)
.wrapping(widget::text::Wrapping::None),
container(text(inspection).size(13))
.padding(10)
.max_width(420)
.style(style::card),
tooltip::Position::Top,
))
.id("allocation-destination")
.height(26)
.width(Fill)
.clip(true),
);
tools = tools.push(
row![
action(
&format!(
"{} · {}",
if app.allocation_drag.arrange_next {
"Arrange next drag: armed"
} else {
"Arrange next drag"
},
crate::allocation_input::ARRANGE_SHORTCUT
),
Message::WorkDrag(crate::app::allocation_drag::Event::ArrangeNext)
),
label("Drag work into a performer to assign · out to remove assignment")
]
.spacing(8)
.align_y(iced::Center),
);
}
if let Some(diagram) = app.active_diagram {
let view = oa_core::projection::project_view(app.project(), diagram);
if projection == Some(ProjectionKind::Traceability) {
let correspondence_lines = view.edges.iter().filter(|edge| edge.trace).count();
tools = tools.push(
row![
label(format!("{correspondence_lines} trace lines")),
action(
"Add existing elements…",
Message::Architecture(crate::app::architecture_authoring::Event::Existing(
None
))
),
action("Review layer traces", Message::ReviewLayerTraces),
action("View visibility…", Message::Select(diagram)),
column![
label("Shows OA and SA elements together, with correspondence lines alongside ordinary relationships."),
label("Place both ends of a trace to show its line. Port traces use their owner cards; traces between relationships are reviewed on the Traceability page."),
row![
label(format!("{correspondence_lines} correspondence lines in this view")),
action(
"Add existing elements…",
Message::Architecture(crate::app::architecture_authoring::Event::Existing(None))
),
action("Review layer traces", Message::ReviewLayerTraces),
action("View visibility…", Message::Select(diagram)),
]
.spacing(7)
.align_y(iced::Center)
.wrap(),
]
.spacing(7)
.align_y(iced::Center)
.wrap(),
.spacing(4),
);
}
let edge = view.edges.iter().find(|edge| edge.id == app.selected);
let promoted = edge.is_some_and(|edge| {
oa_core::projection::edge_endpoint_placements(
app.project(),
&app.project().diagrams[&diagram],
edge.id,
)
.is_some_and(|(source, target)| source != edge.source || target != edge.target)
});
let selection = app.multiselect_snapshot();
let count = selection.as_ref().map_or(0, |s| s.targets().len());
let mut selection_controls =
@@ -707,62 +662,66 @@ fn diagram(app: &App) -> View<'_, Message> {
}
selection_controls = selection_controls
.push(action(
"Clear",
"Clear selection",
Message::DiagramSelection(crate::app::multiselect::Event::Clear(
snapshot.context(),
)),
))
.push(
label(format!(
"Properties: {} only",
short(app.project().named(app.selected), 14)
"Properties edit only {}",
short(app.project().named(app.selected), 36)
))
.wrapping(widget::text::Wrapping::None),
);
}
// Selection never moves the canvas. General controls live in Help;
// active gesture feedback uses the persistent application status bar.
let hint = if let Some(feedback) = &app.allocation_drag.feedback {
feedback.text.as_str()
} else if let Some(session) = &app.connection {
if session.source.is_some() {
if session.candidates.is_empty() {
"No compatible targets are visible. Expand containers or show an endpoint · Esc cancels"
} else {
"Choose a highlighted target · middle-drag or arrow keys pan · Esc cancels"
}
} else {
session.tool.hint()
}
} else if count > 1 {
if selection
.as_ref()
.is_some_and(|s| crate::app::multiselect::placements(s).is_some())
&& projection != Some(ProjectionKind::Allocation)
{
"Shift-click to add/remove · drag selected to move · right-click for actions · scroll to zoom"
} else {
"Shift-click to add/remove · right-click for selection actions · Esc clears selection"
}
} else if promoted {
"Expand endpoint containers to edit this connection route"
} else if edge.is_some() {
"Right-click for routing · drag line / bend / label · Insert adds a bend · Esc cancels"
} else {
"Shift-click to add/remove · right-click for actions · drag to arrange · scroll to zoom"
};
// Selection changes must not resize the measured canvas or refit its
// camera. Reserve both rows even when no group actions are available.
tools = tools.push(
container(selection_controls)
.height(32)
.width(Fill)
.clip(true),
container(
column![
selection_controls,
label(hint).wrapping(widget::text::Wrapping::None)
]
.spacing(3),
)
.height(56)
.width(Fill)
.clip(true),
);
}
column![container(tools).padding(14), canvas].into()
}
fn diagram_feedback(app: &App) -> Option<String> {
if app.page != Page::Diagram {
return None;
}
if let Some(feedback) = &app.allocation_drag.feedback {
return Some(feedback.text.clone());
}
if let Some(session) = &app.connection {
return Some(
if session.source.is_none() {
session.tool.hint()
} else if session.candidates.is_empty() {
"No compatible targets visible. Expand containers or show an endpoint · Esc cancels"
} else {
"Choose a highlighted target · Esc cancels"
}
.into(),
);
}
let diagram = app.active_diagram?;
let view = oa_core::projection::project_view(app.project(), diagram);
let edge = view.edges.iter().find(|edge| edge.id == app.selected)?;
let (source, target) = oa_core::projection::edge_endpoint_placements(
app.project(),
&app.project().diagrams[&diagram],
edge.id,
)?;
(source != edge.source || target != edge.target)
.then(|| "Expand endpoint containers to edit this connection route".into())
}
fn inspector(app: &App) -> View<'_, Message> {
let p = app.project();
if let Some(target) = app.process_preview_primary() {
-2
View File
@@ -2,8 +2,6 @@
The normative contract is [language.rst](language.rst); [scope.md](scope.md) explains deliberate differences from the complete Arcadia/Capella ecosystem. V2 uses one typed model and one validated mutation boundary across the desktop, text editor and REST service.
Desktop changes follow the [editing workspace UX review criteria](ui-review.md) for concise persistent content, contextual help, visible actionable feedback and native interaction review.
## Crate boundaries
| Crate | Responsibility | Does not depend on |
-27
View File
@@ -1,27 +0,0 @@
# Editing workspace UX review
These development criteria implement the [project goal](../PROJECT_GOAL.md): reduce system engineers' cognitive load, keep graphical editing intuitive, and provide concise, navigable built-in help. They also address the user's request tracked in Gitea issue #39 to prevent persistent instructional text from consuming editing space. They are review criteria, not a claim that any particular build has passed them.
## Persistent content and progressive disclosure
Populated editing workspaces prioritize model content, controls, current state and actionable feedback. General explanations, gesture tutorials and repeated shortcut lists belong in contextual Help, tooltips or explicitly opened details. Do not add permanent instructional paragraphs above a populated canvas merely to explain a feature.
Keep essential control labels and relevant status visible. Offer concise next-step guidance in empty states and while a user is performing a multi-step action. Put longer explanations behind a clearly labeled disclosure near the relevant control or context. Essential instructions must be accessible through an explicit keyboard-reachable route; a hover-only tooltip is insufficient. Reuse the built-in guide for broader modeling explanations.
Distinguish instruction from information needed to act safely. Current errors, pending edits, failed operations, fallback rendering, unavailable actions and recovery steps must remain apparent. Preserve consequential distinctions such as editing a shared definition, changing semantic order rather than saved positions, or applying properties to only one member of a selection. Long diagnostic detail may be disclosed on demand, but its visible summary must identify the problem and a usable next step.
## Stable editing context
Selection changes and gesture feedback must not unexpectedly move or resize the canvas, reset its camera, or change the interpretation of the pointer. Compact existing stable layout slots instead of conditionally removing them when their content is absent. Opening and closing help must preserve the model, selection and pending drafts, and return the user to a usable editing context. Explicitly requested panel changes may resize the workspace; verify their effect on focus and navigation.
## Native review
Exercise the changed workspace in the actual built application at its configured minimum window size and a representative normal size. Include an independent reviewer for material interaction or layout changes, following [the working agreement](../AGENTS.md). Review representative populated models as well as relevant empty, pending, failure and recovery states.
- Inspect whether instructional prose or unused space displaces useful model content. Compare before/after screenshots at the same window size, display scaling, model and panel state when assessing space savings.
- Perform the affected workflow: select, edit, navigate, cancel and recover as applicable. Change between empty, single and multiple selections; exercise affected gestures and inspect camera and pointer stability.
- Find and use the disclosed guidance by keyboard as well as pointer. Check focus, dismissal, return to editing, and preservation of drafts.
- Trigger relevant disabled or rejected operations. Confirm their reason and recovery action remain visible, accurate and reachable.
- Check text, controls, panels and warnings for clipping, overlap, excessive scrolling and lost actions at the minimum size. Do not trade recovered space for unreadable text or unexplained symbols.
Record the tested code version, runtime environment, workflows, observations and representative screenshots in the change's review evidence. Screenshots support layout findings; they do not establish working interaction, accessibility or state preservation. Fix material findings and recheck affected behavior before treating the change as verified.
+6 -23
View File
@@ -1,28 +1,5 @@
# Architectural and product decisions
## Measured label wrapping remains experimental — 2026-10-01
Preserve the isolated E/F prototypes and their
[validation, locked readings and conservation oracles](experiments/wrapped-label-20261001/validation.md)
without promoting either placement rule. E centers two measured lines on the
own stroke; F offsets three lines beside it. Both reduce backing width using
actual Iced shaping and conserve canonical model data and route geometry. F's
first reader still misidentified two exchanges; both readers retained a plausible
wrong conversation ownership. The experiments therefore do not meet dependable
association at Fit, despite correct E endpoint guesses. Separate readers and a
single fixture do not establish causal superiority or general usability.
Keep raw routing distinct from derived presentation during gesture previews:
the adversarial different-edge test exposed stale wrapped bounds after guard
refusal, fixed by retaining the original core RoutedView. This is reusable
architecture evidence, not acceptance of private fixture-specific layout code.
Saved fraction/offset survive under F, but ordinary reopening derives one line;
external profiles cannot provide a production formatting contract. A general
format/layout proposal requires explicit persistence semantics, shared consumer
bounds, native representative workflows and glyph/performance evidence. Further
work should address view scale and ambiguous stroke ownership rather than tune
this same label scene until it looks successful.
## Private source composition decision — 2026-09-23
Adopt the opaque validated original-span rename batch as the next private
@@ -521,3 +498,9 @@ editing remains separate from semantic reconnect. The [decision and evidence
map](edge-attachments-20260922.md) records alternatives, lifecycle rules,
independent falsifiers, evaluators and the Process/Scenario applicability limits.
This is branch-specific work; it does not establish an integrated release.
## External State transition label measurement — 2026-09-24
Issue #36's reproduced collision comes from a two-line title painted in space reserved for one line, with bounds sized from its summary. Adopt one derived hard-line plan measured before routing, shared by paint/hit/preview/focus/SVG. Preserve raw excerpt provenance, authored centers/routes and model/source bytes. Desktop measures with the canvas Paragraph defaults; core retains an explicit approximate fallback. Opaque State label backgrounds own covered hits in reverse paint order while selected handles and group admission retain precedence.
The [contract](state-label-layout-contract.md) is authoritative for exact rules and alternatives. The [verification](experiments/state-label-layout-20260924/README.md) records the width-estimate and generic-hit falsifiers, independent review, scoped Windows outcomes, restored-window input limitation and reasons not to infer universal font or collision-free layout support. Revisit if new ink-overhang, shaping, routing-cost, or authored-occlusion evidence invalidates the bounded design. Dynamic node/row sizing and source/model changes were deliberately excluded.
+39 -46
View File
@@ -1,57 +1,50 @@
# Isolated measured-label experiment checkpoint — 2026-10-01 PDT
# Verified branch checkpoint — State label follow-up
This branch adds the private E/F label experiment at
`d0896ced75fea73bcda6bd14f259a34503840704` to the compact Help foundation below.
[Validation and retained raw evidence](experiments/wrapped-label-20261001/validation.md)
cover actual measured Iced layout, 126 focused tests, native first readings,
selection/edit/Undo/Redo, exact exports and saved-F reopening. An independent
review verified complete Project conservation and unchanged paths/drawing bytes.
Neither candidate established reliable first-reading label ownership, and
ordinary reopening loses the externally selected wrapping. Both remain excluded
from production and releases. This branch is experimental evidence, not an
integrated product checkpoint or complete OA/SA acceptance. Live #38 ownership
and next actions remain in Gitea.
This branch's code through **70bdcdf8fec1728e971cd90ad7f79a1df99777ff** corrects external State transition title/summary layout and measured label hit areas. The [contract](state-label-layout-contract.md) and [verification](experiments/state-label-layout-20260924/README.md) identify exact source, commands, native fixtures, original evidence and limits. Windows focused core68, full desktop1540/7 existing ignores, formatting, strict workspace/all-target Clippy, builds, and six maximized-window B/W/U Save/reopen checks pass. Restored-window coordinate input remains an explicit native-test limitation. This is branch-specific evidence, not merged-main or complete-application acceptance; live integration status is [issue36](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/36).
# Verified Windows source checkpoint — 2026-10-01 PDT
The separate [September24 integrated prerelease](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/releases/tag/v0.2.0-preview.integrated.20260924) is published at **715036e132677dd2bc2fb37ed316d93dc9987aec** with owner publication receipt **76acfb11085ae36bd65971f5f1cf34f45d362ada**. The label follow-up does not replace that tag or its artifacts. Linux remains excluded. Later private analysis branch status must be read from Gitea and that branch, not inferred from this checkpoint.
This branch combines the released integrated foundation
`715036e132677dd2bc2fb37ed316d93dc9987aec` with compact diagram controls and
contextual Help production source `6e7c4ddaf0775198384a8c4882809ea8e14b2976`.
[PROJECT_GOAL.md](../PROJECT_GOAL.md) remains authoritative; complete OA/SA
acceptance is unfinished.
## Historical source checkpoint inherited from715036e — 2026-09-24 UTC
**Linux/WSL builds remain excluded by the user's explicit request.**
The source-preparation statements below describe that earlier checkpoint. Its then-pending prerelease gates were subsequently completed in the publication linked above; its other scoped evidence retains its original code versions.
## Verified capabilities and evidence
This branch assembles peer contributions for the Windows prerelease in issue37.
[PROJECT_GOAL.md](../PROJECT_GOAL.md) remains authoritative. The complete OA/SA
application is unfinished; published previews and finite prototypes are intermediate.
The [frozen integrated Windows preview](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/releases/tag/v0.2.0-preview.integrated.20260924)
provides the accepted 715 foundation and its combined test/package evidence.
It remains unchanged. The older pending-build description previously at the top
of this file is superseded by that published result.
**The current prerelease is Windows-only. Linux/WSL builds and checks remain
excluded by the user's explicit request, including after networking recovers.**
The [compact Help contribution](compact-help-validation-20261001.md) removes
permanent canvas tutorial prose, keeps stable concise selection rows and full
allocation destinations, and supports contextual Help/F1 with keyboard reading,
exact caret/draft preservation and safe gesture retirement. Final focused gates
pass 125 tests; the earlier full-suite result retains its separate source scope.
[Fresh package validation](release-compact-help-validation-20261001.md) verifies
actual extracted desktop/server behavior, Save/Undo/Redo/reopen and complete
source/model oracles. This is a scoped development preview, not complete release
or acceptance of the separately owned follow-up union.
The [scoped compact Help Windows preview](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/releases/tag/v0.2.0-preview.compact-help.20261001)
is published from evidence checkpoint `f1fdca371394aec1148e67f33f4d8c6b53a0c350`.
Its ZIP, checksum and validation attachment were downloaded and matched after
publication; [publication receipts](experiments/compact-help-20261001/publication.md)
retain the exact asset hashes and provenance.
## Assembled source and acceptance boundary
Dense diagrams, remaining Scenario group adapters, quantities/calculations/
constraints, maintained libraries, broad accessibility/DPI and full OA/SA
acceptance remain unfinished. The independent projection/navigation, outgoing-drag,
icon, grid/performance and State-label contributions are outside this code.
A protected Save As destination collision has misleading external-change wording;
[issue 46](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/46)
records it. Files remain protected and normal/fresh-destination recovery is
verified. Live ownership, integration and release coordination remain in Gitea.
Combined code through **4deced53b98cd4d7649ba7aa60fa4b9b30d2f3b8**, plus the
test-only import correction from **7c2b06b63f8a0fe14b3f001996bdf965b36a4e85**, adds the reviewed
Connection/Route early-admission correction to the assembled Scenario/Text,
ordinary/State/Process/Allocation selection, direct drawing, Traceability and
picker changes. The [source handoff](prerelease-integrated-source-20260924.md)
identifies the incorporated commits, exact new test paths and required gates.
The nine event regressions and existing completed-Text-Apply cases are retained.
Direct formatting and whitespace checks pass; this source checkpoint does not
claim combined Cargo, native, packaged or release acceptance. The independent
[event-fix review](reviews/prerelease37-event-admission-20260924.md) found no
further material source defect in its stated scope. A subsequent peer compile
found a missing `projection::` qualification in the new Route test helper;
the current code includes that one-line correction. The original compile failed
before running tests. The first combined compile at `897d9f04` subsequently
found a missing `text_editor` import in the Allocation Text Apply regression;
the current source includes that one-line correction too. Both failures remain
recorded in the source handoff. The subsequent full test run at `8ddfadf4`
failed the mounted State picker fixture: added selection controls invalidated
its canvas-relative clicks. Source successor `a9cd364eacbbffa0693bab05b5a2b65f9d105535`
measures an identified fixed-height picker slot and checks Escape capture,
retaining the exact preservation/reopen/Place/Undo assertions. The source
handoff links the preserved failed and interrupted attempts. Corrected combined
Windows execution and package acceptance remain pending.
Live build, final-source and publication results belong in
[issue37](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/37).
Human workflows are described in [the preview checklist](../docs/preview-human-checks.md).
Private mixed-parser source is excluded from this application candidate.
## Contribution-specific verification
-34
View File
@@ -1,34 +0,0 @@
# Compact diagram controls and contextual help
Branch-specific work for [issue 39](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/39), based on published preview source `715036e132677dd2bc2fb37ed316d93dc9987aec`.
This record does not accept the complete first release or the other diagram defects.
## Problem and choice
The user's screenshot showed two permanent Traceability explanation paragraphs and a separate generic gesture-hint row. Direct Windows inspection of the released water-pressure example reproduced these. At a 1100×700 client size (1102×732 captured window), the Traceability canvas began around window y=470 and ended around y=692, leaving about 220 pixels for modeling. At the normal 1440×900 client size its top was around y=417. The release was opened from the existing downloaded package; only an in-memory projection switch was made and Undo restored the clean model before closure.
The candidate moves general instructions into contextual Help, reusing the offline guide. Architecture, State and Process selection bars use a stable compact row. Allocation retains its full-width destination slot; a concise Arrange control sits beside the existing view-content and Help controls. Traceability retains its displayed-line count and existing actions. Active drawing/assignment feedback appears beside the operation outcome in the persistent status bar, with full text on hover. Operation errors must never be replaced by generic guidance.
Help opens as an overlay and closes with Close or Escape. F1 opens the relevant diagram topic. The workspace, selected group, pending source/property/behavior drafts and camera remain owned by their existing state. Background user commands are rejected before specialized canvas/reference dispatch. Passive results retain their established validity checks. The editor remains the first child of a stable Stack while Help opens and closes.
Rejected alternatives: ordinary navigation to the Guide page cleared selection and could reject Help while a behavior draft was pending; placing feedback beside the entire selection toolbar exhausted narrow-window width; unconditional status substitution hid operation failures. Independent source review identified these before acceptance. Hover-only help was rejected because the complete instructions need a keyboard-accessible route.
[Editing workspace UX review](../docs/ui-review.md) is the development/review contract requested by the user. It covers persistent prose, actionable feedback, context preservation and independent native interaction checks.
## Verification status
Clean source `f83068757af885572f6b3f932d07233dd1b94b7e` passed `cargo build -p oa-desktop --locked` on Windows gnullvm. Its candidate executable SHA-256 is `c1a9b196ec03e86f049fa2aadb2b86bfcaa3f0fbae582a80ee39ee8adf0758e3e`. The [independent source review](compact-context-help-source-review-20260925.md) records the corrected source findings, including passive viewport updates while Help is open.
Independent native review of that executable recovered approximately 61 pixels in normal Traceability, 114 pixels in minimum Traceability and 58 pixels in minimum Allocation. Help resizes, pointer-scrolls, selects the State topic, and closes through Close/Escape. The review also reproduced two acceptance failures: PageDown cannot scroll Help, and F1/Escape preserves a property or Process-creation draft but loses typing focus/caret continuation. These findings require correction and another native check; model-state unit tests alone do not cover internal widget focus. The idle State-canvas gesture sentence is also removed in the successor; active/pending and hovered-item feedback retain their stable slot.
The initial focused test run passed nine and failed one: the allocation test fixture used the default Overview projection before asserting allocation ownership. A separate ten-case mounted geometry run passed nine and failed the destination's existing 400-pixel minimum-width check. Sharing its row with the verbose Arrange action reduced that slot to 328 pixels at minimum size. The successor fixes the fixture explicitly and restores the full destination row without weakening its width check. The original failed logs are preserved in the [native/test evidence](experiments/compact-help-20260925/README.md). These diagnostic runs began before the successor edits and are not frozen-source acceptance of those edits.
Frozen successor `5657a996ed2cefb1fa84ef967b655eaf8f9f6817` passed formatting, strict all-target desktop Clippy and the Windows GUI build. The full desktop run passed 1,538 tests, ignored seven and failed one new mounted Help test before Help opened: its synthetic multi-character KeyPressed event inserted only the first character, as the actual Iced text input specifies. The final correction sends individual character events and retains the exact-caret, scrolling and IME assertions. The existing allocation width and ownership checks and new modifier/pointer cancellation checks passed. See the [preserved successor evidence](experiments/compact-help-20260925/candidate-5657/review.md) and logs; the failed run is not reported as a passing suite.
Independent native review of that exact executable confirmed keyboard Help scrolling, precise Inspector and Process-draft caret continuation after Help, resize, retained State tool state and complete allocation-error tooltips. Minimum Allocation recovers approximately 64 pixels with the full destination slot; minimum Traceability recovers 114 pixels. The reviewer found no new blocker within that scope.
Final source `6e7c4ddaf0775198384a8c4882809ea8e14b2976` passes formatting, strict desktop/all-target Clippy, GUI build and 125 focused Help/allocation/guide tests (zero failures/ignores). The corrected mounted caret test now executes its complete assertions. Unchanged evidence from the earlier full run is retained at its original source; the remaining 1,421 desktop cases were not rerun at the final source. The initial final GUI link failed when the disk filled; after the user expanded the disk, the same-source rebuild passed. The failed log remains preserved.
The [final native report](experiments/compact-help-20260925/candidate-6e7c/review.md) directly verifies cancellation status, guide wording, native group selection through context menus, primary Inspector changes, long-name controls at minimum size, exact caret return after both Help dismissal routes, and Apply/Undo/Redo/Undo recovery. Independent source review found no blocker in the final small delta. The watcher records exit 0 and empty stdout/stderr; all 37 copied model files still match the original after closure. An early transient OSK/modifier obstruction occurred before model loading and is recorded separately from app behavior. No blocking defect was found within this contribution's review scope. Shared integration and release admission remain in issue 39; full product completion is not claimed.
Required native checks: minimum and normal windows; Traceability and Allocation space comparison; multi-selection with long names; Help/F1/Close/Escape with property and behavior drafts; editor focus and canvas scroll/camera restoration; active feedback plus operation failure; State and Process controls; subsequent edit/Undo/Redo and source preservation. Linux remains deferred under the recorded user instruction.
@@ -1,44 +0,0 @@
# Compact contextual help: independent source review
Review date: 2026-09-25. Scope: Gitea issue #39 compact editing chrome and contextual Help, reviewed against base `715036e1` and the issue screenshot. Reviewed source includes `e0812b3932fbb36100516f0981dc9c646eeda56d` plus the subsequent local passive-geometry admission patch and regression test in this change. This is source-review evidence, not native acceptance or executed test evidence.
Criteria: [editing workspace UX review](../docs/ui-review.md), especially preserving pending edits and selection, stable canvas geometry, accessible disclosure, and retaining actionable feedback.
## Findings addressed in source
- The initial Help action used ordinary page navigation, clearing multiselection and selected bends, including before a pending behavior form rejected navigation. Contextual Help now overlays the existing workspace. Close/Escape changes reading state without navigating or applying drafts.
- App-level modal admission originally ran after allocation and reference-picker fast paths. Help now gates user messages at the beginning of `App::update`; allocation and behavior keyboard ownership are also disabled while Help is open.
- Combining live gesture feedback with multiselection controls could leave no width for feedback at the configured minimum window size. Selection controls now keep a compact, fixed-height row; current drawing/allocation feedback uses the existing application footer.
- Footer feedback initially replaced operation status, concealing errors while a promoted edge or drawing tool remained selected. The footer now retains operation status alongside feedback and exposes complete text in its tooltip.
- Conditional modal wrapping could recreate the editor widget tree. Both closed and open states now use the same outer Stack with the workspace as its first child.
- State/Process selection guidance removed from persistent chrome was missing from its target Help articles. The States and Chains articles now include group selection, primary-properties semantics and relevant tool/read-only guidance.
- The new early modal gate initially rejected passive behavior viewport/scroll notifications. It now admits Process/Scenario geometry and State viewport notifications to their existing context-validated handlers, preventing resize observations from being lost while Help is open.
## Regression coverage added
[`context_help_tests.rs`](../crates/oa-desktop/src/app/context_help_tests.rs) covers property drafts and multiselection, source drafts, pending state-transition forms, blocked background actions, contextual Help topic dispatch, Close/Escape, allocation input ownership, queued inspector reference-picker admission, and valid/stale Process viewport measurements during Help and after closing. Assertions include accepted-model snapshot identity and absence of history changes where applicable. Passive geometry intentionally validates document/owner/revision; stale pointer epochs alone do not invalidate measurements.
The reviewer did not compile or execute these tests. Suggested focused command: `cargo test -p oa-desktop context_help_tests`. The integration owner records actual execution and native results separately.
## Follow-up from native review
Native review of the subsequent candidate found that contextual Help did not respond to PageDown and that Escape reached a focused underlying text input, dropping its typing focus. The follow-up patch adds a Help-only keyboard subscription and article-ID-targeted scrolling (40-pixel arrows, 90% of the actual viewport for PageUp/Down, Home/End), using Iced's bounds-clamped scroll state. A stable workspace input barrier preserves the actual editor caret while suppressing key, pointer, touch and IME input behind Help; modifier changes and passive geometry continue. Opening Help retires held pointer gestures through cancellation releases with all authored actions discarded, while forwarding redraw/layout invalidation. This also prevents a held canvas pan or text selection from resuming after release behind Help.
New mounted regressions exercise the production App tree and subscriptions for keyboard scrolling, unchanged background scroll positions, precise Inspector caret return, IME exclusion, Shift release, and held-pan retirement. A real text-input widget regression checks selection-drag retirement while preserving its caret. The allocation ownership fixture was corrected to explicitly request Allocation, because `ensure_diagram` creates Overview. These follow-up changes were formatted and source-reviewed here; compilation, execution and native acceptance remain the integration owner's checks.
A second, read-only critic reviewed the follow-up independently of its implementation. It found and prompted corrections for stale modifiers, IME leakage and interrupted pointer gestures. Its final read found no further blocking source defect in the input barrier, cancellation, passive-event handling or relocated Arrange control. The separate native reviewer supplied the original keyboard/focus failures. Neither source review establishes executed or native acceptance of the successor.
## Scope and remaining verification
A final independent read-only source review covered the small post-`5657a996`
delta. It confirmed that the mounted typing fixture must send one KeyPressed per
character because Iced consumes the first scalar, with the original caret/IME
assertions retained. Arrange cancellation now replaces only its own obsolete
armed status, preserving unrelated errors; input epochs and model commands are
unchanged. The guide names the actual Arrange control. No blocking finding was
identified in that delta. Actual executed and native evidence remains separately
identified by source in the design record and evidence index.
Production changes reviewed: desktop App messages/admission, allocation input ownership, Escape bridging, behavior keyboard ownership, architecture/State/Process toolbar layout, guide article disclosure and footer feedback; supporting architecture/UI-review documentation. Regression tests and this record are review artifacts. No model schema, persistence format or authored-model transformation is introduced.
No further concrete source blocker was identified after the fixes above. Native checks remain necessary at 1100×700 and a representative normal size: Help discovery and keyboard reading/dismissal, focus and caret return, preservation of canvas camera/selection and form drafts, resize while Help is open, multiselection control visibility, allocation refusal/destination feedback, current operation failures, and stable canvas bounds through selection/gesture changes. Source inspection and App tests do not establish layout quality, keyboard scrolling, pointer behavior or usability.
@@ -1,41 +0,0 @@
# Compact diagram Help: Windows validation
The source contribution for [issue 39](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/39)
is based on released `715036e132677dd2bc2fb37ed316d93dc9987aec`; final production/test
source is `6e7c4ddaf0775198384a8c4882809ea8e14b2976`. It removes permanent canvas
instructions, preserves compact stable controls and offers contextual Help/F1.
Model schema, core, server, dependencies and persistence code are unchanged.
[Decision and acceptance boundary](compact-context-help-20260925.md),
[independent source review](compact-context-help-source-review-20260925.md),
[native reports, screenshots and gate logs](experiments/compact-help-20260925/README.md)
and [development UX criteria](../docs/ui-review.md) are authoritative for this change.
Windows gnullvm / Rust 1.98.1: formatting, strict desktop/all-target Clippy and the
GUI build pass. Final focused run: **125 passed, zero failed/ignored**. Earlier
full desktop execution at `5657a996` passed 1,538, failed one new test's typing
setup and ignored seven; the corrected test executes fully in the final passing
run. This is not a claim of a full-suite run at the final commit. The initial
final link failed with a full disk and is retained; the recovered build succeeds.
Final Studio SHA256:
`d55ecad4b0f75c0c9c26625e5441bef9c9360890b65bc13236c6ebfaf03d631e`.
Matching runtime SHA256:
`f45604a12e8bcd839fd86f667c1be1cc7c4f9da2b3c69ff381ac708f0e1ae7d4`.
Independent native checks pass group selection/primary properties, Help dismissal
and exact caret continuation, long names at 1100×700, Arrange cancellation,
guide consistency and Apply/Undo/Redo/Undo. Earlier versioned native checks cover
Process drafts, State tools, Help resize and actual operation refusals. Minimum
Allocation recovers about 64 pixels; minimum Traceability about 114 pixels.
Final process exit is 0, both logs are empty, and all 37 copied example files
remain unchanged. Native counts do not establish whole-Project equality; mounted
regressions provide the separately scoped model/history checks.
The application remains an unfinished development preview. The separate
projection/navigation, outgoing-drag, icon, grid/performance and State-label
contributions are outside this source. Dense routes/labels, remaining Scenario
group adapters, quantities/calculations/constraints, maintained libraries,
complete OA/SA acceptance and broad accessibility/DPI coverage remain unfinished.
Linux/WSL checks remain excluded by the user's recorded instruction. This change
does not accept the complete first release.
@@ -1,62 +0,0 @@
# Compact Help native evidence
Branch-specific evidence for [issue 39](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/39).
The [design record](../../compact-context-help-20260925.md) owns the decision and current acceptance boundary.
`native/` contains the Windows baseline captures from published source
`715036e132677dd2bc2fb37ed316d93dc9987aec`.
`candidate-f830/` preserves the independent review of source
`f83068757af885572f6b3f932d07233dd1b94b7e`, including its two failed Help workflows,
original screenshots, exact executable/runtime hashes and successful build log.
These observations must not be relabeled as acceptance of a successor executable.
`candidate-5657/` preserves the next frozen source's build, strict all-target
Clippy, full desktop test log and independent native review. Formatting, Clippy
and build passed. Tests: 1,538 passed, one failed, seven ignored. The sole failure
was the new caret test's synthetic typing setup before Help opened; `help-failure.log`
records its exact rerun. The next correction uses one character per key event.
The native report records corrected Help keyboard/caret behavior, minimum-window
layout and real operation-refusal feedback, with explicit scope limitations.
Copied text logs have normalized line endings and trailing blank lines removed;
original local logs are retained. Image and fixture hashes are unchanged.
`candidate-6e7c/` preserves final source
`6e7c4ddaf0775198384a8c4882809ea8e14b2976`: formatting and strict desktop/all-target
Clippy pass, the recovered GUI build passes, and 125 focused Help/allocation/guide
tests pass with zero failures/ignores. `build-diskfull.log` preserves the first
failed link; no code change was needed for the recovered build. Its native report
and 15 screenshots cover cancellation, guide consistency, group/primary selection,
minimum-window long names, exact caret return and Undo/Redo/Undo. The runtime
receipt confirms exit 0 and empty logs. Post-close baseline comparison confirms
all 37 copied fixture files unchanged. The transient OSK observation happened
before loading the model and is explicitly retained. Prior source-specific
workflows remain attributed to their actual binaries.
Reproduce final code checks on the documented Windows gnullvm/Rust 1.98.1 toolchain:
```powershell
cargo fmt --all -- --check
cargo clippy -p oa-desktop --all-targets --locked -- -D warnings
cargo build -p oa-desktop --locked
cargo test -p oa-desktop --locked -- context_help_tests allocation_drag guide::tests --test-threads=1
```
The initial test compilation began at that commit; successor work was edited
while it ran. `tests.log` (nine passed, one failed fixture precondition) and
`geometry-tests.log` (nine passed, one failed destination-width invariant) are
diagnostic evidence from that cycle, not frozen-source acceptance. The geometry
run reused its test executable without recompiling. The first command's
`allocation_drag_full_tree_tests` filter matched no tests; the second used the
actual `full_tree` filter plus the affected mounted State/Process checks.
The review used a copy of `examples/release1/project.arcadia` from the published
Windows package. All 37 fixture files matched the baseline before the trial and
again after closing without saving. `baseline-proof.json` records those bytes.
The executable is a local development build, not a published release artifact.
Reproduce the build using the documented Windows gnullvm toolchain and
`cargo build -p oa-desktop --locked`. Place its matching `libunwind.dll` beside the
executable, launch it, and open an isolated copy of the release1 example. Perform
the workflows and use the window sizes in [the native report](candidate-f830/review.md).
The baseline captures establish layout comparison; the report records actual
interaction results and explicit unverified workflows.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

@@ -1,49 +0,0 @@
{
"baseline_binary": "2c03bd6cc3f1110c219e4f57ab94874a121590f83779239a93289b7170664399",
"baseline_source": "715036e132677dd2bc2fb37ed316d93dc9987aec",
"model_files": {
"evidence/repair-check.md": "f4db17bdca4ecbb1bf0caef01b2da5f1f7f798ab3152b648ce6dd8696a6a68e5",
"expected-diagnostics.json": "3700393d76b940cfc076bf52861bd7b1f43370f8eabce3594531bd0bf1fc851e",
"model.json": "ef0ef4006c3e09d5db6e1b621256b3f7d6642f3a7b09cc34607cfbcca830c727",
"model.rs": "ddc2d92b0d7699a4cadfbb35ae379f0a68d17f4f5d7df82b4b1afcf8d5425fbe",
"oa/activities/activity_oa_restore_work.arcadia": "21cbd7176af8fad68453306f2371ff03e127a994b8796cdf044567332de9686f",
"oa/behavior/process_oa_assessment_procedure.arcadia": "23cabc213c264a16c8595414db6acb09248c1cef9cd699f1b0316e5bb82c062a",
"oa/behavior/process_oa_field_procedure.arcadia": "9c52086759b7344b4809ceb8d372f65647b16fc24153a03b887faa378c37fe96",
"oa/behavior/process_oa_response.arcadia": "675798bd19e6b40d03e7076b0e59b110cdaaab7b6d16c47c3ac80fa960072e84",
"oa/behavior/scenario_oa_conversation.arcadia": "e217e5394a0771dc16206ed9437a231da27905d2f19be64b3f48281c0a32fb6b",
"oa/behavior/scenario_oa_full_scenario.arcadia": "c5a285f2d7c61bd2a136107f267fbf9cddb1cba3f63ff36a6f53f7ab98f33df5",
"oa/behavior/state_machine_oa_monitor.arcadia": "e7349e1e5336282eed3f5a103129db33d3ae4ed500788ee7129e8fc193ac57f6",
"oa/capabilities.arcadia": "26a3d9b615a3251ff010e0b47127f2d16bc2dcd45ed95967208b0076d725843a",
"oa/model.arcadia": "069a5eaaf525089935cc9d73ae7b916866ed78c6534705d75739650ecdea7ada",
"oa/participants.arcadia": "591a75a9ecad280302be4d4ae0171ad616377ed11ead5e233848ca2dc0a71819",
"oa/types.arcadia": "f02c391d584674c879f662a418abba3a220f1fee88471ca49322ac9873de628d",
"project.arcadia": "b2674e6bf77cfe0f6f0ba79c81d2e96d92f39c02ca2c6266d80e91723bfb9fda",
"README.md": "113cfb1cf38a98b51bff60442d86a35d636a3d80ef206bece7d53d0aae67f2d5",
"sa/behavior/process_sa_assessment_procedure.arcadia": "5c414fbdaabf9f9e402b0441fcacf1cacf4dbbc6c822162f028de35abf59be2d",
"sa/behavior/process_sa_field_procedure.arcadia": "ece846fdf93857e71a9ab0efcbdf64a5c41c71180f62afa3f79077fffb53b8f2",
"sa/behavior/process_sa_response.arcadia": "af7fdda280a917cf626f6e077162d481f9aaad280f8e81330c07d7fe384b1c52",
"sa/behavior/scenario_sa_conversation.arcadia": "01339699ec3ee409418d9bb232542f2bcd9419f1e67b183e77700c56bb9f71d2",
"sa/behavior/scenario_sa_full_scenario.arcadia": "5dce6b00a3a441162e8dee3e23d9ca5ab7bed4a24de669b1fba03664a3086dda",
"sa/behavior/state_machine_sa_monitor.arcadia": "17dbcfa5bbfd10fc8e23a325fc950ce853c219b4aa89c74f96278cbb3f34acc8",
"sa/capabilities.arcadia": "81706a0ca9d7db2aa0350888b9c00d853885185db2e6b90557d3d51a11c3d645",
"sa/functions/function_sa_audit_thresholds.arcadia": "27f798f78f36e72b38edab3725af2feb0eaa010fd52a60b5c6b6bef57ad3b686",
"sa/functions/function_sa_restore_work.arcadia": "357c6acb80f86b4e8d8f5c98f9f79d140f85fbe09f3406b41b7ac6eba464ec8c",
"sa/model.arcadia": "805b90262e27090ae7da81a51bcefa49c97fb0b3d3220b4a72323b4c4351c395",
"sa/participants.arcadia": "ca144d6a8f45fe720b5d18c7b59c7671444baa8c37e5ce9117bcba34b3a6aa84",
"sa/types.arcadia": "540ddbc2bcd0ccf45298e3ea5660637341aff63ff65fd87ac2f26469d1adc064",
"traceability.arcadia": "474bd28d955ff7af7722f6e9a23220d816879e3f46202e79a233544b9c593116",
"transition-before.json": "2253e6434f741687e22327c37d520ed15c043bc36025498650bc2366bb6a874d",
"transition-request.json": "43b9a22e5f95ad3bc0ebd2478ead0e14406854abc989ae94ded9367b013d812a",
"views/diagram_oa_allocation_view.arcadia": "c45d7467839219d894804c1ef2d22ff4d4a5a84a6a273c526bafd4c1facde624",
"views/diagram_sa_allocation_view.arcadia": "352a3ca745517592b5c9b1239b5770f62f0466a329a91fd03457ef2b53c06ed6",
"views/diagram_sa_capability_view.arcadia": "8f18fcccbcddcf3c1ea0ffe727b5b23b77fc148c5da4fde953abe681e4c20cd2",
"views/diagram_sa_service_view.arcadia": "4c72cb7593d9c4be8d2600b0656a7a3a6ce84c45bb2f3e58a4ee5ae3bf91913c",
"views/diagram_sa_state_view.arcadia": "dd1bea81ac7dc549a53f9b190be6f13052e00ede345bd180444cc31edb892230"
},
"matching_files": 37,
"baseline_captures": {
"baseline-allocation-compact.png": "d92a0cca62a038dcf0894d92b37a64028342c2365e3fb8880ed597222123d96f",
"baseline-trace-compact.png": "b608a3d75612d8c06aacc094a7aebd12a0798ce30f2126c00bc3ad61a9103217",
"baseline-trace-normal.png": "6dfb6c595af4247aab3600da0e0a25ba4b11151436e9fc4a406f1036053f71d0"
}
}
@@ -1,6 +0,0 @@
{
"buildExit": 0,
"runtime": "F45604A12E8BCD839FD86F667C1BE1CC7C4F9DA2B3C69FF381AC708F0E1AE7D4",
"source": "5657a996ed2cefb1fa84ef967b655eaf8f9f6817",
"binary": "83CCEFF8B713491AFEE92FFCAFE62B02F5EEA6A3D899F6F334848FDC7BB0D88D"
}
@@ -1,2 +0,0 @@
Compiling oa-desktop v0.2.0 (C:\ar-compact-01a0d717\crates\oa-desktop)
Finished `dev` profile [unoptimized] target(s) in 2m 12s
@@ -1,6 +0,0 @@
Compiling oa-core v0.2.0 (C:\ar-compact-01a0d717\crates\oa-core)
Checking iced_widget v0.14.2 (C:\ar-compact-01a0d717\crates\vendor\iced_widget)
Compiling oa-server v0.2.0 (C:\ar-compact-01a0d717\crates\oa-server)
Compiling oa-desktop v0.2.0 (C:\ar-compact-01a0d717\crates\oa-desktop)
Checking iced v0.14.0
Finished `dev` profile [unoptimized] target(s) in 4m 09s
@@ -1,16 +0,0 @@
running 1 test
thread 'app::context_help_tests::mounted_context_help_keyboard_scroll_preserves_inspector_focus_and_exact_caret' (7368) panicked at crates\oa-desktop\src\app\context_help_tests.rs:389:5:
assertion `left == right` failed
left: "DSend"
right: "DRAFT Send"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test app::context_help_tests::mounted_context_help_keyboard_scroll_preserves_inspector_focus_and_exact_caret ... FAILED
failures:
failures:
app::context_help_tests::mounted_context_help_keyboard_scroll_preserves_inspector_focus_and_exact_caret
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1545 filtered out; finished in 1.56s
@@ -1,32 +0,0 @@
# Independent native successor review
Reviewed source `5657a996ed2cefb1fa84ef967b655eaf8f9f6817`; executable SHA-256 `83CCEFF8B713491AFEE92FFCAFE62B02F5EEA6A3D899F6F334848FDC7BB0D88D` independently rechecked after the run; runtime SHA-256 `F45604A12E8BCD839FD86F667C1BE1CC7C4F9DA2B3C69FF381AC708F0E1AE7D4` from build.json. Used Windows native Computer Use, the isolated `model/project.arcadia`, normal 1440x900 and minimum 1100x700 client sizes (1442x932 and 1102x732 captures). The prior candidate report remains historical under `../candidate-f830/review.md`.
## Result
Both prior blocking native findings are corrected in the exercised workflows. No new blocking finding was observed in this bounded retest. This is not complete product, accessibility, multiselection or first-release acceptance.
### Help keyboard reading and caret preservation
1. In normal Allocation, focused inspector Name, selected its text, typed `LEFT RIGHT`, and pressed Ctrl+Left to put the caret before `RIGHT`. Opened Help with F1. PageDown visibly scrolled to lower sections; PageUp returned to the top; End reached the bottom; Home returned to the top; Down moved one increment and Up reversed it. Evidence: `02-help-pagedown.png`, `03-help-end.png`.
2. Pressed Escape, then typed `X` without refocusing. Name became exactly `LEFT XRIGHT`. Reopened with F1, clicked visible Close, then typed `Y` without refocusing. Name became exactly `LEFT XYRIGHT`. Thus keyboard reading did not move the background caret, and both dismissal paths preserved input continuation. Evidence: `04-caret-after-escape.png`, `05-caret-after-close.png`. Revert restored the accepted property.
3. Opened Help again and resized the native window to its minimum width and height through the native system menu. Help reflowed with Close reachable; End still reached the bottom and Escape returned to the same diagram. Evidence: `06-help-minimum-resized.png`.
4. At minimum size, opened System functional chain `Handle a pressure alarm`, chose W, clicked blank canvas, and entered `LEFT RIGHT` in the pending contribution Name. Ctrl+Left, F1, End, Escape, then `X` produced exactly `LEFT XRIGHT` without refocusing. Create remained disabled with its missing-source explanation and Cancel reachable. Cancel preserved the accepted model. Evidence: `15-process-caret-restored.png`.
### Compact controls and actionable feedback
- Normal and minimum Allocation show projection, Help and Arrange together, with a separate full-width Destination slot. At minimum size the canvas begins near y=350 versus baseline y=414, approximately 64 pixels recovered. Changing from no selection to a selected work card and exercising refused drags did not move the canvas boundary. Evidence: `01-allocation-normal.png`, `07-allocation-minimum.png`.
- Clicking Arrange displays `Arrange ✓`; the tooltip explains one-drag scope, Alt+A and Escape. Escape removes the check; Alt+A arms it again. Evidence: `08-arrange-tooltip-armed.png`.
- With Arrange armed, dragged `Assess pressure alarm` from Control room toward Field technician. The operation was refused with the visible footer message `Make room or adjust the view, then drag again. Zoom in to read the work and destination.` The accepted model remained saved and the work stayed allocated to Control room. Evidence: `09-arrange-refusal.png`.
- Repeated the drag without Arrange. Core validation refused the reassignment with `exchange_allocation_performer: Actual activity allocations must agree with one permitted communication direction; review the means or the activity allocations.` The shortened footer remained visible, and pointing at it exposed the complete readable explanation. The selected activity and accepted model remained unchanged. Evidence: `10-assignment-refusal.png`, `11-refusal-tooltip.png`.
- Changed View content to Traceability. Count, Add existing elements, Review layer traces, View visibility and Help all remain reachable at minimum width. Canvas starts near y=356 versus baseline y=470, approximately 114 pixels recovered. Undid this temporary projection change. Evidence: `12-trace-minimum.png`.
- Opened saved State view `5 · SA pressure supervision`: the generic idle canvas instruction is removed. Choosing +Region still shows its active creation prompt. F1 opens the States topic; Escape returns with +Region still selected, without creating an object. Evidence: `13-state-idle.png`, `14-state-active-prompt.png`.
## Limitations and minor observations
- The existing State active prompt still truncates at minimum width (`Create Region ... machine or composite s...`). This retest confirms it was retained, not that every pre-existing State prompt has complete narrow-window readability.
- The compact control says `Arrange`, while the guide still says `Arrange next drag`; its tooltip explains that wording. Minor consistency cleanup was reported to the integration owner; no user workflow failed because of it.
- Modifier-click/native multiselection and long-name group toolbar layout were not independently operated because the supported Computer Use API has no modifier-click/key-hold operation. Do not infer them from the single-selection screenshots. The parent owns mounted-widget verification separately. Source-editor caret behavior and full Scenario workflows were not repeated in this bounded successor retest.
- The approved native launch API does not expose stdout/stderr or process exit status. After Alt+F4, refreshed native window enumeration confirmed both successor application and console windows disappeared. No crash dialog was observed; this is not an asserted exit code or log inspection.
No save was performed. A post-run hash comparison against baseline-proof.json found no changed files among all 37 copied fixture files. The UI returned to the saved baseline with 94 objects, 62 links and one model check before closure. Screenshots are supporting evidence; the results above describe actual input and observed responses.
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

@@ -1,49 +0,0 @@
{
"baseline_binary": "2c03bd6cc3f1110c219e4f57ab94874a121590f83779239a93289b7170664399",
"baseline_source": "715036e132677dd2bc2fb37ed316d93dc9987aec",
"model_files": {
"evidence/repair-check.md": "f4db17bdca4ecbb1bf0caef01b2da5f1f7f798ab3152b648ce6dd8696a6a68e5",
"expected-diagnostics.json": "3700393d76b940cfc076bf52861bd7b1f43370f8eabce3594531bd0bf1fc851e",
"model.json": "ef0ef4006c3e09d5db6e1b621256b3f7d6642f3a7b09cc34607cfbcca830c727",
"model.rs": "ddc2d92b0d7699a4cadfbb35ae379f0a68d17f4f5d7df82b4b1afcf8d5425fbe",
"oa/activities/activity_oa_restore_work.arcadia": "21cbd7176af8fad68453306f2371ff03e127a994b8796cdf044567332de9686f",
"oa/behavior/process_oa_assessment_procedure.arcadia": "23cabc213c264a16c8595414db6acb09248c1cef9cd699f1b0316e5bb82c062a",
"oa/behavior/process_oa_field_procedure.arcadia": "9c52086759b7344b4809ceb8d372f65647b16fc24153a03b887faa378c37fe96",
"oa/behavior/process_oa_response.arcadia": "675798bd19e6b40d03e7076b0e59b110cdaaab7b6d16c47c3ac80fa960072e84",
"oa/behavior/scenario_oa_conversation.arcadia": "e217e5394a0771dc16206ed9437a231da27905d2f19be64b3f48281c0a32fb6b",
"oa/behavior/scenario_oa_full_scenario.arcadia": "c5a285f2d7c61bd2a136107f267fbf9cddb1cba3f63ff36a6f53f7ab98f33df5",
"oa/behavior/state_machine_oa_monitor.arcadia": "e7349e1e5336282eed3f5a103129db33d3ae4ed500788ee7129e8fc193ac57f6",
"oa/capabilities.arcadia": "26a3d9b615a3251ff010e0b47127f2d16bc2dcd45ed95967208b0076d725843a",
"oa/model.arcadia": "069a5eaaf525089935cc9d73ae7b916866ed78c6534705d75739650ecdea7ada",
"oa/participants.arcadia": "591a75a9ecad280302be4d4ae0171ad616377ed11ead5e233848ca2dc0a71819",
"oa/types.arcadia": "f02c391d584674c879f662a418abba3a220f1fee88471ca49322ac9873de628d",
"project.arcadia": "b2674e6bf77cfe0f6f0ba79c81d2e96d92f39c02ca2c6266d80e91723bfb9fda",
"README.md": "113cfb1cf38a98b51bff60442d86a35d636a3d80ef206bece7d53d0aae67f2d5",
"sa/behavior/process_sa_assessment_procedure.arcadia": "5c414fbdaabf9f9e402b0441fcacf1cacf4dbbc6c822162f028de35abf59be2d",
"sa/behavior/process_sa_field_procedure.arcadia": "ece846fdf93857e71a9ab0efcbdf64a5c41c71180f62afa3f79077fffb53b8f2",
"sa/behavior/process_sa_response.arcadia": "af7fdda280a917cf626f6e077162d481f9aaad280f8e81330c07d7fe384b1c52",
"sa/behavior/scenario_sa_conversation.arcadia": "01339699ec3ee409418d9bb232542f2bcd9419f1e67b183e77700c56bb9f71d2",
"sa/behavior/scenario_sa_full_scenario.arcadia": "5dce6b00a3a441162e8dee3e23d9ca5ab7bed4a24de669b1fba03664a3086dda",
"sa/behavior/state_machine_sa_monitor.arcadia": "17dbcfa5bbfd10fc8e23a325fc950ce853c219b4aa89c74f96278cbb3f34acc8",
"sa/capabilities.arcadia": "81706a0ca9d7db2aa0350888b9c00d853885185db2e6b90557d3d51a11c3d645",
"sa/functions/function_sa_audit_thresholds.arcadia": "27f798f78f36e72b38edab3725af2feb0eaa010fd52a60b5c6b6bef57ad3b686",
"sa/functions/function_sa_restore_work.arcadia": "357c6acb80f86b4e8d8f5c98f9f79d140f85fbe09f3406b41b7ac6eba464ec8c",
"sa/model.arcadia": "805b90262e27090ae7da81a51bcefa49c97fb0b3d3220b4a72323b4c4351c395",
"sa/participants.arcadia": "ca144d6a8f45fe720b5d18c7b59c7671444baa8c37e5ce9117bcba34b3a6aa84",
"sa/types.arcadia": "540ddbc2bcd0ccf45298e3ea5660637341aff63ff65fd87ac2f26469d1adc064",
"traceability.arcadia": "474bd28d955ff7af7722f6e9a23220d816879e3f46202e79a233544b9c593116",
"transition-before.json": "2253e6434f741687e22327c37d520ed15c043bc36025498650bc2366bb6a874d",
"transition-request.json": "43b9a22e5f95ad3bc0ebd2478ead0e14406854abc989ae94ded9367b013d812a",
"views/diagram_oa_allocation_view.arcadia": "c45d7467839219d894804c1ef2d22ff4d4a5a84a6a273c526bafd4c1facde624",
"views/diagram_sa_allocation_view.arcadia": "352a3ca745517592b5c9b1239b5770f62f0466a329a91fd03457ef2b53c06ed6",
"views/diagram_sa_capability_view.arcadia": "8f18fcccbcddcf3c1ea0ffe727b5b23b77fc148c5da4fde953abe681e4c20cd2",
"views/diagram_sa_service_view.arcadia": "4c72cb7593d9c4be8d2600b0656a7a3a6ce84c45bb2f3e58a4ee5ae3bf91913c",
"views/diagram_sa_state_view.arcadia": "dd1bea81ac7dc549a53f9b190be6f13052e00ede345bd180444cc31edb892230"
},
"matching_files": 37,
"baseline_captures": {
"baseline-allocation-compact.png": "d92a0cca62a038dcf0894d92b37a64028342c2365e3fb8880ed597222123d96f",
"baseline-trace-compact.png": "b608a3d75612d8c06aacc094a7aebd12a0798ce30f2126c00bc3ad61a9103217",
"baseline-trace-normal.png": "6dfb6c595af4247aab3600da0e0a25ba4b11151436e9fc4a406f1036053f71d0"
}
}
File diff suppressed because one or more lines are too long
@@ -1,6 +0,0 @@
{
"source": "6e7c4ddaf0775198384a8c4882809ea8e14b2976",
"binary": "D55ECAD4B0F75C0C9C26625E5441BEF9C9360890B65BC13236C6EBFAF03D631E",
"buildExit": 0,
"runtime": "F45604A12E8BCD839FD86F667C1BE1CC7C4F9DA2B3C69FF381AC708F0E1AE7D4"
}
@@ -1,2 +0,0 @@
Compiling oa-desktop v0.2.0 (C:\ar-compact-01a0d717\crates\oa-desktop)
Finished `dev` profile [unoptimized] target(s) in 2m 21s
@@ -1,2 +0,0 @@
Checking oa-desktop v0.2.0 (C:\ar-compact-01a0d717\crates\oa-desktop)
Finished `dev` profile [unoptimized] target(s) in 5m 24s
@@ -1,49 +0,0 @@
# Final native UX retest
Independent review by `/root/ux_critique`, using Windows Computer Use (`@oai/sky`). Final preparation and launch began on 2026-09-29; the resumed input session completed on 2026-10-01 America/Los_Angeles (completion clock: 2026-10-02 00:42:55 UTC).
## Identity and scope
- Source: `6e7c4ddaf0775198384a8c4882809ea8e14b2976`.
- Executable: `.local/native-final/arcadia-studio.exe`, SHA-256 `D55ECAD4B0F75C0C9C26625E5441BEF9C9360890B65BC13236C6EBFAF03D631E`.
- Runtime: `libunwind.dll`, SHA-256 `F45604A12E8BCD839FD86F667C1BE1CC7C4F9DA2B3C69FF381AC708F0E1AE7D4`.
- Read build identity from `build.json`. Parent launched this executable with a stdout/stderr/exit watcher; reviewer selected its unique returned native window and did not launch another executable.
- Model: only `.local/native-final/model/project.arcadia`, copied from the released water-pressure fixture. `baseline-proof.json` records its 37 original file hashes and baseline source/binary identity. No Save was performed.
- Normal window: 1440x900 client, captured 1442x932. Minimum: 1100x700 client, captured 1102x732. Same native environment and baseline fixture as prior review.
This is a bounded final-delta retest plus previously missing native group-selection/long-name coverage. The earlier `../candidate-5657/review.md` remains historical evidence for Process draft, State, Traceability, refused allocation, and resize-with-Help workflows on source `5657a996...`; those are not silently relabeled as this binary's results.
## Result
No blocking UX defect found in the workflows below. The two final minor corrections behave as intended, and the newly exercised native group workflow passed.
### Arrange cancellation and disclosed guidance
1. In the populated Allocation view, clicked Arrange. The control displayed its check and footer showed the armed state.
2. Pressed Escape. The check cleared and footer became `Arrange cancelled`, replacing the obsolete armed outcome. Repeated at minimum size with the same result. Evidence: `02-arrange-escape-cancelled.png`, `14-minimum-arrange-cancelled.png`.
3. Armed Arrange again, then opened contextual Help with the pointer. Help opened and footer became `Arrange cancelled`. Visible Close returned to the same model and canvas. Evidence: `03-help-cancels-arrange.png`.
4. Used PageDown to reach the relevant guide paragraphs. They now say `Choose Arrange` / `choose Arrange or press Alt+A`, matching the visible control, and explain right-click Add to selection / Inspect this element. Evidence: `04-guide-arrange-and-context-selection.png`.
### Native group selection and primary inspector
1. Clicked `Assess pressure alarm`; right-clicked `Repair valve in the field`; chose `Add to selection` from the ordinary context menu. Both cards gained selected outlines and the row displayed `2 selected`, `Hide selected`, `Clear`, and `Properties: Repair valve ... only`. Inspector showed the Repair activity. Evidence: `05-native-group-selection.png`.
2. Right-clicked the selected Assess card and chose `Inspect this element`. Both cards stayed selected; Inspector switched to Assess and the row's `Properties: ... only` summary followed it. Evidence: `06-group-primary-inspector.png`.
3. Opened F1 Help and dismissed with Escape. The same pair, primary inspector, canvas position and zoom remained. Evidence: `07-group-help-preserved.png`.
4. Resized to the configured minimum through the native window system menu. The group controls remained readable and reachable, with the full-width Destination slot above them. The intentional resize refitted the view; subsequent selection/draft/help transitions did not move its canvas boundary. Evidence: `08-group-minimum.png`.
### Long name, exact caret, Apply, Undo and Redo
1. With both cards still selected and Assess as primary, focused its Name field and replaced the draft with `Pressure alarm assessment with a deliberately long operational activity name LEFT RIGHT`.
2. Ctrl+Left placed the caret before RIGHT. Opened F1, pressed End to scroll Help, dismissed with Escape, and typed X without clicking the field. Reopened F1, used visible Close, and typed Y without refocusing. Pressing End in the restored field exposed the ending `LEFT XYRIGHT`. Thus both dismissal paths preserved the exact draft caret, not merely the draft contents. The pair and primary inspector also remained unchanged. Evidence: `09-group-long-draft-caret.png`.
3. Clicked Apply changes. Only the primary Assess activity acquired the long name; Repair retained its original label. At minimum size, the selection row remained one stable row: count, Hide selected, Clear, and a shortened `Properties: Pressure alar... only` summary. The truncation did not hide the `only` distinction or an action. The Inspector Name field remained editable/scrollable for the complete name. Evidence: `10-long-name-group-minimum.png`.
4. Clicked the non-editable summary row to leave the text input, then Ctrl+Z restored `Assess pressure alarm` and the UI's saved state. Ctrl+Y restored the long name and unsaved state. Ctrl+Z restored the original name and saved state again. The group remained selected through all three operations. Evidence: `11-long-name-undo.png`, `12-long-name-redo.png`.
5. Clicked Clear. The group cleared, Inspector returned to view properties, and the canvas boundary and card positions remained stable. Evidence: `13-clear-selection-stable-canvas.png`.
## Environment observation and limits
- Initial Ctrl+O unexpectedly opened Windows On-Screen Keyboard, obscuring the target. Its screenshot showed a highlighted Windows key; another observation showed a different highlighted key without another keyboard action from this reviewer. Input was stopped and the parent notified. The keyboard was already absent on the next fresh window enumeration; reviewer did not close it or press any Windows-key control. Used pointer Open and a literal copied-fixture path to continue. Subsequent Escape, PageDown, F1, Ctrl+A, Ctrl+Left, Alt+Space, Undo/Redo and typing produced the expected target-app responses. This transient environment interference is preserved in `00-environment-input-interference.png`; it is not attributed to an application defect.
- Native modifier-click remains untested; native group selection was genuinely exercised through the supported context menu instead. No multi-item drag/assignment was attempted in this final retest. Prior successor refused-drag evidence is separate.
- Process/State/Scenario, source-editor caret, all Help navigation keys and resize while Help is open were not all repeated on this final binary. The final run directly exercised property draft/caret, group preservation, PageDown and End, F1/Escape/Close, minimum sizing and edit recovery. Full acceptance must combine the accurately versioned evidence rather than infer missing workflows from screenshots.
- Saved-state labels, counts and visible Undo results do not prove whole-Project equality. This review made no Save; post-close byte-hash and watcher-log checks belong to the parent and are recorded separately.
Before closure, UI showed `All changes saved`, original activity names, 94 objects, 62 links and one model check. Closed normally with Alt+F4. Fresh native window enumeration confirmed the final application's window was absent. Parent was notified to inspect watcher stdout/stderr/exit and fixture hashes. No crash dialog was observed; native window disappearance alone is not an asserted exit code.
@@ -1,10 +0,0 @@
{
"source": "6e7c4ddaf0775198384a8c4882809ea8e14b2976",
"binary": "D55ECAD4B0F75C0C9C26625E5441BEF9C9360890B65BC13236C6EBFAF03D631E",
"started_utc": "2026-09-29T14:58:41.721798+00:00",
"pid": 7964,
"exit_code": 0,
"finished_utc": "2026-10-02T00:42:39.601915+00:00",
"stdout_bytes": 0,
"stderr_bytes": 0
}
@@ -1,132 +0,0 @@
Compiling oa-desktop v0.2.0 (C:\ar-compact-01a0d717\crates\oa-desktop)
Finished `test` profile [unoptimized] target(s) in 5m 01s
Running unittests src\main.rs (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\target-gnullvm\debug\deps\arcadia_studio-c5b42126ba36cd38.exe)
running 125 tests
test allocation_drag::tests::allocation_artifact_and_manual_trace_cascades_are_named_and_refused ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_detects_hidden_moved_child_and_stationary_enclosure_growth ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_distributed_oa_sa_exact_scope_routes_source_history_and_anchor ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_noop_stale_tamper_target_and_all_selected_headers ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_performer_closure_does_not_acquire_incidental_semantic_root ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_existing_overlap_but_refuses_its_growth ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_roles_and_does_not_invent_unplaced_descendants ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_unrelated_folded_interior_diagnostic_boundary ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_simultaneous_roots_may_enter_each_others_vacated_bounds ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_validates_all_original_members_before_normalizing ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_checks_original_identity_and_visibility_before_normalization ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_distributed_parent_refuses_but_its_independent_leaves_can_reassign ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_finish_rejects_stale_project_and_each_tampered_result ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_normalizes_parent_child_and_assigns_unplaced_leaf_once ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_requires_non_anchor_selected_header_inside_viewport ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_unresolved_oa_role_leaf_accepts_explicit_target_but_not_outside ... ok
test allocation_drag::tests::assignment_tests::group_assignment_accumulates_stable_ids_and_aliases_without_partial_reuse ... ok
test allocation_drag::tests::assignment_tests::group_assignment_collateral_surviving_constraint_refuses_whole_semantic_candidate ... ok
test allocation_drag::tests::assignment_tests::group_assignment_deletes_only_own_routes_across_views_and_keeps_internal_flow ... ok
test allocation_drag::tests::assignment_tests::group_assignment_independent_performers_preserves_already_correct_provenance ... ok
test allocation_drag::tests::assignment_tests::group_assignment_source_failure_preserves_existing_history_and_retry_ids ... ok
test allocation_drag::tests::assignment_tests::group_assignment_unfolds_only_changed_destination_and_refuses_newly_exposed_overlap ... ok
test allocation_drag::tests::assignment_tests::group_assignment_uses_vacated_space_and_one_complete_route_owner_map ... ok
test allocation_drag::tests::assignment_tests::group_assignment_zero_delta_changes_semantics_once_and_then_is_noop ... ok
test allocation_drag::tests::cache_plan_uses_candidate_index_and_same_pixel_different_target_changes_preview ... ok
test allocation_drag::tests::collapsed_target_unfold_is_explicit_and_no_other_fold_changes ... ok
test allocation_drag::tests::direct_exit_revealing_another_role_performer_has_truthful_refusal ... ok
test allocation_drag::tests::explicit_different_performer_retains_advisory_role_warning ... ok
test allocation_drag::tests::folded_subtree_cannot_hide_new_collision ... ok
test allocation_drag::tests::geometry_refuses_new_overlap_bounds_and_invisible_headers_and_preserves_existing_overlap ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_detects_moved_folded_child_collision ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_detects_stationary_enclosure_growth_collision ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_distributed_root_and_performer_can_translate_rigidly ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_unrelated_folded_interiors_are_outside_diagnostic_domain ... ok
test allocation_drag::tests::malformed_scope_wrong_projection_duplicate_placement_and_stable_id_collision_refuse ... ok
test allocation_drag::tests::mixed_p_x_y_refuses_semantic_and_arrange_instead_of_stretching_destination ... ok
test allocation_drag::tests::oa_communication_incompleteness_remains_advisory_without_collateral_loss ... ok
test allocation_drag::tests::oa_sa_incoming_between_outgoing_preserve_identity_source_history_and_other_views ... ok
test allocation_drag::tests::oa_sa_one_leaf_move_refuses_when_ancestor_regrouping_introduces_unrelated_overlap ... ok
test allocation_drag::tests::oa_sa_one_leaf_reassignment_and_outward_move_regroup_ancestors_without_moving_sibling ... ok
test allocation_drag::tests::oa_sa_populated_collapsed_target_accepts_room_and_refuses_collision_without_relocating_contents ... ok
test allocation_drag::tests::oa_sa_state_owned_action_and_availability_reject_reassignment_atomically ... ok
test allocation_drag::tests::oa_sa_unfolding_prior_hidden_overlap_refuses_even_when_insertion_does_not_collide ... ok
test allocation_drag::tests::own_deleted_allocation_routes_may_disappear_in_every_diagram_only ... ok
test allocation_drag::tests::role_only_same_effective_performer_is_semantic_noop_and_outgoing_refuses ... ok
test allocation_drag::tests::sa_port_and_deferred_exchange_allocation_cascade_refuses_and_retarget_is_invalid ... ok
test allocation_drag::tests::same_performer_readability_preserves_snapped_noop_and_allocation_identity ... ok
test allocation_drag::tests::scope_detects_first_child_allocation_and_role_transfer_and_finish_rejects_live_edits ... ok
test allocation_drag::tests::selected_header_visibility_allows_viewport_edge_but_refuses_clipping ... ok
test allocation_drag::tests::snapped_noop_returns_no_command_and_keeps_source_revision_and_redo ... ok
test allocation_drag::tests::source_budget_refusal_keeps_project_bundle_history_and_retry_identity_exact ... ok
test allocation_drag::tests::surviving_constraint_mutation_is_refused_even_when_core_candidate_is_valid ... ok
test allocation_drag::tests::target_presentation_requires_accepted_identity_and_selected_header_visibility ... ok
test allocation_drag::tests::toolbar_identity_allows_exact_incoming_placement_at_old_label_overlap ... ok
test allocation_drag::tests::uniform_folded_grandchild_and_unplaced_scope_moves_exactly_q_and_all_l_oa_sa ... ok
test allocation_drag::tests::uniform_role_only_and_mixed_direct_role_composites_same_target_do_not_allocate ... ok
test allocation_drag::tests::uniformly_unassigned_composite_creates_only_stable_leaf_allocations_including_unplaced ... ok
test allocation_drag::tests::unrequested_view_option_cleanup_is_not_whitelisted ... ok
test allocation_drag::tests::unresolved_role_leaf_can_arrange_or_accept_explicit_target_without_guessing ... ok
test app::allocation_drag::tests::actual_canvas_origin_change_cancels_held_work_before_any_legacy_release ... ok
test app::allocation_drag::tests::arrange_is_one_gesture_and_snapped_noop_preserves_redo_and_source ... ok
test app::allocation_drag::tests::candidate_semantics_are_cached_per_destination_with_stable_ids_and_own_index ... ok
test app::allocation_drag::tests::destination_identity_does_not_describe_blocked_or_outside_viewport_as_unallocation ... ok
test app::allocation_drag::tests::frozen_collapsed_target_uses_only_visible_header_and_port_edge_controls_occlude ... ok
test app::allocation_drag::tests::frozen_targets_use_half_open_semantic_priority_and_refuse_incomparable_overlap ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_dirty_description_retains_focus_and_middle_caret_for_next_key ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_dirty_name_retains_focus_and_middle_caret_for_next_key ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_exact_incoming_drag_keeps_destination_visible_and_canvas_stable ... ok
test app::allocation_drag::tests::full_tree::actual_keyboard_arrange_shortcut_consumes_once_escape_cancels_and_dirty_owner_refuses ... ok
test app::allocation_drag::tests::full_tree::actual_rendered_canvas_pixels_do_not_change_when_toolbar_feedback_text_changes ... ok
test app::allocation_drag::tests::full_tree::actual_toolbar_hover_inspects_last_full_name_without_authorizing_an_outside_drop ... ok
test app::allocation_drag::tests::full_tree::control_focus::dirty_selected_pin_outer_ring_keeps_real_name_focus_and_caret ... ok
test app::allocation_drag::tests::group::allocation_bare_moves_cannot_bypass_armed_active_or_retired_lifetime ... ok
test app::allocation_drag::tests::group::completed_text_apply_rejects_old_allocation_packets_without_retiring_a_new_drag ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_after_cancel_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_context_mismatches_preserve_the_current_session ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_current_restart_and_pair_commit_after_tool_boundary ... ok
test app::allocation_drag::tests::group::group_arrange_work_and_performer_anchors_preserve_every_responsibility ... ok
test app::allocation_drag::tests::group::group_assignment_split_rebuild_preserves_primary_and_commits_one_complete_candidate ... ok
test app::allocation_drag::tests::group::group_out_and_back_assigns_at_zero_delta_then_true_noop_preserves_redo ... ok
test app::allocation_drag::tests::group::group_selection_aba_and_old_press_cannot_retire_a_new_token ... ok
test app::allocation_drag::tests::group::group_source_refusal_retains_primary_source_and_both_history_paths ... ok
test app::allocation_drag::tests::group::idle_group_press_rejects_selection_generation_aba_with_unchanged_other_stamps ... ok
test app::allocation_drag::tests::group::ordinary_off_grid_performer_out_and_back_is_noop_with_redo ... ok
test app::allocation_drag::tests::group::route_lifetime::captured_route_context_fields_independently_reject_before_retirement ... ok
test app::allocation_drag::tests::group::route_lifetime::current_route_commits_without_session_preserve_exact_route_history ... ok
test app::allocation_drag::tests::group::route_lifetime::same_context_route_attachment_after_selection_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::same_context_route_commit_after_selection_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::stale_route_attachment_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::stale_route_commit_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::unsupported_group_click_collapses_but_threshold_crossing_never_becomes_click ... ok
test app::allocation_drag::tests::modal_roundtrip_equal_fit_undo_resize_and_focus_retire_press_before_replay ... ok
test app::allocation_drag::tests::mounted_clean_stationary_selects_exact_work_without_revision_or_legacy_apply ... ok
test app::allocation_drag::tests::mounted_dirty_port_press_cannot_fall_through_to_applying_port_selection ... ok
test app::allocation_drag::tests::mounted_dirty_property_press_does_not_select_apply_or_destroy_draft ... ok
test app::allocation_drag::tests::mounted_oa_sa_ordered_incoming_between_outgoing_are_exact_single_history_steps ... ok
test app::allocation_drag::tests::mounted_role_only_outgoing_refusal_retains_placement_and_same_performer_creates_no_allocation ... ok
test app::allocation_drag::tests::mounted_uniform_parent_moves_hidden_placements_and_assigns_only_leaves ... ok
test app::allocation_drag::tests::navigation_union::old_chooser_envelopes_preserve_a_current_canvas_gesture ... ok
test app::allocation_drag::tests::navigation_union::stale_gesture_packets_preserve_navigation_and_a_new_live_cancel_still_works ... ok
test app::allocation_drag::tests::oa_sa_clipped_selected_header_refuses_preview_release_and_retries_without_partial_source_or_history ... ok
test app::allocation_drag::tests::oa_sa_toolbar_identity_accepts_exact_receiver_and_collapsed_header_drag ... ok
test app::allocation_drag::tests::outside_release_is_cancel_and_does_not_remove_an_assignment ... ok
test app::allocation_drag::tests::pending_behavior_draft_refuses_actual_work_press_and_equal_document_replacement_retires_packet ... ok
test app::allocation_drag::tests::release_uses_ordered_native_position_before_later_motion_in_same_batch ... ok
test app::allocation_drag::tests::same_snapped_position_on_opposite_shared_border_rebuilds_semantics_even_if_layout_refuses ... ok
test app::allocation_drag::tests::source_and_modal_admission_reject_prebuilt_clean_press_without_selecting ... ok
test app::allocation_drag::tests::source_refusal_is_atomic_and_a_new_gesture_can_retry_against_live_revision ... ok
test app::allocation_drag::tests::stale_packets_do_not_cancel_a_newer_token_and_each_release_is_consumed_once ... ok
test app::allocation_drag::tests::toolbar_destination_names_transformed_target_whose_header_is_clipped ... ok
test app::allocation_drag::tests::toolbar_status_leaves_transformed_top_edge_work_header_readable ... ok
test app::context_help_tests::context_help_accepts_live_process_viewport_and_rejects_stale_measurements ... ok
test app::context_help_tests::context_help_barrier_retires_text_selection_drag_without_changing_the_caret ... ok
test app::context_help_tests::context_help_disables_allocation_input_including_early_work_drag_dispatch ... ok
test app::context_help_tests::context_help_escape_preserves_pending_behavior_form_and_blocks_submit ... ok
test app::context_help_tests::context_help_f1_selects_scenario_topic_without_leaving_the_workspace ... ok
test app::context_help_tests::context_help_preserves_group_property_draft_camera_and_model ... ok
test app::context_help_tests::context_help_rejects_a_reference_picker_open_queued_from_the_inspector ... ok
test app::context_help_tests::context_help_retains_source_draft_and_rejects_background_source_input ... ok
test app::context_help_tests::mounted_context_help_keyboard_scroll_preserves_inspector_focus_and_exact_caret ... ok
test app::context_help_tests::mounted_context_help_observes_modifier_release_before_plain_canvas_click ... ok
test app::context_help_tests::mounted_context_help_retires_held_pan_without_replaying_its_release ... ok
test guide::tests::filtering_and_related_navigation_keep_selection_visible ... ok
test guide::tests::guide_topic_navigation_resets_only_article_and_same_topic_search_keeps_scroll ... ok
test guide::tests::search_finds_concepts_in_walkthroughs_and_api_reference ... ok
test result: ok. 125 passed; 0 failed; 0 ignored; 0 measured; 1421 filtered out; finished in 75.83s
Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

@@ -1,49 +0,0 @@
{
"baseline_binary": "2c03bd6cc3f1110c219e4f57ab94874a121590f83779239a93289b7170664399",
"baseline_source": "715036e132677dd2bc2fb37ed316d93dc9987aec",
"model_files": {
"evidence/repair-check.md": "f4db17bdca4ecbb1bf0caef01b2da5f1f7f798ab3152b648ce6dd8696a6a68e5",
"expected-diagnostics.json": "3700393d76b940cfc076bf52861bd7b1f43370f8eabce3594531bd0bf1fc851e",
"model.json": "ef0ef4006c3e09d5db6e1b621256b3f7d6642f3a7b09cc34607cfbcca830c727",
"model.rs": "ddc2d92b0d7699a4cadfbb35ae379f0a68d17f4f5d7df82b4b1afcf8d5425fbe",
"oa/activities/activity_oa_restore_work.arcadia": "21cbd7176af8fad68453306f2371ff03e127a994b8796cdf044567332de9686f",
"oa/behavior/process_oa_assessment_procedure.arcadia": "23cabc213c264a16c8595414db6acb09248c1cef9cd699f1b0316e5bb82c062a",
"oa/behavior/process_oa_field_procedure.arcadia": "9c52086759b7344b4809ceb8d372f65647b16fc24153a03b887faa378c37fe96",
"oa/behavior/process_oa_response.arcadia": "675798bd19e6b40d03e7076b0e59b110cdaaab7b6d16c47c3ac80fa960072e84",
"oa/behavior/scenario_oa_conversation.arcadia": "e217e5394a0771dc16206ed9437a231da27905d2f19be64b3f48281c0a32fb6b",
"oa/behavior/scenario_oa_full_scenario.arcadia": "c5a285f2d7c61bd2a136107f267fbf9cddb1cba3f63ff36a6f53f7ab98f33df5",
"oa/behavior/state_machine_oa_monitor.arcadia": "e7349e1e5336282eed3f5a103129db33d3ae4ed500788ee7129e8fc193ac57f6",
"oa/capabilities.arcadia": "26a3d9b615a3251ff010e0b47127f2d16bc2dcd45ed95967208b0076d725843a",
"oa/model.arcadia": "069a5eaaf525089935cc9d73ae7b916866ed78c6534705d75739650ecdea7ada",
"oa/participants.arcadia": "591a75a9ecad280302be4d4ae0171ad616377ed11ead5e233848ca2dc0a71819",
"oa/types.arcadia": "f02c391d584674c879f662a418abba3a220f1fee88471ca49322ac9873de628d",
"project.arcadia": "b2674e6bf77cfe0f6f0ba79c81d2e96d92f39c02ca2c6266d80e91723bfb9fda",
"README.md": "113cfb1cf38a98b51bff60442d86a35d636a3d80ef206bece7d53d0aae67f2d5",
"sa/behavior/process_sa_assessment_procedure.arcadia": "5c414fbdaabf9f9e402b0441fcacf1cacf4dbbc6c822162f028de35abf59be2d",
"sa/behavior/process_sa_field_procedure.arcadia": "ece846fdf93857e71a9ab0efcbdf64a5c41c71180f62afa3f79077fffb53b8f2",
"sa/behavior/process_sa_response.arcadia": "af7fdda280a917cf626f6e077162d481f9aaad280f8e81330c07d7fe384b1c52",
"sa/behavior/scenario_sa_conversation.arcadia": "01339699ec3ee409418d9bb232542f2bcd9419f1e67b183e77700c56bb9f71d2",
"sa/behavior/scenario_sa_full_scenario.arcadia": "5dce6b00a3a441162e8dee3e23d9ca5ab7bed4a24de669b1fba03664a3086dda",
"sa/behavior/state_machine_sa_monitor.arcadia": "17dbcfa5bbfd10fc8e23a325fc950ce853c219b4aa89c74f96278cbb3f34acc8",
"sa/capabilities.arcadia": "81706a0ca9d7db2aa0350888b9c00d853885185db2e6b90557d3d51a11c3d645",
"sa/functions/function_sa_audit_thresholds.arcadia": "27f798f78f36e72b38edab3725af2feb0eaa010fd52a60b5c6b6bef57ad3b686",
"sa/functions/function_sa_restore_work.arcadia": "357c6acb80f86b4e8d8f5c98f9f79d140f85fbe09f3406b41b7ac6eba464ec8c",
"sa/model.arcadia": "805b90262e27090ae7da81a51bcefa49c97fb0b3d3220b4a72323b4c4351c395",
"sa/participants.arcadia": "ca144d6a8f45fe720b5d18c7b59c7671444baa8c37e5ce9117bcba34b3a6aa84",
"sa/types.arcadia": "540ddbc2bcd0ccf45298e3ea5660637341aff63ff65fd87ac2f26469d1adc064",
"traceability.arcadia": "474bd28d955ff7af7722f6e9a23220d816879e3f46202e79a233544b9c593116",
"transition-before.json": "2253e6434f741687e22327c37d520ed15c043bc36025498650bc2366bb6a874d",
"transition-request.json": "43b9a22e5f95ad3bc0ebd2478ead0e14406854abc989ae94ded9367b013d812a",
"views/diagram_oa_allocation_view.arcadia": "c45d7467839219d894804c1ef2d22ff4d4a5a84a6a273c526bafd4c1facde624",
"views/diagram_sa_allocation_view.arcadia": "352a3ca745517592b5c9b1239b5770f62f0466a329a91fd03457ef2b53c06ed6",
"views/diagram_sa_capability_view.arcadia": "8f18fcccbcddcf3c1ea0ffe727b5b23b77fc148c5da4fde953abe681e4c20cd2",
"views/diagram_sa_service_view.arcadia": "4c72cb7593d9c4be8d2600b0656a7a3a6ce84c45bb2f3e58a4ee5ae3bf91913c",
"views/diagram_sa_state_view.arcadia": "dd1bea81ac7dc549a53f9b190be6f13052e00ede345bd180444cc31edb892230"
},
"matching_files": 37,
"baseline_captures": {
"baseline-allocation-compact.png": "d92a0cca62a038dcf0894d92b37a64028342c2365e3fb8880ed597222123d96f",
"baseline-trace-compact.png": "b608a3d75612d8c06aacc094a7aebd12a0798ce30f2126c00bc3ad61a9103217",
"baseline-trace-normal.png": "6dfb6c595af4247aab3600da0e0a25ba4b11151436e9fc4a406f1036053f71d0"
}
}
@@ -1,6 +0,0 @@
{
"runtime": "F45604A12E8BCD839FD86F667C1BE1CC7C4F9DA2B3C69FF381AC708F0E1AE7D4",
"source": "f83068757af885572f6b3f932d07233dd1b94b7e",
"buildExit": 0,
"binary": "C1A9B196EC03E86F049FA2AAD2B86BFCAA3F0FBAE582A80EE39EE8ADF0758E3E"
}
@@ -1,2 +0,0 @@
Compiling oa-desktop v0.2.0 (C:\ar-compact-01a0d717\crates\oa-desktop)
Finished `dev` profile [unoptimized] target(s) in 1m 46s

Some files were not shown because too many files have changed in this diff Show More