diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 81941547a0..759d978fe2 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -938,23 +938,14 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition, void OPENGL_GAL::DrawGrid() { - int gridScreenSizeDense = KiROUND( gridSize.x * worldScale ); - int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast( gridTick ) * worldScale ); + SetTarget( TARGET_NONCACHED ); + compositor->SetBuffer( mainBuffer ); // sub-pixel lines all render the same double minorLineWidth = std::max( 1.0, gridLineWidth ); double majorLineWidth = minorLineWidth * 2.0; - const double gridThreshold = computeMinGridSpacing(); - - // 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 + // Draw the axis and grid // For the drawing the start points, end points and increments have // to be calculated in world coordinates VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 ); @@ -980,6 +971,15 @@ void OPENGL_GAL::DrawGrid() if( !gridVisibility ) return; + int gridScreenSizeDense = KiROUND( gridSize.x * worldScale ); + int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast( 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 int gridStartX = KiROUND( worldStartPoint.x / gridSize.x ); int gridEndX = KiROUND( worldEndPoint.x / gridSize.x ); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 8506cd370e..7cfa497f9b 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -989,5 +989,9 @@ void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable ) PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable ); if( aEnable ) + { + // Be sure the axis are enabled: + GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); updateView(); + } }