Don't use snapping for a selection interaction
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6856
This commit is contained in:
parent
be294dabce
commit
55394f343d
|
@ -909,6 +909,7 @@ int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
|
|||
} );
|
||||
|
||||
picker->SetLayerSet( LSET::AllCuMask() );
|
||||
picker->SetSnapping( false );
|
||||
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
|
||||
|
|
|
@ -61,15 +61,20 @@ int PCB_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
VECTOR2D cursorPos;
|
||||
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
setCursor();
|
||||
cursorPos = controls->GetMousePosition();
|
||||
|
||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
|
||||
VECTOR2I cursorPos = grid.BestSnapAnchor( controls->GetMousePosition(), nullptr );
|
||||
controls->ForceCursorPosition(true, cursorPos );
|
||||
if( m_snap )
|
||||
{
|
||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
|
||||
cursorPos = grid.BestSnapAnchor( cursorPos, nullptr );
|
||||
controls->ForceCursorPosition( true, cursorPos );
|
||||
}
|
||||
|
||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||
{
|
||||
|
@ -181,6 +186,7 @@ void PCB_PICKER_TOOL::reset()
|
|||
{
|
||||
m_layerMask = LSET::AllLayersMask();
|
||||
m_cursor = KICURSOR::ARROW;
|
||||
m_snap = true;
|
||||
|
||||
m_picked = NULLOPT;
|
||||
m_clickHandler = NULLOPT;
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
|
||||
inline void SetCursor( KICURSOR aCursor ) { m_cursor = aCursor; }
|
||||
|
||||
inline void SetSnapping( bool aSnap ) { m_snap = aSnap; }
|
||||
/**
|
||||
* Function SetClickHandler()
|
||||
* Sets a handler for mouse click event. Handler may decide to receive further click by
|
||||
|
@ -121,6 +122,7 @@ private:
|
|||
///> The layer set to use for optional snapping
|
||||
LSET m_layerMask;
|
||||
KICURSOR m_cursor;
|
||||
bool m_snap;
|
||||
|
||||
OPT<CLICK_HANDLER> m_clickHandler;
|
||||
OPT<MOTION_HANDLER> m_motionHandler;
|
||||
|
|
Loading…
Reference in New Issue