Correct position for grid even when we're not snapping to a point.

Fixes https://gitlab.com/kicad/code/kicad/issues/8125
This commit is contained in:
Jeff Young 2021-05-25 21:55:57 +01:00
parent db900fe526
commit 5c9a73aa5e
3 changed files with 4 additions and 10 deletions

View File

@ -278,8 +278,6 @@ void TOOL_BASE::updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads )
m_startItem = nullptr;
m_startSnapPoint = snapToItem( m_startItem, p );
if( checkSnap( m_startItem ) )
controls()->ForceCursorPosition( true, m_startSnapPoint );
}

View File

@ -1020,7 +1020,6 @@ bool ROUTER_TOOL::prepareInteractive()
if( m_startItem && m_startItem->Net() > 0 )
highlightNet( true, m_startItem->Net() );
controls()->ForceCursorPosition( false );
controls()->SetAutoPan( true );
PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
@ -1653,7 +1652,6 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
m_gridHelper->SetAuxAxes( true, p );
controls()->ShowCursor( true );
controls()->ForceCursorPosition( false );
controls()->SetAutoPan( true );
frame()->UndoRedoBlock( true );

View File

@ -84,11 +84,7 @@ VECTOR2I PCB_GRID_HELPER::AlignToSegment( const VECTOR2I& aPoint, const SEG& aSe
if( !m_enableSnap )
return aPoint;
const VECTOR2D gridOffset( GetOrigin() );
const VECTOR2D gridSize( GetGrid() );
VECTOR2I nearest( KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x,
KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y );
VECTOR2I nearest = Align( aPoint );
pts[0] = aSeg.A;
pts[1] = aSeg.B;
@ -202,7 +198,9 @@ VECTOR2I PCB_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, BOARD_ITEM* a
item.push_back( aReferenceItem );
}
else
{
layers = LSET::AllLayersMask();
}
return BestSnapAnchor( aOrigin, layers, item );
}