* first draft of making segment snap to previous arc's last tangent * ability to force/disable line snap, threshold in screen space * mouseEvent refactor tsc errors fixed * cleanups, extract getTanPreviousPoint function * add snap line support when previous segment is ARC * small cleanups * remove unused planeNodePath param from onDragSegment * renaming * Enable snapping when placing the segment point in onClick * refactor getSnappedDragPoint to include axis intersection * handle snapping to both axis and tangent direction * snap refinements * small cleanups * lint * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * generate tag for previous arc when snapping current straight segment * using previous arc's tag in snapped angledLine * angledLine uses object instead of array now * use more general snap object instead * snap tangent line visualized when snapping occurs * remove unused scale param from createLine * prettier * fix bug where segment body is not drawn * fix generated kcl error introduced in merge from main - modifiedAst needs to be passed to addNewSketchLn * add support for snapping to negative tangent direction * fix findTangentDirection for THREE_POINT_ARC_SEGMENT * fix tsc error by introducing overrideExpr * fix missing ccw for 3 point arc, fix tan_previous_point calculation for 3 point arcs * resolve clippy until confirmation for circle radius * fix runtime error when drawing a 3 point arc * add unit tests to closestPointoOnRay * unrelated react warning fixed * add playwright test for tangent snapping * better fix for tan_previous_point * fix lint * add simulation test for tangent_to_3_point_arc * Fix simulation test output * Add missing simulation test output files * fix tangent snapping bug: use current group instead of last group in activeSegments * make testcombos.test happy * cleanup merge * fix merge mistake, tsc error * update tangent_to_3_point_arc simulation test * fix angledLine related breaking tests * minimum distance added before snapping to tangent * circle is always ccw regardless of the order of points for tangential info calculation * fix snapping when different unit is used other than mm * update test: Straight line snapping to previous tangent * update rust snapshot test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
@ -644,7 +644,7 @@ impl GetTangentialInfoFromPathsResult {
|
||||
pub(crate) fn tan_previous_point(&self, last_arc_end: [f64; 2]) -> [f64; 2] {
|
||||
match self {
|
||||
GetTangentialInfoFromPathsResult::PreviousPoint(p) => *p,
|
||||
GetTangentialInfoFromPathsResult::Arc { center, ccw, .. } => {
|
||||
GetTangentialInfoFromPathsResult::Arc { center, ccw } => {
|
||||
crate::std::utils::get_tangent_point_from_previous_arc(*center, *ccw, last_arc_end)
|
||||
}
|
||||
// The circle always starts at 0 degrees, so a suitable tangent
|
||||
@ -1231,12 +1231,9 @@ impl Path {
|
||||
},
|
||||
Path::ArcThreePoint { p1, p2, p3, .. } => {
|
||||
let circle_center = crate::std::utils::calculate_circle_from_3_points([*p1, *p2, *p3]);
|
||||
let radius = linear_distance(&[circle_center.center[0], circle_center.center[1]], p1);
|
||||
let center_point = [circle_center.center[0], circle_center.center[1]];
|
||||
GetTangentialInfoFromPathsResult::Circle {
|
||||
center: center_point,
|
||||
ccw: true,
|
||||
radius,
|
||||
GetTangentialInfoFromPathsResult::Arc {
|
||||
center: circle_center.center,
|
||||
ccw: crate::std::utils::is_points_ccw(&[*p1, *p2, *p3]) > 0,
|
||||
}
|
||||
}
|
||||
Path::Circle {
|
||||
@ -1252,6 +1249,7 @@ impl Path {
|
||||
let center_point = [circle_center.center[0], circle_center.center[1]];
|
||||
GetTangentialInfoFromPathsResult::Circle {
|
||||
center: center_point,
|
||||
// Note: a circle is always ccw regardless of the order of points
|
||||
ccw: true,
|
||||
radius,
|
||||
}
|
||||
|
Reference in New Issue
Block a user