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

(cherry picked from commit edde02481e)
This commit is contained in:
Seth Hillbrand 2018-09-24 14:03:54 -07:00
parent 6c3b4e5824
commit 8efdcbfaf1
1 changed files with 1 additions and 6 deletions

View File

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