Correctly apply transforms to vector data and strokes (#1977)

* Fix adding a layer to a transformed group

* Fix assorted transform issues

* Default stroke transform

* Fix bench

* Transform gradient

* Gradient fix

* Add gradient reversal buttons to Fill node in the Properties panel

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
James Lindsay
2024-09-15 23:26:11 +01:00
committed by GitHub
parent 2fa8773092
commit dd4a97b09f
19 changed files with 152 additions and 59 deletions

View File

@@ -244,7 +244,15 @@ async fn construct_layer<Data: Into<GraphicElement> + Send>(
) -> GraphicGroup {
let graphic_element = self.graphic_element.eval(footprint).await;
let mut stack = self.stack.eval(footprint).await;
stack.push(graphic_element.into());
let mut element: GraphicElement = graphic_element.into();
if stack.transform.matrix2.determinant() != 0. {
*element.transform_mut() = stack.transform.inverse() * element.transform();
} else {
stack.clear();
stack.transform = DAffine2::IDENTITY;
}
stack.push(element);
stack
}