diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 2c053bcb7b..0c771879a9 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -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( aItem ); wxPoint pos = via->GetPosition(); diff --git a/pcbnew/tools/pcb_tool.cpp b/pcbnew/tools/pcb_tool.cpp index 32571db75e..81dcc90f07 100644 --- a/pcbnew/tools/pcb_tool.cpp +++ b/pcbnew/tools/pcb_tool.cpp @@ -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 ) ) { diff --git a/pcbnew/tools/pcb_tool.h b/pcbnew/tools/pcb_tool.h index 011df7a207..c4b35ae7c5 100644 --- a/pcbnew/tools/pcb_tool.h +++ b/pcbnew/tools/pcb_tool.h @@ -57,6 +57,7 @@ struct INTERACTIVE_PLACER_BASE PCB_EDIT_FRAME* m_frame; BOARD* m_board; + int m_modifiers; };