PCB: add grid overrides to graphics/router/etc.
This commit is contained in:
parent
b224af0d1f
commit
2b78c20a62
|
@ -397,7 +397,8 @@ void TOOL_BASE::updateEndItem( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
{
|
||||
m_endItem = nullptr;
|
||||
m_endSnapPoint = m_gridHelper->Align( mousePos );
|
||||
m_endSnapPoint =
|
||||
m_gridHelper->Align( mousePos, m_router->IsPlacingVia() ? GRID_VIAS : GRID_WIRES );
|
||||
}
|
||||
|
||||
controls()->ForceCursorPosition( true, m_endSnapPoint );
|
||||
|
@ -421,7 +422,7 @@ const VECTOR2I TOOL_BASE::snapToItem( ITEM* aItem, const VECTOR2I& aP )
|
|||
{
|
||||
if( !aItem || !m_iface->IsItemVisible( aItem ) )
|
||||
{
|
||||
return m_gridHelper->Align( aP );
|
||||
return m_gridHelper->Align( aP, m_router->IsPlacingVia() ? GRID_VIAS : GRID_WIRES );
|
||||
}
|
||||
|
||||
switch( aItem->Kind() )
|
||||
|
@ -486,7 +487,7 @@ const VECTOR2I TOOL_BASE::snapToItem( ITEM* aItem, const VECTOR2I& aP )
|
|||
break;
|
||||
}
|
||||
|
||||
return m_gridHelper->Align( aP );
|
||||
return m_gridHelper->Align( aP, m_router->IsPlacingVia() ? GRID_VIAS : GRID_WIRES );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -596,8 +596,9 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
|
||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
|
||||
cursorPos = GetClampedCoords(
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), m_frame->GetActiveLayer() ),
|
||||
cursorPos =
|
||||
GetClampedCoords( grid.BestSnapAnchor( m_controls->GetMousePosition(),
|
||||
m_frame->GetActiveLayer(), GRID_GRAPHICS ),
|
||||
COORDS_PADDING );
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
|
@ -830,8 +831,9 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
|
||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
|
||||
VECTOR2I cursorPos = GetClampedCoords(
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), m_frame->GetActiveLayer() ),
|
||||
VECTOR2I cursorPos =
|
||||
GetClampedCoords( grid.BestSnapAnchor( m_controls->GetMousePosition(),
|
||||
m_frame->GetActiveLayer(), GRID_TEXT ),
|
||||
COORDS_PADDING );
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
|
@ -1104,7 +1106,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : m_controls->GetMousePosition();
|
||||
cursorPos = GetClampedCoords( grid.BestSnapAnchor( cursorPos, nullptr ), COORDS_PADDING );
|
||||
cursorPos = GetClampedCoords( grid.BestSnapAnchor( cursorPos, nullptr, GRID_GRAPHICS ),
|
||||
COORDS_PADDING );
|
||||
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
|
@ -1574,7 +1577,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
|
|||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
|
||||
cursorPos = GetClampedCoords(
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), layer ),
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), layer, GRID_GRAPHICS ),
|
||||
COORDS_PADDING );
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
|
@ -1843,7 +1846,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
|
|||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
|
||||
cursorPos = GetClampedCoords(
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), m_layer ),
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), m_layer, GRID_GRAPHICS ),
|
||||
COORDS_PADDING );
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
|
@ -2234,7 +2237,8 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
|
|||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
|
||||
VECTOR2I cursorPos = GetClampedCoords(
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), graphic ), COORDS_PADDING );
|
||||
grid.BestSnapAnchor( m_controls->GetMousePosition(), graphic, GRID_GRAPHICS ),
|
||||
COORDS_PADDING );
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
if( evt->IsCancelInteractive() || ( started && evt->IsAction( &ACTIONS::undo ) ) )
|
||||
|
@ -2562,7 +2566,8 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
|||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
|
||||
|
||||
VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : m_controls->GetMousePosition();
|
||||
cursorPos = GetClampedCoords( grid.BestSnapAnchor( cursorPos, layers ), COORDS_PADDING );
|
||||
cursorPos = GetClampedCoords( grid.BestSnapAnchor( cursorPos, layers, GRID_GRAPHICS ),
|
||||
COORDS_PADDING );
|
||||
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
|
|
Loading…
Reference in New Issue