Change pin on grid test in symbol editor.

The pin on grid test always used a fixed grid spacing of 25 mils.  The
change uses the current grid setting for the on grid test.  Grid sizes
below 25 mils are clamped to 25 mils to prevent issues when connecting
wires to pins in the schematic editor.

Fixes lp:1817896

https://bugs.launchpad.net/kicad/+bug/1817896
This commit is contained in:
Frank Severinsen 2019-02-28 09:32:32 -05:00 committed by Wayne Stambaugh
parent a391e5a236
commit 71a62bb782
1 changed files with 6 additions and 3 deletions

View File

@ -594,7 +594,10 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
if( !part )
return;
const int MIN_GRID_SIZE = 25;
wxRealPoint curr_grid_size = GetScreen()->GetGridSize();
const int min_grid_size = 25;
const int grid_size = KiROUND( curr_grid_size.x );
const int clamped_grid_size = ( grid_size < min_grid_size ) ? min_grid_size : grid_size;
LIB_PINS pinList;
@ -672,8 +675,8 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
{
LIB_PIN* pin = pinList[ii];
if( ( (pin->GetPosition().x % MIN_GRID_SIZE) == 0 ) &&
( (pin->GetPosition().y % MIN_GRID_SIZE) == 0 ) )
if( ( (pin->GetPosition().x % clamped_grid_size) == 0 ) &&
( (pin->GetPosition().y % clamped_grid_size) == 0 ) )
continue;
// "pin" is off grid here.