pcbnew: Get anchor from layer when drawing

When drawing segments, the segment will be NULL'd after committing, at
which point we lost our snap layer.  Choosing snap layers from the
current drawing layer is a more robust method.

Fixes: lp:1796467
* https://bugs.launchpad.net/kicad/+bug/1796467
This commit is contained in:
Seth Hillbrand 2018-10-06 08:15:10 -07:00
parent 86999a2a4d
commit f2a49c6bd6
1 changed files with 1 additions and 1 deletions

View File

@ -1023,7 +1023,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
{
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
cursorPos = grid.BestSnapAnchor( m_controls->GetCursorPosition(), aGraphic );
cursorPos = grid.BestSnapAnchor( m_controls->GetCursorPosition(), getDrawingLayer() );
// 45 degree angle constraint enabled with an option and toggled with Ctrl
const bool limit45 = ( frame()->Settings().m_use45DegreeGraphicSegments != !!( evt->Modifier( MD_CTRL ) ) );