forked from 1b-agent/opencadstudio-upstream
fix(properties): preserve literal text
Separate numeric fields from names and content so only numeric property values are evaluated as expressions. Refs #809
This commit is contained in:
commit
5e62da464e
15 files changed
+107
-31
No files matched your search
Vendored
+1
-1
@@ -86,7 +86,7 @@ pub fn general_section(entity: &EntityType) -> PropSection {
|
||||
Property {
|
||||
label: t!("Hyperlink").into_owned(),
|
||||
field: "hyperlink",
|
||||
value: PropValue::EditText(hyperlink),
|
||||
value: PropValue::PlainText(hyperlink),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -8,8 +8,10 @@ use glam::DVec3;
|
||||
pub enum PropValue {
|
||||
/// Read-only display text.
|
||||
ReadOnly(String),
|
||||
/// Editable numeric/text field.
|
||||
/// Editable numeric field.
|
||||
EditText(String),
|
||||
/// Editable text that must not be expression-evaluated.
|
||||
PlainText(String),
|
||||
/// Layer name — rendered as a combo_box.
|
||||
LayerChoice(String),
|
||||
/// Generic string choice rendered as a combo_box.
|
||||
|
||||
@@ -417,6 +417,7 @@ impl Scene {
|
||||
])
|
||||
} else {
|
||||
match prop.value {
|
||||
PropValue::PlainText(_) => QSelectValueEditor::Text,
|
||||
PropValue::ReadOnly(ref value)
|
||||
| PropValue::EditText(ref value) => {
|
||||
let field = prop.field.to_ascii_lowercase();
|
||||
@@ -614,7 +615,9 @@ impl Scene {
|
||||
.flat_map(|s| s.props)
|
||||
.find(|p| p.field == field)?;
|
||||
Some(match prop.value {
|
||||
PropValue::ReadOnly(s) | PropValue::EditText(s) => s,
|
||||
PropValue::ReadOnly(s)
|
||||
| PropValue::EditText(s)
|
||||
| PropValue::PlainText(s) => s,
|
||||
PropValue::LayerChoice(s) => s,
|
||||
PropValue::Choice { selected, .. } => selected,
|
||||
PropValue::EditChoice { value, .. } => value,
|
||||
|
||||
Reference in new issue
Block a user