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
This commit is contained in:
Seth Hillbrand 2021-10-06 10:20:07 -07:00
parent eb5f5a71a5
commit 2c7da5e2bd
3 changed files with 20 additions and 3 deletions

View File

@ -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 );
}

View File

@ -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 );

View File

@ -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<EDA_ITEM*> items = m_selectionTool->RequestSelection( nonFields ).GetItems();
if( items.empty() )
return 0;