Fix tool drawing start point offset when an artboard has a transform (#1763)

* Fix offset artboard

* Multiply in transform sometimes
This commit is contained in:
0HyperCube
2024-05-28 09:09:48 +01:00
committed by GitHub
parent d40fb6caad
commit 61292500e6
5 changed files with 13 additions and 4 deletions

View File

@@ -447,7 +447,8 @@ impl GraphicElementRendered for Artboard {
}
fn add_click_targets(&self, click_targets: &mut Vec<ClickTarget>) {
let subpath = Subpath::new_rect(self.location.as_dvec2(), self.location.as_dvec2() + self.dimensions.as_dvec2());
let mut subpath = Subpath::new_rect(DVec2::ZERO, self.dimensions.as_dvec2());
subpath.apply_transform(self.graphic_group.transform.inverse());
click_targets.push(ClickTarget { stroke_width: 0., subpath });
}

View File

@@ -127,7 +127,7 @@ impl TransformMut for VectorData {
impl Transform for Artboard {
fn transform(&self) -> DAffine2 {
DAffine2::from_translation(self.location.as_dvec2())
DAffine2::from_translation(self.location.as_dvec2()) * self.graphic_group.transform
}
fn local_pivot(&self, pivot: DVec2) -> DVec2 {
self.location.as_dvec2() + self.dimensions.as_dvec2() * pivot