Skip to content

Commit e09a606

Browse files
0HyperCubeKeavon
authored andcommitted
Fix line centering (#431)
1 parent 88cde0d commit e09a606

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

editor/src/tool/tools/line.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,13 @@ fn generate_transform(data: &mut LineToolData, lock: bool, snap: bool, center: b
226226
}
227227

228228
if center {
229-
start -= dir / 2.;
229+
start -= scale * DVec2::new(angle.cos(), angle.sin());
230+
scale *= 2.;
230231
}
231232

232233
Operation::SetLayerTransformInViewport {
233234
path: data.path.clone().unwrap(),
234-
transform: glam::DAffine2::from_scale_angle_translation(DVec2::splat(scale), angle, start).to_cols_array(),
235+
transform: glam::DAffine2::from_scale_angle_translation(DVec2::new(scale, 1.), angle, start).to_cols_array(),
235236
}
236237
.into()
237238
}

0 commit comments

Comments
 (0)