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