Refactor GRS messages and fix regression in chained GRS operations (#2450)

* Refactor GRS messages and have a switch handler

* some cleanup

* rename variables

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
mTvare
2025-03-17 11:50:11 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent b4006479d1
commit 7e7e88f6fa
4 changed files with 68 additions and 116 deletions
@@ -299,6 +299,22 @@ pub enum TransformOperation {
Scaling(Scale),
}
#[derive(Debug, Clone, PartialEq, Copy, serde::Serialize, serde::Deserialize)]
pub enum TransformType {
Grab,
Rotate,
Scale,
}
impl TransformType {
pub fn equivalent_to(&self, operation: TransformOperation) -> bool {
matches!(
(operation, self),
(TransformOperation::Scaling(_), TransformType::Scale) | (TransformOperation::Grabbing(_), TransformType::Grab) | (TransformOperation::Rotating(_), TransformType::Rotate)
)
}
}
impl TransformOperation {
#[allow(clippy::too_many_arguments)]
pub fn apply_transform_operation(&self, selected: &mut Selected, increment_mode: bool, local: bool, quad: Quad, transform: DAffine2, pivot: DVec2, local_transform: DAffine2) {