pcbnew: Fix alignment with off-grid drag

Commit efdbc91e42 broken the primary
alignment mechanism for maintaining the current point as an auxilliary
grid reference.  This reverts that commit and fixes both the initial
issue and the associated bug by applying the primary constraint after
the secondary.  In this way, we consider the secondary constraint as an
additive rather than alternative constraint.

Fixes: lp:1793888
* https://bugs.launchpad.net/kicad/+bug/1793888
This commit is contained in:
Seth Hillbrand 2018-09-24 14:03:54 -07:00
parent 282e37b2bf
commit edde02481e
1 changed files with 1 additions and 6 deletions

View File

@ -34,7 +34,6 @@ using namespace std::placeholders;
#include "pcb_actions.h"
#include "selection_tool.h"
#include "point_editor.h"
#include "grid_helper.h"
#include <board_commit.h>
#include <bitmaps.h>
#include <status_popup.h>
@ -306,8 +305,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
KIGFX::VIEW_CONTROLS* controls = getViewControls();
KIGFX::VIEW* view = getView();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
GRID_HELPER grid( editFrame );
auto item = selection.Front();
m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
@ -361,10 +358,8 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
if( m_altConstraint )
m_altConstraint->Apply();
else
m_editedPoint->ApplyConstraint();
m_editedPoint->SetPosition( grid.Align( m_editedPoint->GetPosition() ) );
m_editedPoint->ApplyConstraint();
updateItem();
updatePoints();
}