Fix off-grid block paste
Center point of a block may not always be located on a grid point, therefore it needs to be rounded to the grid size to prevent off grid component placement.
This commit is contained in:
parent
6e2b7521d0
commit
cbf74d6939
|
@ -540,7 +540,8 @@ bool SCH_BASE_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
|
|||
InitBlockPasteInfos();
|
||||
|
||||
KIGFX::PREVIEW::SELECTION_AREA* sel = GetCanvas()->GetView()->GetSelectionArea();
|
||||
VECTOR2I offsetToCenter = ( sel->GetOrigin() - sel->GetEnd() ) / 2;
|
||||
VECTOR2I offsetToCenter = GetCanvas()->GetGAL()->GetGridPoint(
|
||||
( sel->GetOrigin() - sel->GetEnd() ) / 2 );
|
||||
block->SetLastCursorPosition( wxPoint( offsetToCenter.x, offsetToCenter.y ) );
|
||||
|
||||
if( block->GetCount() == 0 ) // No data to paste
|
||||
|
|
Loading…
Reference in New Issue