Skip to content

Commit

Permalink
whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Oct 14, 2024
1 parent 6efa16b commit b896b2a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/usvg/src/parser/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ pub(crate) fn convert_length(
if object_units == Units::ObjectBoundingBox {
n / 100.0
} else {
let width = state.use_size.0.unwrap_or(state.view_box.width());
let height = state.use_size.1.unwrap_or(state.view_box.height());
let view_box = state.view_box;

match aid {
AId::Cx
Expand All @@ -44,7 +43,7 @@ pub(crate) fn convert_length(
| AId::Width
| AId::X
| AId::X1
| AId::X2 => convert_percent(length, width),
| AId::X2 => convert_percent(length, view_box.width()),
AId::Cy
| AId::Dy
| AId::Fy
Expand All @@ -54,9 +53,9 @@ pub(crate) fn convert_length(
| AId::Ry
| AId::Y
| AId::Y1
| AId::Y2 => convert_percent(length, height),
| AId::Y2 => convert_percent(length, view_box.height()),
_ => {
let mut vb_len = width.powi(2) + height.powi(2);
let mut vb_len = view_box.width().powi(2) + view_box.height().powi(2);
vb_len = (vb_len / 2.0).sqrt();
convert_percent(length, vb_len)
}
Expand Down

0 comments on commit b896b2a

Please sign in to comment.