diff options
author | RazrFalcon <razrfalcon@gmail.com> | 2019-01-01 20:31:35 +0200 |
---|---|---|
committer | RazrFalcon <razrfalcon@gmail.com> | 2019-01-01 20:32:45 +0200 |
commit | a9841ea9999d0780c2fd9ee42e0af39502cfe28a (patch) | |
tree | b2c959967833e54adfc2f2af4fd7ad7d5278ddb1 /src/utils.rs | |
parent | 9da06f680823403b70e81672b8adb347f449fe12 (diff) |
Fixed object bounding box calculation. x3
Fixed nested objectBoundigBox support.
Refactoring.
Closes #46
Diffstat (limited to 'src/utils.rs')
-rw-r--r-- | src/utils.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/utils.rs b/src/utils.rs index 873583b..70db5e1 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -69,7 +69,7 @@ pub fn abs_transform( /// Calculates path's bounding box. /// -/// Minimum size is 1x1. +/// Width and/or height can be zero. pub fn path_bbox( segments: &[usvg::PathSegment], stroke: Option<&usvg::Stroke>, @@ -150,11 +150,8 @@ pub fn path_bbox( maxy += w; } - let mut width = maxx - minx; - if width < 1.0 { width = 1.0; } - - let mut height = maxy - miny; - if height < 1.0 { height = 1.0; } + let width = maxx - minx; + let height = maxy - miny; (minx as f64, miny as f64, width as f64, height as f64).into() } |