← Back to team overview

kicad-developers team mailing list archive

Re: GAL canvas strategy - testers needed!

 

One more patch to fix off grid component placement after paste
operation. Apart from that, the result is very impressive. Well done!

Cheers,
Orson

On 9/19/18 11:16 PM, Jeff Young wrote:
> A couple of more commits are up (including backing out the polyline change).
>From bbd0912ff57618884b915719ce895907159ffc53 Mon Sep 17 00:00:00 2001
From: Maciej Suminski <maciej.suminski@xxxxxxx>
Date: Sat, 22 Sep 2018 17:25:37 +0200
Subject: [PATCH] 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.
---
 eeschema/sch_base_frame.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index 589e0a60c..d897c2589 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -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
-- 
2.18.0


Follow ups

References