Fix box selection erroneously including zero-length handles; fix GRS failing on sharp points (#2550)

* Fixed box selection selecting zero length handles

* Fix GRS for sharp points

* Apply suggestions from code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Adesh Gupta 2025-04-13 06:51:36 +05:30 committed by GitHub
parent e759e62291
commit 550ffc3f7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 4 deletions

View File

@ -1444,7 +1444,14 @@ impl ShapeState {
if select {
match selection_change {
SelectionChange::Shrink => state.deselect_point(id),
_ => state.select_point(id),
_ => {
// Select only the handles which are of nonzero length
if let Some(handle) = id.as_handle() {
if handle.length(&vector_data) > 0. {
state.select_point(id)
}
}
}
}
}
}

View File

@ -403,9 +403,12 @@ impl MessageHandler<TransformLayerMessage, TransformData<'_>> for TransformLayer
let handle1_length = handle1.length(&vector_data);
let handle2_length = handle2.length(&vector_data);
if (handle1_length == 0. && handle2_length == 0.) || (handle1_length == f64::MAX && handle2_length == f64::MAX) {
selected.original_transforms.clear();
return;
if (handle1_length == 0. && handle2_length == 0. && !using_select_tool) || (handle1_length == f64::MAX && handle2_length == f64::MAX && !using_select_tool) {
// G should work for this point but not R and S
if matches!(transform_type, TransformType::Rotate | TransformType::Scale) {
selected.original_transforms.clear();
return;
}
}
}
} else {