Fix hover/highlight of line edit points
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6104
This commit is contained in:
parent
3f48aca721
commit
35c7ba0a8a
|
@ -261,27 +261,33 @@ void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
double borderSize = aView->ToWorld( EDIT_POINT::BORDER_SIZE );
|
double borderSize = aView->ToWorld( EDIT_POINT::BORDER_SIZE );
|
||||||
double hoverSize = aView->ToWorld( EDIT_POINT::HOVER_SIZE );
|
double hoverSize = aView->ToWorld( EDIT_POINT::HOVER_SIZE );
|
||||||
|
|
||||||
for( const EDIT_POINT& point : m_points )
|
auto drawPoint =
|
||||||
{
|
[&]( const EDIT_POINT& aPoint, bool aDrawCircle = false )
|
||||||
if( point.IsHover() || point.IsActive() )
|
{
|
||||||
{
|
if( aPoint.IsHover() || aPoint.IsActive() )
|
||||||
gal->SetStrokeColor( highlightColor );
|
{
|
||||||
gal->SetLineWidth( hoverSize );
|
gal->SetStrokeColor( highlightColor );
|
||||||
}
|
gal->SetLineWidth( hoverSize );
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
gal->SetStrokeColor( bgColor );
|
{
|
||||||
gal->SetLineWidth( borderSize );
|
gal->SetStrokeColor( bgColor );
|
||||||
}
|
gal->SetLineWidth( borderSize );
|
||||||
|
}
|
||||||
|
|
||||||
gal->SetFillColor( point.IsActive() ? highlightColor : drawColor );
|
gal->SetFillColor( aPoint.IsActive() ? highlightColor : drawColor );
|
||||||
gal->DrawRectangle( point.GetPosition() - size, point.GetPosition() + size );
|
|
||||||
}
|
if( aDrawCircle )
|
||||||
|
gal->DrawCircle( aPoint.GetPosition(), size );
|
||||||
|
else
|
||||||
|
gal->DrawRectangle( aPoint.GetPosition() - size, aPoint.GetPosition() + size );
|
||||||
|
};
|
||||||
|
|
||||||
|
for( const EDIT_POINT& point : m_points )
|
||||||
|
drawPoint( point );
|
||||||
|
|
||||||
for( const EDIT_LINE& line : m_lines )
|
for( const EDIT_LINE& line : m_lines )
|
||||||
{
|
drawPoint( line, true );
|
||||||
gal->DrawCircle( line.GetPosition(), size );
|
|
||||||
}
|
|
||||||
|
|
||||||
gal->PopDepth();
|
gal->PopDepth();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue