Fix issues with Intersheet Ref highlighting and hover actions.

This commit is contained in:
Jeff Young 2020-11-18 12:02:52 +00:00
parent 04a3619428
commit bd1f262a6b
2 changed files with 34 additions and 37 deletions

View File

@ -411,7 +411,7 @@ void SCH_PAINTER::draw( LIB_PART *aPart, int aLayer, bool aDrawFields, int aUnit
drawnPart = tmpPart.get();
}
for( auto& item : drawnPart->GetDrawItems() )
for( const LIB_ITEM& item : drawnPart->GetDrawItems() )
{
if( !aDrawFields && item.Type() == LIB_FIELD_T )
continue;
@ -1574,9 +1574,8 @@ void SCH_PAINTER::draw( SCH_GLOBALLABEL *aLabel, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aLabel->IsSelected() )
return;
if( !drawingShadows || aLabel->IsSelected() )
{
COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows );
std::vector<wxPoint> pts;
@ -1584,16 +1583,13 @@ void SCH_PAINTER::draw( SCH_GLOBALLABEL *aLabel, int aLayer )
aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
for( auto p : pts )
for( const wxPoint& p : pts )
pts2.emplace_back( VECTOR2D( p.x, p.y ) );
// the text is drawn inside the graphic shape.
// On Cairo the graphic shape is filled by the background
// before drawing the text ().
// However if the text is selected, it is draw twice:
// first, on LAYER_SELECTION_SHADOWS
// second, on the text layer.
// the second must not erase the first drawing.
// The text is drawn inside the graphic shape.
// On Cairo the graphic shape is filled by the background before drawing the text.
// However if the text is selected, it is draw twice: first on LAYER_SELECTION_SHADOWS
// and second on the text layer. The second must not erase the first drawing.
bool fillBg = ( aLayer == LAYER_SELECTION_SHADOWS ) || !aLabel->IsSelected();
m_gal->SetIsFill( fillBg );
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
@ -1603,8 +1599,12 @@ void SCH_PAINTER::draw( SCH_GLOBALLABEL *aLabel, int aLayer )
m_gal->DrawPolyline( pts2 );
draw( static_cast<SCH_TEXT*>( aLabel ), aLayer );
}
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children || !aLabel->IsSelected() )
{
draw( aLabel->GetIntersheetRefs(), aLayer );
}
}

View File

@ -512,7 +512,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
displayWireCursor = true;
}
else if( collector[0]->IsHypertext()
&& ( !m_additive && !m_subtractive && !m_exclusive_or ) )
&& !collector[0]->IsSelected()
&& !m_additive && !m_subtractive && !m_exclusive_or )
{
rolloverItem = collector[0]->m_Uuid;
}
@ -555,13 +556,19 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( m_frame->ToolStackIsEmpty() )
{
if( displayWireCursor )
{
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LINE_WIRE_ADD );
}
else if( rolloverItem != niluuid )
{
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::HAND );
}
else if( !modifier_enabled && !m_selection.Empty()
&& !m_frame->GetDragSelects() && evt->HasPosition()
&& selectionContains( evt->Position() ) ) //move/drag option prediction
{
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
}
else
{
if( m_additive )
@ -660,16 +667,6 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, EDA_ITEM** aItem,
{
m_selection.ClearReferencePoint();
// Unmodified clicking of hypertext items results in hypertext actions rather than selection.
if( !aAdd && !aSubtract && !aExclusiveOr )
{
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
{
if( aCollector[i]->IsHypertext() )
aCollector.Remove( i );
}
}
// If still more than one item we're going to have to ask the user.
if( aCollector.GetCount() > 1 )
{