Fix gradient transformation (#588)

* Fix with perfect circle

* Actually fix rotated gradient

* Gradient transform & fix on rotated canvas

* Cleanup & remove logging
This commit is contained in:
0HyperCube
2022-04-20 18:14:33 +01:00
committed by Keavon Chambers
parent 9c61fbc936
commit ca28bc3947
4 changed files with 46 additions and 15 deletions
+12 -1
View File
@@ -63,9 +63,20 @@ impl LayerData for TextLayer {
} else {
let mut path = self.to_bez_path();
let kurbo::Rect { x0, y0, x1, y1 } = path.bounding_box();
let bounds = [(x0, y0).into(), (x1, y1).into()];
path.apply_affine(glam_to_kurbo(transform));
let _ = write!(svg, r#"<path d="{}" {} />"#, path.to_svg(), self.style.render(view_mode, svg_defs));
let kurbo::Rect { x0, y0, x1, y1 } = path.bounding_box();
let transformed_bounds = [(x0, y0).into(), (x1, y1).into()];
let _ = write!(
svg,
r#"<path d="{}" {} />"#,
path.to_svg(),
self.style.render(view_mode, svg_defs, transform, bounds, transformed_bounds)
);
}
let _ = svg.write_str("</g>");
}