feat: support minus in viewbox

This commit is contained in:
Sam Denty 2023-01-05 12:18:40 +00:00
parent 0099fc0770
commit 4b986a4831
No known key found for this signature in database
GPG key ID: 7B4EAF7B9E291B79

View file

@ -30,7 +30,7 @@ pub async fn get_svg_size<R: AsyncRead + Unpin>(
*size.borrow_mut() = Some(if let (Some(width), Some(height)) = (width, height) { *size.borrow_mut() = Some(if let (Some(width), Some(height)) = (width, height) {
Some(IconSize::new(width, height)) Some(IconSize::new(width, height))
} else if let Some(viewbox) = viewbox { } else if let Some(viewbox) = viewbox {
regex!(r"^\d+\s+\d+\s+(\d+\.?[\d]?)\s+(\d+\.?[\d]?)") regex!(r"^-?\d+\s+-?\d+\s+(\d+\.?[\d]?)\s+(\d+\.?[\d]?)")
.captures(&viewbox) .captures(&viewbox)
.map(|captures| { .map(|captures| {
let width = parse_size(captures.get(1).unwrap().as_str()).unwrap(); let width = parse_size(captures.get(1).unwrap().as_str()).unwrap();