kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #30602
[PATCH] Make BRIGHT_BOX line width dependent on zoom level
Hi all,
This patch is a quick one to make the line width of the BRIGHT_BOX
dependent on the zoom level so that it remains basically the same apparent
size on the screen.
-Jon
From fe5c8f7879c8c74ad67ea2c45a1945a9692150e7 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Tue, 5 Sep 2017 20:22:42 -0400
Subject: [PATCH] Make BRIGHT_BOX line width dependent on zoom level
---
common/preview_items/bright_box.cpp | 5 +++--
pcbnew/tools/pcb_bright_box.cpp | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/common/preview_items/bright_box.cpp b/common/preview_items/bright_box.cpp
index cc55dfa37..18e87b79c 100644
--- a/common/preview_items/bright_box.cpp
+++ b/common/preview_items/bright_box.cpp
@@ -28,7 +28,7 @@
using namespace KIGFX;
-const double BRIGHT_BOX::LINE_WIDTH = 10000.0;
+const double BRIGHT_BOX::LINE_WIDTH = 10.0;
const COLOR4D BRIGHT_BOX::BOX_COLOR = KIGFX::COLOR4D( 0.0, 1.0, 0.0, 1.0 );
BRIGHT_BOX::BRIGHT_BOX() :
@@ -49,7 +49,8 @@ void BRIGHT_BOX::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
gal->SetIsStroke( true );
gal->SetIsFill( false );
- gal->SetLineWidth( m_lineWidth );
+ double scale = gal->GetWorldScale();
+ gal->SetLineWidth( m_lineWidth / scale );
gal->SetStrokeColor( m_color );
BOX2I box = m_item->ViewBBox();
diff --git a/pcbnew/tools/pcb_bright_box.cpp b/pcbnew/tools/pcb_bright_box.cpp
index aee6462cb..b9e1d254b 100644
--- a/pcbnew/tools/pcb_bright_box.cpp
+++ b/pcbnew/tools/pcb_bright_box.cpp
@@ -27,7 +27,7 @@
using namespace KIGFX;
-const double PCB_BRIGHT_BOX::PCB_LINE_WIDTH = 100000.0;
+const double PCB_BRIGHT_BOX::PCB_LINE_WIDTH = 10.0;
PCB_BRIGHT_BOX::PCB_BRIGHT_BOX() :
@@ -50,7 +50,8 @@ void PCB_BRIGHT_BOX::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
gal->SetIsStroke( true );
gal->SetIsFill( false );
- gal->SetLineWidth( m_lineWidth );
+ double scale = gal->GetWorldScale();
+ gal->SetLineWidth( m_lineWidth / scale );
gal->SetStrokeColor( m_color );
gal->DrawSegment( track->GetStart(), track->GetEnd(), track->GetWidth() );
--
2.11.0
Follow ups