mirror of
https://github.com/leozide/leocad.git
synced 2026-10-26 22:10:32 +00:00
Finish active drags before executing commands
Keyboard edits during dragging started a new history sequence and discarded the drag's original undo state. Deleting the dragged piece also left tracking active with a dangling piece pointer, causing the next mouse move to crash. Accept the active drag before dispatching every command except Cancel, which retains its existing cancellation behavior. Keyboard edits and deletion then run as separate undoable operations after tracking has ended. Validation: macOS application build and Qt Test suite passed. An offscreen harness using the production view, model, and command handlers reproduced the Delete crash and lost drag undo state before the fix. The fixed version passed five runs each of Delete with continued mouse movement, keyboard movement with undo, and Cancel. Fixes #1046 Fixes #1048
This commit is contained in:
1 parent
b3816caadb
commit
f7ab4170dd
2 files changed
+5
-1
No files matched your search
@@ -2870,6 +2870,10 @@ lcModelTabWidget* lcMainWindow::GetTabForView(lcView* View) const
|
||||
void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
||||
{
|
||||
lcView* ActiveView = GetActiveView();
|
||||
|
||||
if (ActiveView && CommandId != LC_EDIT_CANCEL)
|
||||
ActiveView->StopTracking(true);
|
||||
|
||||
lcModel* ActiveModel = ActiveView ? ActiveView->GetActiveModel() : nullptr;
|
||||
|
||||
switch (CommandId)
|
||||
|
||||
+1
-1
@@ -262,6 +262,7 @@ public:
|
||||
void UpdatePanGesture(int dx, int dy);
|
||||
void EndPanGesture(bool Accept);
|
||||
void StartOrbitTracking();
|
||||
void StopTracking(bool Accept);
|
||||
void CancelTrackingOrClearSelectionAction();
|
||||
|
||||
void SetViewpoint(lcViewpoint Viewpoint);
|
||||
@@ -335,7 +336,6 @@ protected:
|
||||
void UpdateTrackTool();
|
||||
lcTrackTool GetOverrideTrackTool(Qt::MouseButton Button) const;
|
||||
void StartTracking(lcTrackButton TrackButton);
|
||||
void StopTracking(bool Accept);
|
||||
void OnButtonDown(lcTrackButton TrackButton);
|
||||
void StartPan(int x, int y);
|
||||
void UpdatePan(int x, int y);
|
||||
|
||||
Reference in new issue
Block a user