diff --git a/eeschema/tools/ee_grid_helper.cpp b/eeschema/tools/ee_grid_helper.cpp index 9d31e3c79d..c28149094d 100644 --- a/eeschema/tools/ee_grid_helper.cpp +++ b/eeschema/tools/ee_grid_helper.cpp @@ -44,7 +44,6 @@ EE_GRID_HELPER::EE_GRID_HELPER( TOOL_MANAGER* aToolMgr ) : { m_enableSnap = true; m_enableSnapLine = true; - m_snapSize = 25; m_snapItem = nullptr; KIGFX::VIEW* view = m_toolMgr->GetView(); @@ -251,9 +250,8 @@ VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, SCH_ITEM* aDra VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLayers, const std::vector& aSkip ) { - double worldScale = m_toolMgr->GetView()->GetGAL()->GetWorldScale(); - double snapDist = m_snapSize / worldScale; - int snapRange = KiROUND( snapDist ); + int snapDist = GetGrid().x; + int snapRange = snapDist; BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ), VECTOR2I( snapRange, snapRange ) ); @@ -291,7 +289,6 @@ VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aL if( snapLine && m_skipPoint != VECTOR2I( m_viewSnapLine.GetPosition() ) ) { m_viewSnapLine.SetEndPosition( nearestGrid ); - m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, false ); if( m_toolMgr->GetView()->IsVisible( &m_viewSnapLine ) ) m_toolMgr->GetView()->Update( &m_viewSnapLine, KIGFX::GEOMETRY ); diff --git a/eeschema/tools/ee_grid_helper.h b/eeschema/tools/ee_grid_helper.h index 3b9dd7322f..04472b6c7c 100644 --- a/eeschema/tools/ee_grid_helper.h +++ b/eeschema/tools/ee_grid_helper.h @@ -147,7 +147,6 @@ private: bool m_enableSnap; // If true, allow snapping to other items on the layers bool m_enableSnapLine; // If true, allow drawing lines from snap points - int m_snapSize; // Sets the radius in screen units for snapping to items ANCHOR* m_snapItem; // Pointer to the currently snapped item in m_anchors // (NULL if not snapped) VECTOR2I m_skipPoint; // When drawing a line, we avoid snapping to the source point diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index 2a3c3e8bc4..e73850b1ee 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -52,7 +52,6 @@ GRID_HELPER::GRID_HELPER( TOOL_MANAGER* aToolMgr, MAGNETIC_SETTINGS* aMagneticSe m_enableSnap = true; m_enableGrid = true; m_enableSnapLine = true; - m_snapSize = 25; m_snapItem = nullptr; KIGFX::VIEW* view = m_toolMgr->GetView(); @@ -305,9 +304,8 @@ VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, BOARD_ITEM* aDrag VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLayers, const std::vector& aSkip ) { - double worldScale = m_toolMgr->GetView()->GetGAL()->GetWorldScale(); - double snapDist = m_snapSize / worldScale; - int snapRange = KiROUND( snapDist ); + int snapDist = GetGrid().x; + int snapRange = snapDist; BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ), VECTOR2I( snapRange, snapRange ) ); @@ -346,7 +344,6 @@ VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLaye if( snapLine && m_skipPoint != VECTOR2I( m_viewSnapLine.GetPosition() ) ) { m_viewSnapLine.SetEndPosition( nearestGrid ); - m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, false ); if( m_toolMgr->GetView()->IsVisible( &m_viewSnapLine ) ) m_toolMgr->GetView()->Update( &m_viewSnapLine, KIGFX::GEOMETRY ); diff --git a/pcbnew/tools/grid_helper.h b/pcbnew/tools/grid_helper.h index e9e2f43718..69199ad026 100644 --- a/pcbnew/tools/grid_helper.h +++ b/pcbnew/tools/grid_helper.h @@ -153,7 +153,6 @@ private: bool m_enableSnap; // If true, allow snapping to other items on the layers bool m_enableGrid; // If true, allow snapping to grid bool m_enableSnapLine; // If true, allow drawing lines from snap points - int m_snapSize; // Sets the radius in screen units for snapping to items ANCHOR* m_snapItem; // Pointer to the currently snapped item in m_anchors // (NULL if not snapped) VECTOR2I m_skipPoint; // When drawing a line, we avoid snapping to the source point