From 4916da70a245dee38ad4f2d49b90013027cccd2c Mon Sep 17 00:00:00 2001 From: Aaron Muir Hamilton Date: Mon, 11 Mar 2024 17:00:37 -0400 Subject: [PATCH] Add scaleX and scaleY to pico_svg. --- examples/scenes/src/pico_svg.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/scenes/src/pico_svg.rs b/examples/scenes/src/pico_svg.rs index b3cc67eb7..04be2405e 100644 --- a/examples/scenes/src/pico_svg.rs +++ b/examples/scenes/src/pico_svg.rs @@ -207,6 +207,18 @@ fn parse_transform(transform: &str) -> Affine { } else { Affine::IDENTITY } + } else if let Some(s) = ts.strip_prefix("scaleX(") { + s.trim() + .parse() + .ok() + .map(|x| Affine::scale_non_uniform(x, 1.0)) + .unwrap_or(Affine::IDENTITY) + } else if let Some(s) = ts.strip_prefix("scaleY(") { + s.trim() + .parse() + .ok() + .map(|y| Affine::scale_non_uniform(1.0, y)) + .unwrap_or(Affine::IDENTITY) } else { if !ts.is_empty() { eprintln!("Did not understand transform attribute {ts:?}");