diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index a24bd96947..ce58c47f82 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -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() ); diff --git a/pcbnew/tools/grid_helper.h b/pcbnew/tools/grid_helper.h index 426f859efa..ffa00828a4 100644 --- a/pcbnew/tools/grid_helper.h +++ b/pcbnew/tools/grid_helper.h @@ -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;