mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 09:59:47 -06:00
Objects on Path: the tool's Rotate stays within -360 to 360
tool.setOption kept any finite rotate, while the Objects on Path Tool Options dialog shows Rotate clamped to -360 to 360 and saves the value it was given, so a rotate of 450 showed as 360 and the next attach used 450. The tool now clamps rotate to -360 to 360, and attach clamps the saved rotate it falls back to the same way.
This commit is contained in:
@@ -204,7 +204,7 @@ fn attach(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
// Without them in `p`, the tool's options (Objects on Path Tool Options) give Pivot and Rotate.
|
||||
let saved = s.tool_options_of(TOOL);
|
||||
let tool_pivot = saved.get("pivot").and_then(Value::as_u64).filter(|n| *n <= 8).map_or(CENTER, |n| n as u8);
|
||||
let tool_rotate = saved.get("rotate").and_then(Value::as_f64).filter(|r| r.is_finite()).unwrap_or(0.0);
|
||||
let tool_rotate = saved.get("rotate").and_then(Value::as_f64).filter(|r| r.is_finite()).map_or(0.0, |r| r.clamp(-360.0, 360.0));
|
||||
let (pivot, rotate) = pivot_rotate(p, C, tool_pivot, tool_rotate)?;
|
||||
let roots = match p.get("ids") {
|
||||
Some(_) => roots_of(&s.doc()?.doc, checked_ids_param(s, p, "ids", C)?),
|
||||
|
||||
Reference in New Issue
Block a user