From 3c32f4d31d98791d0eb96681dc945b73bb18f008 Mon Sep 17 00:00:00 2001 From: Jeff Young <jeff@rokeby.ie> Date: Fri, 14 Mar 2025 13:10:14 +0000 Subject: [PATCH] Refresh preview after rotate/flip/mirror during move. Fixes https://gitlab.com/kicad/code/kicad/-/issues/19561 --- pcbnew/tools/edit_tool.cpp | 21 +++++++++++++++++++++ pcbnew/tools/edit_tool_move_fct.cpp | 8 ++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index b570756702..f42b59fbea 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1943,6 +1943,12 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) } } + if( m_dragging ) + { + m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest, VECTOR2I() ); + m_toolMgr->PostAction( PCB_ACTIONS::refreshPreview ); + } + return 0; } @@ -2065,7 +2071,10 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); if( m_dragging ) + { m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest, VECTOR2I() ); + m_toolMgr->PostAction( PCB_ACTIONS::refreshPreview ); + } } // Restore the old reference so any mouse dragging that occurs doesn't make the selection jump @@ -2229,7 +2238,10 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); if( m_dragging ) + { m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest, VECTOR2I() ); + m_toolMgr->PostAction( PCB_ACTIONS::refreshPreview ); + } return 0; } @@ -2304,7 +2316,10 @@ int EDIT_TOOL::JustifyText( const TOOL_EVENT& aEvent ) m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); if( m_dragging ) + { m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest, VECTOR2I() ); + m_toolMgr->PostAction( PCB_ACTIONS::refreshPreview ); + } return 0; } @@ -2385,7 +2400,10 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent ) m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); if( m_dragging ) + { m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest, VECTOR2I() ); + m_toolMgr->PostAction( PCB_ACTIONS::refreshPreview ); + } // Restore the old reference so any mouse dragging that occurs doesn't make the selection jump // to this now invalid reference @@ -2810,7 +2828,10 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); if( m_dragging ) + { m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest, VECTOR2I() ); + m_toolMgr->PostAction( PCB_ACTIONS::refreshPreview ); + } } return 0; diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index aae25a7057..a3bbcd1bac 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -465,12 +465,16 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) eatFirstMouseUp = false; - if( evt->IsAction( &PCB_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT ) + if( evt->IsAction( &PCB_ACTIONS::move ) + || evt->IsMotion() + || evt->IsDrag( BUT_LEFT ) || evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsAction( &PCB_ACTIONS::moveWithReference ) || evt->IsAction( &PCB_ACTIONS::moveIndividually ) ) { - if( m_dragging && evt->Category() == TC_MOUSE ) + if( m_dragging && ( evt->IsMotion() + || evt->IsDrag( BUT_LEFT ) + || evt->IsAction( &ACTIONS::refreshPreview ) ) ) { bool redraw3D = false;