mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Hit-test pads before computing their anchors.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19238
This commit is contained in:
parent
6150586f01
commit
a910eaf081
@ -417,7 +417,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
setCursor();
|
||||
|
||||
VECTOR2I cursorPos = grid.AlignToNearestPad( getViewControls()->GetMousePosition(), pads );
|
||||
VECTOR2I cursorPos = grid.SnapToPad( getViewControls()->GetMousePosition(), pads );
|
||||
getViewControls()->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
|
@ -391,12 +391,15 @@ VECTOR2I PCB_GRID_HELPER::AlignToArc( const VECTOR2I& aPoint, const SHAPE_ARC& a
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I PCB_GRID_HELPER::AlignToNearestPad( const VECTOR2I& aMousePos, std::deque<PAD*>& aPads )
|
||||
VECTOR2I PCB_GRID_HELPER::SnapToPad( const VECTOR2I& aMousePos, std::deque<PAD*>& aPads )
|
||||
{
|
||||
clearAnchors();
|
||||
|
||||
for( BOARD_ITEM* item : aPads )
|
||||
computeAnchors( item, aMousePos, true, nullptr );
|
||||
{
|
||||
if( item->HitTest( aMousePos ) )
|
||||
computeAnchors( item, aMousePos, true, nullptr );
|
||||
}
|
||||
|
||||
double minDist = std::numeric_limits<double>::max();
|
||||
ANCHOR* nearestOrigin = nullptr;
|
||||
@ -406,15 +409,6 @@ VECTOR2I PCB_GRID_HELPER::AlignToNearestPad( const VECTOR2I& aMousePos, std::deq
|
||||
if( ( ORIGIN & a.flags ) != ORIGIN )
|
||||
continue;
|
||||
|
||||
bool hitAny = true;
|
||||
for( EDA_ITEM* item : m_snapItem->items )
|
||||
{
|
||||
hitAny = hitAny && item->HitTest( aMousePos );
|
||||
}
|
||||
|
||||
if( !hitAny )
|
||||
continue;
|
||||
|
||||
double dist = a.Distance( aMousePos );
|
||||
|
||||
if( dist < minDist )
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
|
||||
VECTOR2I AlignToArc ( const VECTOR2I& aPoint, const SHAPE_ARC& aSeg );
|
||||
|
||||
VECTOR2I AlignToNearestPad( const VECTOR2I& aMousePos, std::deque<PAD*>& aPads );
|
||||
VECTOR2I SnapToPad( const VECTOR2I& aMousePos, std::deque<PAD*>& aPads );
|
||||
|
||||
virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user