Handle flipped state when checkging item against viewport.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15768
(cherry picked from commit 3c1478367f
)
This commit is contained in:
parent
e6e29b6c4c
commit
c3446f9c2d
|
@ -106,14 +106,22 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
||||||
|
|
||||||
buildDrawList( aView, m_properties, &drawList );
|
buildDrawList( aView, m_properties, &drawList );
|
||||||
|
|
||||||
|
BOX2I viewport( aView->GetViewport().GetOrigin(), aView->GetViewport().GetSize() );
|
||||||
|
|
||||||
// Draw the title block normally even if the view is flipped
|
// Draw the title block normally even if the view is flipped
|
||||||
bool flipped = gal->IsFlippedX();
|
bool flipped = gal->IsFlippedX();
|
||||||
|
|
||||||
if( flipped )
|
if( flipped )
|
||||||
{
|
{
|
||||||
|
int pageWidth = m_pageInfo->GetWidthMils() * m_mils2IUscalefactor;
|
||||||
|
|
||||||
gal->Save();
|
gal->Save();
|
||||||
gal->Translate( VECTOR2D( m_pageInfo->GetWidthMils() * m_mils2IUscalefactor, 0 ) );
|
gal->Translate( VECTOR2D( pageWidth, 0 ) );
|
||||||
gal->Scale( VECTOR2D( -1.0, 1.0 ) );
|
gal->Scale( VECTOR2D( -1.0, 1.0 ) );
|
||||||
|
|
||||||
|
int right = pageWidth - viewport.GetLeft();
|
||||||
|
int left = right - viewport.GetWidth();
|
||||||
|
viewport.SetOrigin( left, viewport.GetTop() );
|
||||||
}
|
}
|
||||||
|
|
||||||
DS_PAINTER ws_painter( gal );
|
DS_PAINTER ws_painter( gal );
|
||||||
|
@ -126,8 +134,6 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
||||||
ws_settings->SetDefaultFont( settings->GetDefaultFont() );
|
ws_settings->SetDefaultFont( settings->GetDefaultFont() );
|
||||||
|
|
||||||
// Draw all the components that make the drawing sheet
|
// Draw all the components that make the drawing sheet
|
||||||
BOX2I viewport( aView->GetViewport().GetOrigin(), aView->GetViewport().GetSize() );
|
|
||||||
|
|
||||||
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
|
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
|
||||||
{
|
{
|
||||||
if( viewport.Intersects( item->GetApproxBBox() ) )
|
if( viewport.Intersects( item->GetApproxBBox() ) )
|
||||||
|
|
Loading…
Reference in New Issue