← Back to team overview

kicad-developers team mailing list archive

[PATCH] Ensure DrawRectangle() stroke outline will always be visible

 

SELECTION_AREA::ViewDraw() doesn't set the line width.  I thought about
fixing it by adding a call to set some kind of arbitrary width, but decided
to do it a different way to be more generally applicable.  Despite my
saying that, this is still more of a workaround than a real fix.

Note that this is probably a topic that wants future thought after V5:
There is currently no easy way to draw things in screen space rather than
world space.  Maybe I will think about how to add an easy-to-use mechanism
to the GAL to accomplish this.  Sometimes you really just want a line that
is 1px wide ;-)

Fixes: https://bugs.launchpad.net/kicad/+bug/1743242

-Jon
From dfdc609eb108f2f8b9c77043abb4511192930c0c Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Mon, 15 Jan 2018 23:05:16 -0500
Subject: [PATCH] Ensure DrawRectangle() stroke outline will always be visible

Fixes: lp:1743242
* https://bugs.launchpad.net/kicad/+bug/1743242
---
 common/gal/opengl/opengl_gal.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index 608c11714..9b4654446 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -688,6 +688,9 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn
     // Stroke the outline
     if( isStrokeEnabled )
     {
+        // Ensure stroke will be visible at current zoom
+        lineWidth = std::max( lineWidth, ( 1.01 / worldScale ) );
+
         currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
 
         std::deque<VECTOR2D> pointList;
-- 
2.14.1


Follow ups