Fixes: lp:1687014 Footpring editor disappearing axes crosshair

https://bugs.launchpad.net/kicad/+bug/1687014
This commit is contained in:
jean-pierre charras 2017-04-29 11:43:02 +02:00
parent 862711b71a
commit a92ea8c75b
2 changed files with 16 additions and 12 deletions

View File

@ -938,23 +938,14 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition,
void OPENGL_GAL::DrawGrid() void OPENGL_GAL::DrawGrid()
{ {
int gridScreenSizeDense = KiROUND( gridSize.x * worldScale ); SetTarget( TARGET_NONCACHED );
int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast<double>( gridTick ) * worldScale ); compositor->SetBuffer( mainBuffer );
// sub-pixel lines all render the same // sub-pixel lines all render the same
double minorLineWidth = std::max( 1.0, gridLineWidth ); double minorLineWidth = std::max( 1.0, gridLineWidth );
double majorLineWidth = minorLineWidth * 2.0; double majorLineWidth = minorLineWidth * 2.0;
const double gridThreshold = computeMinGridSpacing(); // Draw the axis and grid
// Check if the grid would not be too dense
if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) < gridThreshold )
return;
SetTarget( TARGET_NONCACHED );
compositor->SetBuffer( mainBuffer );
// Draw the grid
// For the drawing the start points, end points and increments have // For the drawing the start points, end points and increments have
// to be calculated in world coordinates // to be calculated in world coordinates
VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 ); VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 );
@ -980,6 +971,15 @@ void OPENGL_GAL::DrawGrid()
if( !gridVisibility ) if( !gridVisibility )
return; return;
int gridScreenSizeDense = KiROUND( gridSize.x * worldScale );
int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast<double>( gridTick ) * worldScale );
const double gridThreshold = computeMinGridSpacing();
// Check if the grid would not be too dense
if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) < gridThreshold )
return;
// Compute grid variables // Compute grid variables
int gridStartX = KiROUND( worldStartPoint.x / gridSize.x ); int gridStartX = KiROUND( worldStartPoint.x / gridSize.x );
int gridEndX = KiROUND( worldEndPoint.x / gridSize.x ); int gridEndX = KiROUND( worldEndPoint.x / gridSize.x );

View File

@ -989,5 +989,9 @@ void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable ); PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable );
if( aEnable ) if( aEnable )
{
// Be sure the axis are enabled:
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
updateView(); updateView();
} }
}