← Back to team overview

kicad-developers team mailing list archive

[PATCH] PCBnew: Fixes crosshair issue with "Place Text" and "Add Dimension".

 

Hi,

I've been a user and fan of Kicad for the last two years, I enjoyed
the presentations from Kicon on the Contextual Electronics YouTube
channel and particularly the talk from Jon Evans has spurred me on to
try help.

The attached patch address a low priority bug for the 5.1.3 release,
it would be great if someone could review it and give me feedback it's
literally only 2 lines of code!.

Cheers,
Martin

>From de632284b75ce00d0a00b3c1d3ba80b2299449f3 Mon Sep 17 00:00:00 2001
From: Martin McNamara <martin.mcnamara@xxxxxxxxx>
Date: Sat, 11 May 2019 09:02:59 +0100
Subject: [PATCH] PCBnew: Fixes crosshair issue with "Place Text" and "Add
 Dimension".

When using "Place Text" the crosshair was freezing if cancelled before
placing text.

After the crosshair freezes, the next uses of the "Place Text" or
"Add Dimension" caused the crosshair to jump to the screen location
where the previously the crosshair was frozen.

Cancelling the "Add Dimension" caused the crosshair to jump to the
screen location where the crosshair was when cancelled on the next use
of the "Place Text" or "Add Dimension".

Fixes: lp:1822578
* https://bugs.launchpad.net/kicad/+bug/1822578
---
 pcbnew/tools/drawing_tool.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp
index c118c1ea2..1af547d5b 100644
--- a/pcbnew/tools/drawing_tool.cpp
+++ b/pcbnew/tools/drawing_tool.cpp
@@ -433,7 +433,10 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
                     } );

                     if( textPcb->GetText().IsEmpty() )
+                    {
+                        m_controls->ForceCursorPosition( false );
                         delete textPcb;
+                    }
                     else
                         text = textPcb;
                 }
@@ -678,6 +681,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
         delete dimension;

     m_controls->SetAutoPan( false );
+    m_controls->ForceCursorPosition( false );

     m_view->Remove( &preview );
     frame()->SetMsgPanel( board() );
--
2.21.0


Follow ups