Respect selection reference point when set.
Fixes https://gitlab.com/kicad/code/kicad/issues/8520
This commit is contained in:
parent
1d4d83cb7c
commit
b8d193485d
|
@ -1086,9 +1086,12 @@ EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
|
||||||
}
|
}
|
||||||
else // Trim an existing selection by aFilterList
|
else // Trim an existing selection by aFilterList
|
||||||
{
|
{
|
||||||
|
bool isMoving = false;
|
||||||
|
|
||||||
for( int i = (int) m_selection.GetSize() - 1; i >= 0; --i )
|
for( int i = (int) m_selection.GetSize() - 1; i >= 0; --i )
|
||||||
{
|
{
|
||||||
EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
|
EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
|
||||||
|
isMoving = static_cast<SCH_ITEM*>( item )->IsMoving();
|
||||||
|
|
||||||
if( !item->IsType( aFilterList ) )
|
if( !item->IsType( aFilterList ) )
|
||||||
{
|
{
|
||||||
|
@ -1096,9 +1099,10 @@ EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
|
||||||
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
|
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
updateReferencePoint();
|
if( !isMoving )
|
||||||
|
updateReferencePoint();
|
||||||
|
}
|
||||||
|
|
||||||
return m_selection;
|
return m_selection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,7 +459,10 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( principalItemCount == 1 )
|
if( principalItemCount == 1 )
|
||||||
{
|
{
|
||||||
rotPoint = head->GetPosition();
|
if( moving && selection.HasReferencePoint() )
|
||||||
|
rotPoint = (wxPoint) selection.GetReferencePoint();
|
||||||
|
else
|
||||||
|
rotPoint = head->GetPosition();
|
||||||
|
|
||||||
if( !moving )
|
if( !moving )
|
||||||
saveCopyInUndoList( head, UNDO_REDO::CHANGED );
|
saveCopyInUndoList( head, UNDO_REDO::CHANGED );
|
||||||
|
@ -470,10 +473,8 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( head );
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( head );
|
||||||
|
|
||||||
if( clockwise )
|
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||||
symbol->SetOrientation( SYM_ROTATE_CLOCKWISE );
|
symbol->Rotate( rotPoint );
|
||||||
else
|
|
||||||
symbol->SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
|
|
||||||
|
|
||||||
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
|
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
|
||||||
symbol->AutoAutoplaceFields( m_frame->GetScreen() );
|
symbol->AutoAutoplaceFields( m_frame->GetScreen() );
|
||||||
|
@ -555,7 +556,10 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rotPoint = m_frame->GetNearestGridPosition( (wxPoint)selection.GetCenter() );
|
if( moving && selection.HasReferencePoint() )
|
||||||
|
rotPoint = (wxPoint) selection.GetReferencePoint();
|
||||||
|
else
|
||||||
|
rotPoint = m_frame->GetNearestGridPosition( (wxPoint) selection.GetCenter() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
||||||
|
|
|
@ -320,6 +320,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
// User wants to warp the mouse
|
// User wants to warp the mouse
|
||||||
m_cursor = grid.BestDragOrigin( m_cursor, snapLayer, selection );
|
m_cursor = grid.BestDragOrigin( m_cursor, snapLayer, selection );
|
||||||
|
selection.SetReferencePoint( m_cursor );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -358,6 +359,9 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
updateItem( item, false );
|
updateItem( item, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( selection.HasReferencePoint() )
|
||||||
|
selection.SetReferencePoint( selection.GetReferencePoint() + delta );
|
||||||
|
|
||||||
m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved );
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved );
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue