Fix viewport culling with nested layers (#939)

* Fix viewport culling with nested layers

* Clean up naming
This commit is contained in:
0HyperCube
2023-01-02 15:27:11 +00:00
committed by Keavon Chambers
parent 6fca25c213
commit 79078e469a
6 changed files with 41 additions and 19 deletions
+4 -2
View File
@@ -34,13 +34,13 @@ pub struct TextLayer {
}
impl LayerData for TextLayer {
fn render(&mut self, svg: &mut String, svg_defs: &mut String, transforms: &mut Vec<DAffine2>, render_data: RenderData) {
fn render(&mut self, svg: &mut String, svg_defs: &mut String, transforms: &mut Vec<DAffine2>, render_data: RenderData) -> bool {
let transform = self.transform(transforms, render_data.view_mode);
let inverse = transform.inverse();
if !inverse.is_finite() {
let _ = write!(svg, "<!-- SVG shape has an invalid transform -->");
return;
return false;
}
let _ = writeln!(svg, r#"<g transform="matrix("#);
@@ -85,6 +85,8 @@ impl LayerData for TextLayer {
);
}
let _ = svg.write_str("</g>");
false
}
fn bounding_box(&self, transform: glam::DAffine2, font_cache: &FontCache) -> Option<[DVec2; 2]> {