Fixed selected items drift on rotation/flip
This commit is contained in:
parent
0e14cdf6da
commit
217593f6bc
|
@ -496,16 +496,18 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||||
if( m_selectionTool->CheckLock() == SELECTION_LOCKED )
|
if( m_selectionTool->CheckLock() == SELECTION_LOCKED )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Shall the selection be cleared at the end?
|
wxPoint modPoint = getModificationPoint( selection );
|
||||||
wxPoint rotatePoint = getModificationPoint( selection );
|
|
||||||
const int rotateAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *editFrame, aEvent );
|
const int rotateAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *editFrame, aEvent );
|
||||||
|
|
||||||
for( auto item : selection )
|
for( auto item : selection )
|
||||||
{
|
{
|
||||||
m_commit->Modify( item );
|
m_commit->Modify( item );
|
||||||
static_cast<BOARD_ITEM*>( item )->Rotate( rotatePoint, rotateAngle );
|
static_cast<BOARD_ITEM*>( item )->Rotate( modPoint, rotateAngle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the dragging point offset
|
||||||
|
m_offset = static_cast<BOARD_ITEM*>( selection.Front() )->GetPosition() - modPoint;
|
||||||
|
|
||||||
if( !m_dragging )
|
if( !m_dragging )
|
||||||
m_commit->Push( _( "Rotate" ) );
|
m_commit->Push( _( "Rotate" ) );
|
||||||
|
|
||||||
|
@ -634,14 +636,17 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
||||||
if( selection.Empty() )
|
if( selection.Empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wxPoint flipPoint = getModificationPoint( selection );
|
wxPoint modPoint = getModificationPoint( selection );
|
||||||
|
|
||||||
for( auto item : selection )
|
for( auto item : selection )
|
||||||
{
|
{
|
||||||
m_commit->Modify( item );
|
m_commit->Modify( item );
|
||||||
static_cast<BOARD_ITEM*>( item )->Flip( flipPoint );
|
static_cast<BOARD_ITEM*>( item )->Flip( modPoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the dragging point offset
|
||||||
|
m_offset = static_cast<BOARD_ITEM*>( selection.Front() )->GetPosition() - modPoint;
|
||||||
|
|
||||||
if( !m_dragging )
|
if( !m_dragging )
|
||||||
m_commit->Push( _( "Flip" ) );
|
m_commit->Push( _( "Flip" ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue