Undo actions not generated for transform actions that didn't do anything

This commit is contained in:
Yousef Khadadeh 2026-01-05 15:37:21 +03:00
parent dbec3641d8
commit b6c771c862
4 changed files with 23 additions and 1 deletions

View file

@ -163,7 +163,7 @@ bool DrawingProgramSelection::mouse_collided_with_rotate_handle_point() {
}
void DrawingProgramSelection::commit_transform_selection() {
if(is_being_transformed()) {
if(!is_empty_transform()) {
std::vector<WorldUndoManager::UndoObjectID> undoIDList;
std::vector<std::pair<CoordSpaceHelper, CoordSpaceHelper>> transformDataList;
for(auto& comp : selectedSet) {
@ -440,6 +440,10 @@ bool DrawingProgramSelection::is_being_transformed() {
return transformOpHappening != TransformOperation::NONE;
}
bool DrawingProgramSelection::is_empty_transform() {
return transformOpHappening == TransformOperation::NONE || selectionTransformCoords.is_identity();
}
std::unordered_set<CanvasComponentContainer::ObjInfo*> DrawingProgramSelection::get_selection_as_set() {
return std::unordered_set<CanvasComponentContainer::ObjInfo*>(selectedSet.begin(), selectedSet.end());
}

View file

@ -29,6 +29,8 @@ class DrawingProgramSelection {
bool mouse_collided_with_rotate_center_handle_point();
bool mouse_collided_with_rotate_handle_point();
bool is_empty_transform();
void commit_transform_selection();
void rebuild_cam_space();
Vector2f get_rotation_point_pos_from_angle(double angle);