mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-16 15:24:44 +00:00
Object styles: the branch's true/false parameter helper, beside the other object style parameters in main's split module
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
72c06ea4ac
commit
1141f3a22b
1 file changed
+9
@@ -159,6 +159,15 @@ pub(super) fn create_object(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
})
|
||||
}
|
||||
|
||||
/// A true/false parameter, when given.
|
||||
fn bool_param(cmd: &str, p: &Value, key: &str) -> Result<Option<bool>> {
|
||||
match p.get(key) {
|
||||
None | Some(Value::Null) => Ok(None),
|
||||
Some(Value::Bool(b)) => Ok(Some(*b)),
|
||||
Some(_) => Err(bad(cmd, format!("`{key}` must be true or false"))),
|
||||
}
|
||||
}
|
||||
|
||||
/// `p.stroke` merged over `base` (as [`group_param`]), refused when the weight isn't a number ≥ 0
|
||||
/// or the tint isn't 0–1.
|
||||
fn stroke_param(cmd: &str, p: &Value, base: Option<&designcraft_doc::Stroke>) -> Result<Option<Option<designcraft_doc::Stroke>>> {
|
||||
|
||||
Reference in new issue
Block a user