Fix for bug where rotating / editing a selected item would remove it from screen

- Added test to see if there was a currently-editing item

Fixes: lp:1661866

https://bugs.launchpad.net/kicad/+bug/1661866
This commit is contained in:
Oliver 2017-02-06 18:17:34 +11:00 committed by Wayne Stambaugh
parent f96628f5c2
commit a5dcc192dc
1 changed files with 10 additions and 5 deletions

View File

@ -660,7 +660,7 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( hotKey == NULL )
return false;
bool itemInEdit = GetScreen()->GetCurItem() && GetScreen()->GetCurItem()->GetFlags();
bool itemInEdit = m_drawItem && m_drawItem->InEditMode();
bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
@ -715,7 +715,7 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_EDIT:
if( ! itemInEdit )
if( !itemInEdit )
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem )
@ -755,7 +755,8 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
}
else
{
m_drawItem = LocateItemUsingCursor( aPosition );
if ( !itemInEdit )
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem )
{
@ -815,13 +816,17 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_MIRROR_Y: // Mirror Y
m_drawItem = LocateItemUsingCursor( aPosition );
if( !itemInEdit )
m_drawItem = LocateItemUsingCursor( aPosition );
cmd.SetId( ID_LIBEDIT_MIRROR_Y );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_MIRROR_X: // Mirror X
m_drawItem = LocateItemUsingCursor( aPosition );
if( !itemInEdit )
m_drawItem = LocateItemUsingCursor( aPosition );
cmd.SetId( ID_LIBEDIT_MIRROR_X );
GetEventHandler()->ProcessEvent( cmd );
break;