From 2c7da5e2bd6b0045dff0274f34983ae9c7720275 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 6 Oct 2021 10:20:07 -0700 Subject: [PATCH] Handle deleting segment Edited point needs to clear to allow us to use the click timer for left-click after the drawing is deleted. Fixes https://gitlab.com/kicad/code/kicad/issues/9320 --- eeschema/tools/ee_point_editor.cpp | 16 +++++++++++++++- eeschema/tools/ee_point_editor.h | 3 +++ eeschema/tools/symbol_editor_edit_tool.cpp | 4 ++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index a6421585cf..1e65b449b0 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -212,6 +212,7 @@ void EE_POINT_EDITOR::Reset( RESET_REASON aReason ) EE_TOOL_BASE::Reset( aReason ); m_editPoints.reset(); + m_editedPoint = nullptr; } @@ -229,11 +230,23 @@ bool EE_POINT_EDITOR::Init() } +int EE_POINT_EDITOR::clearEditedPoints( const TOOL_EVENT& aEvent ) +{ + setEditedPoint( nullptr ); + + return 0; +} + + void EE_POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent ) { EDIT_POINT* point = m_editedPoint; - if( aEvent.IsMotion() ) + if( !m_editPoints ) + { + point = nullptr; + } + else if( aEvent.IsMotion() ) { point = m_editPoints->FindPoint( aEvent.Position(), getView() ); } @@ -911,6 +924,7 @@ void EE_POINT_EDITOR::setTransitions() Go( &EE_POINT_EDITOR::addCorner, EE_ACTIONS::pointEditorAddCorner.MakeEvent() ); Go( &EE_POINT_EDITOR::removeCorner, EE_ACTIONS::pointEditorRemoveCorner.MakeEvent() ); Go( &EE_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified ); + Go( &EE_POINT_EDITOR::clearEditedPoints, EVENTS::ClearedEvent ); } diff --git a/eeschema/tools/ee_point_editor.h b/eeschema/tools/ee_point_editor.h index 969a8ef34b..a7e17970d6 100644 --- a/eeschema/tools/ee_point_editor.h +++ b/eeschema/tools/ee_point_editor.h @@ -67,6 +67,9 @@ private: ///< Update which point is being edited. void updateEditedPoint( const TOOL_EVENT& aEvent ); + ///< Clear references to the points + int clearEditedPoints( const TOOL_EVENT& aEvent ); + ///< Set the current point being edited. NULL means none. void setEditedPoint( EDIT_POINT* aPoint ); diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp index 891f9fba50..89d62873fc 100644 --- a/eeschema/tools/symbol_editor_edit_tool.cpp +++ b/eeschema/tools/symbol_editor_edit_tool.cpp @@ -253,8 +253,8 @@ static KICAD_T nonFields[] = int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) { - LIB_SYMBOL* symbol = m_frame->GetCurSymbol(); - auto items = m_selectionTool->RequestSelection( nonFields ).GetItems(); + LIB_SYMBOL *symbol = m_frame->GetCurSymbol(); + std::deque items = m_selectionTool->RequestSelection( nonFields ).GetItems(); if( items.empty() ) return 0;