Skip to content

Commit

Permalink
Add scaleX and scaleY to pico_svg.
Browse files Browse the repository at this point in the history
  • Loading branch information
xorgy committed Mar 11, 2024
1 parent a656e57 commit 4916da7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/scenes/src/pico_svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}");
Expand Down

0 comments on commit 4916da7

Please sign in to comment.