Schematic: fix XOR unselecting one end of fully selected line

This commit is contained in:
Mike Williams 2022-12-01 14:59:22 -05:00
parent 9e0515a79a
commit 8f646fa9fb
1 changed files with 9 additions and 2 deletions

View File

@ -902,9 +902,10 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a
for( int i = 0; i < aCollector.GetCount(); ++i ) for( int i = 0; i < aCollector.GetCount(); ++i )
{ {
EDA_ITEM_FLAGS flags = 0; EDA_ITEM_FLAGS flags = 0;
bool isLine = aCollector[i]->Type() == SCH_LINE_T;
// Handle line ends specially // Handle line ends specially
if( aCollector[i]->Type() == SCH_LINE_T ) if( isLine )
{ {
SCH_LINE* line = (SCH_LINE*) aCollector[i]; SCH_LINE* line = (SCH_LINE*) aCollector[i];
@ -916,10 +917,16 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a
flags = STARTPOINT | ENDPOINT; flags = STARTPOINT | ENDPOINT;
} }
if( aSubtract || ( aExclusiveOr && aCollector[i]->IsSelected() ) ) if( aSubtract
|| ( aExclusiveOr && aCollector[i]->IsSelected()
&& ( !isLine || ( isLine && aCollector[i]->HasFlag( flags ) ) ) ) )
{ {
aCollector[i]->ClearFlags( flags ); aCollector[i]->ClearFlags( flags );
// Need to update end shadows after ctrl-click unselecting one of two selected endpoints
if( isLine )
getView()->Update( aCollector[i] );
if( !aCollector[i]->HasFlag( STARTPOINT ) && !aCollector[i]->HasFlag( ENDPOINT ) ) if( !aCollector[i]->HasFlag( STARTPOINT ) && !aCollector[i]->HasFlag( ENDPOINT ) )
{ {
unselect( aCollector[i] ); unselect( aCollector[i] );