forked from 1b-agent/opencadstudio-upstream
Wire up the Properties panel's Parameters section
PropValue::ParamRow/ParamAddRow, the PropParamInput/Commit/Delete/AddNew messages, their command_driver handlers (on_prop_param_commit/_delete/ _add_new, resolve_named_parameter_edit), and their render functions all already existed — but nothing ever constructed the "Parameters" section that would route data to them, so the whole inline add/rename/redefine/ delete workflow was unreachable from the UI. Adds that missing section to the no-selection page in refresh_properties, alongside a new PropValue::ParamsVisibilityToggle header row (mirrors the existing show_constraint_values setting) for toggling whether constraint pills show their driven value/parameter name. Users can now manage named parameters inline in the Properties panel (live resolved values, add/rename/redefine/delete) as an alternative to the separate PARAMETERS modal, which continues to work unchanged. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
1 parent
753df67ee4
commit
ed2e0fbc4a
5 files changed
+154
-2
No files matched your search
@@ -872,6 +872,7 @@ impl PropertiesPanel {
|
||||
self.render_param_row(*index, name, formula, resolved)
|
||||
}
|
||||
PropValue::ParamAddRow => render_param_add_row(),
|
||||
PropValue::ParamsVisibilityToggle(value) => render_params_visibility_toggle_row(*value),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1973,6 +1974,43 @@ fn render_param_add_row<'a>() -> Element<'a, Message> {
|
||||
container(btn).width(Length::Fill).into()
|
||||
}
|
||||
|
||||
// ── Parameters section: leading global visibility toggle ───────────────────
|
||||
|
||||
/// The Parameters section's leading header row (no-selection page): a
|
||||
/// global on/off toggle for whether any constraint pill in the viewport
|
||||
/// shows its driven value/parameter-name text — lives next to the
|
||||
/// named-parameter table it governs.
|
||||
fn render_params_visibility_toggle_row<'a>(value: bool) -> Element<'a, Message> {
|
||||
let btn_label = if value { t!("Shown").into_owned() } else { t!("Hidden").into_owned() };
|
||||
let btn = button(
|
||||
row![
|
||||
crate::ui::icons::semantic(crate::ui::icons::layer_visible(value), 13.0),
|
||||
text(btn_label).size(FONT_SZ),
|
||||
]
|
||||
.spacing(6)
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
.on_press(Message::ShowConstraintValuesChanged(!value))
|
||||
.style(move |theme: &Theme, status| {
|
||||
let palette = theme.palette();
|
||||
let pair = match status {
|
||||
button::Status::Hovered | button::Status::Pressed => palette.background.weak,
|
||||
_ => palette.background.base,
|
||||
};
|
||||
button::Style {
|
||||
background: Some(Background::Color(pair.color)),
|
||||
border: Border { color: palette.background.neutral.color, width: 1.0, radius: 2.0.into() },
|
||||
text_color: pair.text,
|
||||
..Default::default()
|
||||
}
|
||||
})
|
||||
.padding([4, 8])
|
||||
.width(Length::Fill);
|
||||
container(row![text(t!("Show values").into_owned()).size(FONT_SZ).width(Length::Fill), btn].align_y(iced::Center))
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Build a label | widget property row.
|
||||
fn prop_row_widget<'a>(label: &'a str, widget: Element<'a, Message>) -> Element<'a, Message> {
|
||||
prop_row_with_active(label, widget, false)
|
||||
|
||||
Reference in new issue
Block a user