Bring back consideration of world scale to PcbNew snapping
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7125
This commit is contained in:
parent
08d595c9bf
commit
38455c25ef
|
@ -320,8 +320,16 @@ VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, BOARD_ITEM* aDrag
|
||||||
VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLayers,
|
VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLayers,
|
||||||
const std::vector<BOARD_ITEM*>& aSkip )
|
const std::vector<BOARD_ITEM*>& aSkip )
|
||||||
{
|
{
|
||||||
int snapDist = GetGrid().x;
|
// Tuning constant: snap radius in screen space
|
||||||
int snapRange = snapDist;
|
const int snapSize = 25;
|
||||||
|
|
||||||
|
// Snapping distance is in screen space, clamped to the current grid to ensure that the grid
|
||||||
|
// points that are visible can always be snapped to.
|
||||||
|
// see https://gitlab.com/kicad/code/kicad/-/issues/5638
|
||||||
|
// see https://gitlab.com/kicad/code/kicad/-/issues/7125
|
||||||
|
double snapScale = snapSize / m_toolMgr->GetView()->GetGAL()->GetWorldScale();
|
||||||
|
int snapRange = std::min( KiROUND( snapScale ), GetGrid().x );
|
||||||
|
int snapDist = snapRange;
|
||||||
|
|
||||||
BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ),
|
BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ),
|
||||||
VECTOR2I( snapRange, snapRange ) );
|
VECTOR2I( snapRange, snapRange ) );
|
||||||
|
|
Loading…
Reference in New Issue