pcbnew: snap final points to grid
When constraining moves, the cursor snaps to grid but does not represent the position of the final edited point. The point is rotated to the nearest snap angle, while the vector length remains unchanged resulting in a line longer than intended and off-grid. This adds a grid-snap after the constraint is applied. Fixes: lp:1792655 * https://bugs.launchpad.net/kicad/+bug/1792655
This commit is contained in:
parent
079d6b2009
commit
e7c51a6a6c
|
@ -34,6 +34,7 @@ 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>
|
||||
|
@ -288,6 +289,8 @@ 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() );
|
||||
|
@ -344,6 +347,7 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
m_editedPoint->ApplyConstraint();
|
||||
|
||||
m_editedPoint->SetPosition( grid.Align( m_editedPoint->GetPosition() ) );
|
||||
updateItem();
|
||||
updatePoints();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue