Make auto-wire use snapping behavior
Forcing grid snap for the kick-start behavior loses snaps to pins that may be desired. This also adds force-snapping in select mode to match the user's auto-start preferences Fixes https://gitlab.com/kicad/code/kicad/issues/7293
This commit is contained in:
parent
7a56608cd5
commit
ea6dc0d730
|
@ -363,8 +363,12 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
newParams->quitOnDraw = true;
|
||||
newEvt->SetParameter( newParams );
|
||||
|
||||
|
||||
getViewControls()->ForceCursorPosition( true, snappedCursorPos );
|
||||
newEvt->SetMousePosition( snappedCursorPos );
|
||||
newEvt->SetHasPosition( true );
|
||||
m_toolMgr->ProcessEvent( *newEvt );
|
||||
|
||||
continueSelect = false;
|
||||
}
|
||||
else if( collector[0]->IsHypertext() )
|
||||
|
@ -526,6 +530,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
&& collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
|
||||
{
|
||||
displayWireCursor = true;
|
||||
getViewControls()->ForceCursorPosition( true, snappedCursorPos );
|
||||
}
|
||||
else if( collector[0]->IsHypertext()
|
||||
&& !collector[0]->IsSelected()
|
||||
|
@ -535,6 +540,10 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getViewControls()->ForceCursorPosition( false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -282,16 +282,17 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
DRAW_SEGMENT_EVENT_PARAMS* params = aEvent.Parameter<DRAW_SEGMENT_EVENT_PARAMS*>();
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
getViewControls()->WarpCursor( aEvent.Position(), true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
{
|
||||
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
|
||||
EE_GRID_HELPER grid( m_toolMgr );
|
||||
grid.SetSnap( !aEvent.Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !aEvent.Modifier( MD_ALT ) );
|
||||
|
||||
VECTOR2D cursorPos = grid.BestSnapAnchor( aEvent.Position(), LAYER_CONNECTABLE, nullptr );
|
||||
startSegments( params->layer, cursorPos );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue