From 99ac7238fc3bde30bb37f979286397005768b874 Mon Sep 17 00:00:00 2001 From: James Lindsay <78500760+0HyperCube@users.noreply.github.com> Date: Wed, 4 Dec 2024 21:28:40 +0000 Subject: [PATCH] Fix bitmap bounding box (#2122) --- node-graph/gcore/src/graphic_element/renderer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node-graph/gcore/src/graphic_element/renderer.rs b/node-graph/gcore/src/graphic_element/renderer.rs index 5302ce4b..7ad93b3d 100644 --- a/node-graph/gcore/src/graphic_element/renderer.rs +++ b/node-graph/gcore/src/graphic_element/renderer.rs @@ -801,8 +801,8 @@ impl GraphicElementRendered for ImageFrame { } fn bounding_box(&self, transform: DAffine2) -> Option<[DVec2; 2]> { - let transform = self.transform * transform; - (transform.matrix2 != glam::DMat2::ZERO).then(|| (transform * Quad::from_box([DVec2::ZERO, DVec2::ONE])).bounding_box()) + let transform = transform * self.transform; + (transform.matrix2.determinant() != 0.).then(|| (transform * Quad::from_box([DVec2::ZERO, DVec2::ONE])).bounding_box()) } fn collect_metadata(&self, metadata: &mut RenderMetadata, footprint: Footprint, element_id: Option) { @@ -876,8 +876,8 @@ impl GraphicElementRendered for Raster { } fn bounding_box(&self, transform: DAffine2) -> Option<[DVec2; 2]> { - let transform = self.transform() * transform; - (transform.matrix2 != glam::DMat2::ZERO).then(|| (transform * Quad::from_box([DVec2::ZERO, DVec2::ONE])).bounding_box()) + let transform = transform * self.transform(); + (transform.matrix2.determinant() != 0.).then(|| (transform * Quad::from_box([DVec2::ZERO, DVec2::ONE])).bounding_box()) } fn collect_metadata(&self, metadata: &mut RenderMetadata, footprint: Footprint, element_id: Option) {