Skip to content

Commit

Permalink
Fix SVG scaling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Weasy666 committed Nov 5, 2023
1 parent 099c50b commit f609564
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions examples/2d/twinkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Svg2dBundle {
svg,
origin: Origin::Center,
transform: Transform {
scale: Vec3::new(0.75, 0.75, 1.0),
..Default::default()
},
..Default::default()
});
}
3 changes: 2 additions & 1 deletion src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use lyon_geom::euclid::default::Transform2D;
use lyon_path::PathEvent;
use lyon_tessellation::{math::Point, FillTessellator, StrokeTessellator};
use svgtypes::ViewBox;
use usvg::NodeExt;

use crate::{loader::FileSvgError, render::tessellation, Convert};

Expand Down Expand Up @@ -90,7 +91,7 @@ impl Svg {
for node in tree.root.descendants() {
match *node.borrow() {
usvg::NodeKind::Path(ref path) => {
let t = path.transform;
let t = node.abs_transform();
let abs_t = Transform::from_matrix(Mat4::from_cols(
[t.a.abs() as f32, t.b as f32, 0.0, 0.0].into(),
[t.c as f32, t.d.abs() as f32, 0.0, 0.0].into(),
Expand Down

0 comments on commit f609564

Please sign in to comment.