Common: make grid prev/next wrap

Consistent with our other keys like change track and via sizes.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9051
This commit is contained in:
Mike Williams 2023-01-19 11:46:13 -05:00
parent 0e04c4b1da
commit 7ab651f078
1 changed files with 8 additions and 4 deletions

View File

@ -424,8 +424,10 @@ int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
{
int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
if( currentGrid + 1 < int( m_grids.size() ) )
currentGrid++;
currentGrid++;
if( currentGrid >= int( m_grids.size() ) )
currentGrid = 0;
return OnGridChanged();
}
@ -435,8 +437,10 @@ int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
{
int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
if( currentGrid > 0 )
currentGrid--;
currentGrid--;
if( currentGrid < 0 )
currentGrid = (int) m_grids.size() - 1;
return OnGridChanged();
}