From 71a62bb7821ddecde6c39b6e81dc62b60c88fc6b Mon Sep 17 00:00:00 2001 From: Frank Severinsen Date: Thu, 28 Feb 2019 09:32:32 -0500 Subject: [PATCH] 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 --- eeschema/libedit/pinedit.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eeschema/libedit/pinedit.cpp b/eeschema/libedit/pinedit.cpp index 0d2c4ca5fd..4f47c03ef7 100644 --- a/eeschema/libedit/pinedit.cpp +++ b/eeschema/libedit/pinedit.cpp @@ -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.