Don't modify reference point if already moving.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16524
(cherry picked from commit 08da9a4494
)
This commit is contained in:
parent
ef23d6776d
commit
e68cd04d48
|
@ -942,8 +942,13 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
|
|||
if( wxWindow* frame = dynamic_cast<wxWindow*>( m_frame ) )
|
||||
frame->PopupMenu( menu.get() );
|
||||
|
||||
// If a menu is canceled then notify tool
|
||||
if( menu->GetSelected() < 0 )
|
||||
// Warp the cursor if a menu item was selected
|
||||
if( menu->GetSelected() >= 0 )
|
||||
{
|
||||
if( m_viewControls && m_warpMouseAfterContextMenu )
|
||||
m_viewControls->WarpMouseCursor( m_menuCursor, true, false );
|
||||
}
|
||||
// Otherwise notify the tool of a cancelled menu
|
||||
{
|
||||
TOOL_EVENT evt( TC_COMMAND, TA_CHOICE_MENU_CHOICE, -1 );
|
||||
evt.SetHasPosition( false );
|
||||
|
|
|
@ -2563,7 +2563,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
(int) new_items.size() ) );
|
||||
|
||||
// If items were duplicated, pick them up
|
||||
if( doMoveSelection( aEvent, &commit ) )
|
||||
if( doMoveSelection( aEvent, &commit, true ) )
|
||||
commit.Push( _( "Duplicate" ) );
|
||||
else
|
||||
commit.Revert();
|
||||
|
@ -2629,13 +2629,13 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
|
|||
|
||||
bool EDIT_TOOL::updateModificationPoint( PCB_SELECTION& aSelection )
|
||||
{
|
||||
if( m_dragging && aSelection.HasReferencePoint() )
|
||||
return false;
|
||||
|
||||
// Can't modify an empty group
|
||||
if( aSelection.Empty() )
|
||||
return false;
|
||||
|
||||
if( ( m_dragging || aSelection[0]->IsMoving() ) && aSelection.HasReferencePoint() )
|
||||
return false;
|
||||
|
||||
// When there is only one item selected, the reference point is its position...
|
||||
if( aSelection.Size() == 1 )
|
||||
{
|
||||
|
|
|
@ -200,7 +200,7 @@ private:
|
|||
bool pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage,
|
||||
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint );
|
||||
|
||||
bool doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit );
|
||||
bool doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit, bool aAutoStart );
|
||||
|
||||
///< Rebuilds the ratsnest for operations that require it outside the commit rebuild
|
||||
void rebuildConnectivity();
|
||||
|
|
|
@ -197,7 +197,7 @@ int EDIT_TOOL::PackAndMoveFootprints( const TOOL_EVENT& aEvent )
|
|||
|
||||
SpreadFootprints( &footprintsToPack, footprintsBbox.Normalize().GetOrigin(), false );
|
||||
|
||||
if( doMoveSelection( aEvent, &commit ) )
|
||||
if( doMoveSelection( aEvent, &commit, true ) )
|
||||
commit.Push( _( "Pack footprints" ) );
|
||||
else
|
||||
commit.Revert();
|
||||
|
@ -219,7 +219,7 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
|||
wxCHECK( aEvent.SynchronousState(), 0 );
|
||||
aEvent.SynchronousState()->store( STS_RUNNING );
|
||||
|
||||
if( doMoveSelection( aEvent, commit ) )
|
||||
if( doMoveSelection( aEvent, commit, true ) )
|
||||
aEvent.SynchronousState()->store( STS_FINISHED );
|
||||
else
|
||||
aEvent.SynchronousState()->store( STS_CANCELLED );
|
||||
|
@ -228,7 +228,7 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
BOARD_COMMIT localCommit( this );
|
||||
|
||||
if( doMoveSelection( aEvent, &localCommit ) )
|
||||
if( doMoveSelection( aEvent, &localCommit, false ) )
|
||||
localCommit.Push( _( "Move" ) );
|
||||
else
|
||||
localCommit.Revert();
|
||||
|
@ -277,7 +277,7 @@ VECTOR2I EDIT_TOOL::getSafeMovement( const VECTOR2I& aMovement, const BOX2I& aSo
|
|||
}
|
||||
|
||||
|
||||
bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit )
|
||||
bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit, bool aAutoStart )
|
||||
{
|
||||
bool moveWithReference = aEvent.IsAction( &PCB_ACTIONS::moveWithReference );
|
||||
bool moveIndividually = aEvent.IsAction( &PCB_ACTIONS::moveIndividually );
|
||||
|
@ -544,7 +544,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
|
||||
m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved );
|
||||
}
|
||||
else if( !m_dragging && !evt->IsAction( &ACTIONS::refreshPreview ) )
|
||||
else if( !m_dragging && ( aAutoStart || !evt->IsAction( &ACTIONS::refreshPreview ) ) )
|
||||
{
|
||||
// Prepare to start dragging
|
||||
editFrame->HideSolderMask();
|
||||
|
|
Loading…
Reference in New Issue