Pcbnew: Prevent footprint jumping when starting to drag it
CHANGED: When dragging a footprint, if the mouse isn't directly over the footprint anchor when 'D' is pressed, the footprint center will jump to the mouse position when dragging begins. This MR uses the current mouse position instead of the footprint anchor as the inital reference point when starting to drag. Fixes https://gitlab.com/kicad/code/kicad/issues/6813
This commit is contained in:
parent
0de924ab4c
commit
1c79e3174c
|
@ -1518,7 +1518,25 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( footprint )
|
||||
{
|
||||
p = footprint->GetPosition();
|
||||
// The mouse is going to be moved on grid before dragging begins.
|
||||
VECTOR2I tweakedMousePos;
|
||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||
|
||||
// Check if user wants to warp the mouse to origin of moved object
|
||||
|
||||
if( editFrame->GetMoveWarpsCursor() )
|
||||
tweakedMousePos = footprint->GetPosition(); // Use footprint anchor to warp mouse
|
||||
else
|
||||
tweakedMousePos = controls()->GetCursorPosition(); // Just use current mouse pos
|
||||
|
||||
// We tweak the mouse position using the value from above, and then use that as the
|
||||
// start position to prevent the footprint from jumping when we start dragging.
|
||||
// First we move the visual crosshair cursor...
|
||||
controls()->ForceCursorPosition( true, tweakedMousePos );
|
||||
controls()->SetCursorPosition( tweakedMousePos ); // ...then the mouse pointer
|
||||
|
||||
// Now that the mouse is in the right position, get a copy of the position to use later
|
||||
p = controls()->GetCursorPosition();
|
||||
}
|
||||
|
||||
int dragMode = aEvent.Parameter<int64_t> ();
|
||||
|
|
Loading…
Reference in New Issue