Allow disabling snap-to when placing vias

This allows the user to selectively disable the snap-to behavior when
placing stand-alone vias.  Full solution will require an update to the
segment distance calculation that takes into account the rounded line
caps.

Fixes: lp:1769523
* https://bugs.launchpad.net/kicad/+bug/1769523
This commit is contained in:
Seth Hillbrand 2018-05-07 13:49:36 -07:00
parent ffe194567a
commit 4c7f5f2a2f
3 changed files with 12 additions and 4 deletions

View File

@ -1518,15 +1518,20 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
void SnapItem( BOARD_ITEM *aItem ) override
{
#if 0
// If you place a Via on a track but not on its centerline, the current
// connectivity algorithm will require us to put a kink in the track when
// we break it (so that each of the two segments ends on the via center).
// That's not ideal, and is in fact probably worse than forcing snap in
// this situation.
if( m_frame->Settings().m_magneticTracks == CAPTURE_CURSOR_IN_TRACK_TOOL
|| m_frame->Settings().m_magneticTracks == CAPTURE_ALWAYS )
#endif
// bool do_snap = ( m_frame->Settings().m_magneticTracks == CAPTURE_CURSOR_IN_TRACK_TOOL
// || m_frame->Settings().m_magneticTracks == CAPTURE_ALWAYS );
bool do_snap = true;
if( m_modifiers & MD_SHIFT )
do_snap = !do_snap;
if( do_snap )
{
auto via = static_cast<VIA*>( aItem );
wxPoint pos = via->GetPosition();

View File

@ -59,6 +59,7 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
aPlacer->m_board = board();
aPlacer->m_frame = frame();
aPlacer->m_modifiers = 0;
if( aOptions & IPO_SINGLE_CLICK )
{
@ -74,6 +75,7 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
while( OPT_TOOL_EVENT evt = Wait() )
{
VECTOR2I cursorPos = controls()->GetCursorPosition();
aPlacer->m_modifiers = evt->Modifier();
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
{

View File

@ -57,6 +57,7 @@ struct INTERACTIVE_PLACER_BASE
PCB_EDIT_FRAME* m_frame;
BOARD* m_board;
int m_modifiers;
};