Edit Tool: update the reference point for in-place modification

Fixes: lp:1765027
* https://bugs.launchpad.net/kicad/+bug/1765027
This commit is contained in:
Maciej Suminski 2018-04-19 16:55:40 +02:00
parent 1a5139b91f
commit f81c77cd4e
1 changed files with 4 additions and 6 deletions

View File

@ -1254,22 +1254,20 @@ void EDIT_TOOL::setTransitions()
bool EDIT_TOOL::updateModificationPoint( SELECTION& aSelection ) bool EDIT_TOOL::updateModificationPoint( SELECTION& aSelection )
{ {
if( aSelection.HasReferencePoint() ) if( m_dragging && aSelection.HasReferencePoint() )
return false; return false;
// When there is only one item selected, the reference point is its position...
if( aSelection.Size() == 1 ) if( aSelection.Size() == 1 )
{ {
auto item = static_cast<BOARD_ITEM*>( aSelection.Front() ); auto item = static_cast<BOARD_ITEM*>( aSelection.Front() );
auto pos = item->GetPosition(); auto pos = item->GetPosition();
aSelection.SetReferencePoint( VECTOR2I( pos.x, pos.y ) ); aSelection.SetReferencePoint( VECTOR2I( pos.x, pos.y ) );
} }
// ...otherwise modify items with regard to the cursor position
else else
{ {
// If EDIT_TOOL is not currently active then it means that the cursor position is not m_cursor = getViewControls()->GetCursorPosition();
// updated, so we have to fetch the latest value
if( m_toolMgr->GetCurrentToolId() != m_toolId )
m_cursor = getViewControls()->GetCursorPosition();
aSelection.SetReferencePoint( m_cursor ); aSelection.SetReferencePoint( m_cursor );
} }