Fix disappearance of placed objects after 'Properties' action

This commit is contained in:
Maciej Suminski 2018-01-19 14:20:15 +01:00
parent 903e33375f
commit 388d07a808
2 changed files with 22 additions and 0 deletions

View File

@ -327,11 +327,16 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
m_frame->SetToolID( m_editModules ? ID_MODEDIT_TEXT_TOOL : ID_PCB_ADD_TEXT_BUTT,
wxCURSOR_PENCIL, _( "Add text" ) );
bool reselect = false;
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
VECTOR2I cursorPos = m_controls->GetCursorPosition();
if( reselect && text )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, text );
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
{
if( text )
@ -438,6 +443,12 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
selection.SetReferencePoint( cursorPos );
m_view->Update( &selection );
}
else if( text && evt->IsAction( &PCB_ACTIONS::properties ) )
{
// Calling 'Properties' action clears the selection, so we need to restore it
reselect = true;
}
}
m_frame->SetNoToolSelected();

View File

@ -403,11 +403,16 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, module );
}
bool reselect = false;
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
cursorPos = controls->GetCursorPosition();
if( reselect && module )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, module );
if( evt->IsCancel() || evt->IsActivate() )
{
if( module )
@ -460,6 +465,12 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
selection.SetReferencePoint( cursorPos );
getView()->Update( &selection );
}
else if( module && evt->IsAction( &PCB_ACTIONS::properties ) )
{
// Calling 'Properties' action clears the selection, so we need to restore it
reselect = true;
}
}
m_frame->SetNoToolSelected();