7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 11:21:41 +00:00

pcbnew: Drag-selecting while creating a Text breaks PCB editor tools

CHANGED: drawing_tool.cpp: DRAWING_TOOL::PlaceText method ignores events when mouse drag is detected.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20010
This commit is contained in:
Damjan 2025-02-27 16:47:21 +00:00 committed by Seth Hillbrand
parent 144e660684
commit 230a976742

View File

@ -931,7 +931,11 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
COORDS_PADDING );
m_controls->ForceCursorPosition( true, cursorPos );
if( evt->IsCancelInteractive() || ( text && evt->IsAction( &ACTIONS::undo ) ) )
if( evt->IsDrag() )
{
continue;
}
else if( evt->IsCancelInteractive() || ( text && evt->IsAction( &ACTIONS::undo ) ) )
{
if( text )
{
@ -996,16 +1000,17 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
text->SetLayer( layer );
text->SetAttributes( textAttrs );
text->SetTextPos( cursorPos );
text->SetFlags( IS_NEW ); // Prevent double undo commits
text->SetFlags( IS_NEW ); // Prevent double undo commits
DIALOG_TEXT_PROPERTIES textDialog( m_frame, text );
bool cancelled;
bool cancelled;
RunMainStack( [&]()
{
// QuasiModal required for Scintilla auto-complete
cancelled = !textDialog.ShowQuasiModal();
} );
RunMainStack(
[&]()
{
// QuasiModal required for Scintilla auto-complete
cancelled = !textDialog.ShowQuasiModal();
} );
if( cancelled || NoPrintableChars( text->GetText() ) )
{
@ -1070,15 +1075,15 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
m_controls->CaptureCursor( text != nullptr );
m_controls->SetAutoPan( text != nullptr );
}
else if( text && ( evt->IsMotion()
|| evt->IsAction( &PCB_ACTIONS::refreshPreview ) ) )
else if( text && ( evt->IsMotion() || evt->IsAction( &PCB_ACTIONS::refreshPreview ) ) )
{
text->SetPosition( cursorPos );
selection().SetReferencePoint( cursorPos );
m_view->Update( &selection() );
}
else if( text && ( ZONE_FILLER_TOOL::IsZoneFillAction( evt )
|| evt->IsAction( &ACTIONS::redo ) ) )
else if( text
&& ( ZONE_FILLER_TOOL::IsZoneFillAction( evt )
|| evt->IsAction( &ACTIONS::redo ) ) )
{
wxBell();
}