pcbnew: fixed stuck cursor when ForceCursorPosition() is active and cursor is moved by keyboard arrows

Fixes: lp:1729301
* https://bugs.launchpad.net/kicad/+bug/1729301
This commit is contained in:
Tomasz Włostowski 2017-11-16 00:42:40 +01:00
parent df6d005fd3
commit b76a6210c5
4 changed files with 24 additions and 5 deletions

View File

@ -411,6 +411,17 @@ VECTOR2D WX_VIEW_CONTROLS::GetMousePosition( bool aWorldCoordinates ) const
return aWorldCoordinates ? m_view->ToWorld( screenPos ) : screenPos;
}
VECTOR2D WX_VIEW_CONTROLS::GetRawCursorPosition( bool aEnableSnapping ) const
{
if( aEnableSnapping )
{
return m_view->GetGAL()->GetGridPoint( m_cursorPos );
}
else
{
return m_cursorPos;
}
}
VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition( bool aEnableSnapping ) const
{
@ -420,10 +431,7 @@ VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition( bool aEnableSnapping ) const
}
else
{
if( aEnableSnapping )
return m_view->GetGAL()->GetGridPoint( m_cursorPos );
else
return m_cursorPos;
return GetRawCursorPosition( aEnableSnapping );
}
}

View File

@ -183,6 +183,14 @@ public:
return GetCursorPosition( m_settings.m_snappingEnabled );
}
/**
* Returns the current cursor position in world coordinates - ingoring the cursorUp
* position force mode.
*
* @return The current cursor position in world coordinates.
*/
virtual VECTOR2D GetRawCursorPosition( bool aSnappingEnabled = true ) const = 0;
/**
* Returns the current cursor position in world coordinates. Note, that it may be
* different from the mouse pointer position if snapping is enabled or cursor position

View File

@ -78,6 +78,9 @@ public:
/// @copydoc VIEW_CONTROLS::GetCursorPosition()
VECTOR2D GetCursorPosition( bool aSnappingEnabled ) const override;
/// @copydoc VIEW_CONTROLS::GetRawCursorPosition()
VECTOR2D GetRawCursorPosition( bool aSnappingEnabled = true ) const override;
void SetCursorPosition( const VECTOR2D& aPosition, bool warpView ) override;
/// @copydoc VIEW_CONTROLS::CursorWarp()

View File

@ -484,7 +484,7 @@ int PCBNEW_CONTROL::CursorControl( const TOOL_EVENT& aEvent )
bool mirroredX = getView()->IsMirroredX();
GRID_HELPER gridHelper( m_frame );
VECTOR2D cursor = getViewControls()->GetCursorPosition();
VECTOR2D cursor = getViewControls()->GetRawCursorPosition( true );
VECTOR2I gridSize = gridHelper.GetGrid();
if( fastMove )