mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 10:17:02 -06:00
M7.3: Type → Type on a Path effects (Rainbow, Skew, 3D Ribbon, Stair Step, Gravity): TextObject::path_effect, type.pathOptions {effect}, checked menu items
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8434ef4404
commit
0ae572be93
@@ -337,6 +337,7 @@ fn create_in_path(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
runs: vec![TextRun { text, style }],
|
||||
para: Default::default(),
|
||||
area: Default::default(),
|
||||
path_effect: Default::default(),
|
||||
cached_bounds: None,
|
||||
};
|
||||
refresh_bounds(&mut t);
|
||||
@@ -371,6 +372,7 @@ fn headline_tracking(t: &TextObject, target: f64) -> Option<f64> {
|
||||
runs: head.clone(),
|
||||
para: Default::default(),
|
||||
area: Default::default(),
|
||||
path_effect: Default::default(),
|
||||
cached_bounds: None,
|
||||
};
|
||||
for r in &mut h.runs {
|
||||
|
||||
@@ -52,7 +52,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Type on a Path Options…",
|
||||
["Type", "Type on a Path"],
|
||||
None,
|
||||
"{start?: 0..1 (fraction of the path length), flip?: bool (reverse the path), ids?}",
|
||||
"{start?: 0..1 (fraction of the path length), flip?: bool (reverse the path), effect?: rainbow|skew|3dRibbon|stairStep|gravity, ids?}",
|
||||
has_selection,
|
||||
path_options
|
||||
),
|
||||
@@ -367,6 +367,10 @@ fn path_options(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let ids = texts(s, p, C)?;
|
||||
let start = p.get("start").and_then(Value::as_f64);
|
||||
let flip = bool_or(p, "flip", false);
|
||||
let effect = match str_param(p, "effect") {
|
||||
Some(e) => Some(vectorcraft_doc::PathEffect::parse(e).ok_or_else(|| bad(C, format!("unknown effect `{e}`")))?),
|
||||
None => None,
|
||||
};
|
||||
let n = s.edit("Type on a Path Options", |d, _| {
|
||||
let mut n = 0;
|
||||
for id in &ids {
|
||||
@@ -378,6 +382,9 @@ fn path_options(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if flip {
|
||||
path.reverse();
|
||||
}
|
||||
if let Some(e) = effect {
|
||||
t.path_effect = e;
|
||||
}
|
||||
n += 1;
|
||||
refresh_bounds(t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user