Reject invalid New Art Basic parameters

This commit is contained in:
dotCooCoo
2026-11-06 11:15:35 +07:00
committed by bflatastic
parent 3c7d9e1f90
commit 8a730bab6b
3 changed files with 17 additions and 2 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ use vectorcraft_doc::{Appearance, AppearanceItem, FillLayer, GraphicStyle, Node,
use vectorcraft_tools::PaintDefaults;
use super::gradient::unplaced;
use super::{CommandSpec, Result, Session, always, cmd};
use super::{CommandSpec, Result, Session, always, cmd, switch_or};
pub fn specs() -> Vec<CommandSpec> {
vec![
@@ -216,7 +216,7 @@ impl Session {
}
fn set_basic(s: &mut Session, p: &Value) -> Result<Value> {
let on = p.get("on").and_then(Value::as_bool).unwrap_or(!s.prefs.new_art_basic);
let on = switch_or(p, "on", !s.prefs.new_art_basic, "appearance.setNewArtBasic")?;
s.prefs.new_art_basic = on;
Ok(json!({ "on": on }))
}