GRID_HELPER: Allow grid disable

Many items require precise, non-grid movement.  Adding the ability to
flag a non-grid option will permit this behavior.

This is a required precursor commit to fixing lp:1738818 and lp:1771683
This commit is contained in:
Seth Hillbrand 2018-10-04 20:42:58 -07:00
parent f56b5cf7bd
commit 28c19cb613
2 changed files with 10 additions and 0 deletions

View File

@ -48,6 +48,7 @@ GRID_HELPER::GRID_HELPER( PCB_BASE_FRAME* aFrame ) :
{
m_diagonalAuxAxesEnable = true;
m_enableSnap = true;
m_enableGrid = true;
m_snapSize = 100;
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
@ -121,6 +122,9 @@ void GRID_HELPER::SetAuxAxes( bool aEnable, const VECTOR2I& aOrigin, bool aEnabl
VECTOR2I GRID_HELPER::Align( const VECTOR2I& aPoint ) const
{
if( !m_enableGrid )
return aPoint;
const VECTOR2D gridOffset( GetOrigin() );
const VECTOR2D gridSize( GetGrid() );

View File

@ -64,6 +64,11 @@ public:
m_enableSnap = aSnap;
}
void SetUseGrid( bool aGrid = true )
{
m_enableGrid = aGrid;
}
private:
enum ANCHOR_FLAGS {
CORNER = 0x1,
@ -110,6 +115,7 @@ private:
bool m_diagonalAuxAxesEnable; ///< If true, use the aux axis for snapping as well
bool m_enableSnap; ///< If true, allow snapping to other items on the layers
bool m_enableGrid; ///< If true, allow snapping to grid
int m_snapSize; ///< Sets the radius in screen units for snapping to items
KIGFX::ORIGIN_VIEWITEM m_viewSnapPoint;