Don't set the viewport when switching screens.

That's the job of ZoomAutomatique().

Fixes: lp:1799436
* https://bugs.launchpad.net/kicad/+bug/1799436
This commit is contained in:
Jeff Young 2018-11-04 16:37:29 +00:00
parent df562b7ec0
commit fec8ab372e
3 changed files with 2 additions and 42 deletions

View File

@ -1454,43 +1454,6 @@ void VIEW::UpdateAllItemsConditionally( int aUpdateFlags,
} }
struct VIEW::extentsVisitor
{
BOX2I extents;
bool first;
extentsVisitor()
{
first = true;
}
bool operator()( VIEW_ITEM* aItem )
{
if( first )
extents = aItem->ViewBBox();
else
extents.Merge( aItem->ViewBBox() );
return false;
}
};
const BOX2I VIEW::CalculateExtents()
{
extentsVisitor v;
BOX2I fullScene;
fullScene.SetMaximum();
for( VIEW_LAYER* l : m_orderedLayers )
{
l->items->Query( fullScene, v );
}
return v.extents;
}
std::unique_ptr<VIEW> VIEW::DataReference() const std::unique_ptr<VIEW> VIEW::DataReference() const
{ {
auto ret = std::make_unique<VIEW>(); auto ret = std::make_unique<VIEW>();

View File

@ -1528,16 +1528,15 @@ void SCH_EDIT_FRAME::ShowChangedLanguage()
UpdateMsgPanel(); UpdateMsgPanel();
} }
void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen ) void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
{ {
EDA_DRAW_FRAME::SetScreen( aScreen ); EDA_DRAW_FRAME::SetScreen( aScreen );
auto c = static_cast<SCH_DRAW_PANEL*>(m_canvas); auto c = static_cast<SCH_DRAW_PANEL*>(m_canvas);
c->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) ); c->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
auto bb = c->GetView()->CalculateExtents() ;
BOX2D bb2 ( bb.GetOrigin(), bb.GetSize() );
c->GetView()->SetViewport( bb2 );
} }
const BOX2I SCH_EDIT_FRAME::GetDocumentExtents() const const BOX2I SCH_EDIT_FRAME::GetDocumentExtents() const
{ {
int sizeX = GetScreen()->GetPageSettings().GetWidthIU(); int sizeX = GetScreen()->GetPageSettings().GetWidthIU();

View File

@ -651,8 +651,6 @@ public:
void UpdateAllItemsConditionally( int aUpdateFlags, void UpdateAllItemsConditionally( int aUpdateFlags,
std::function<bool( VIEW_ITEM* )> aCondition ); std::function<bool( VIEW_ITEM* )> aCondition );
const BOX2I CalculateExtents() ;
/** /**
* Function IsUsingDrawPriority() * Function IsUsingDrawPriority()
* @return true if draw priority is being respected while redrawing. * @return true if draw priority is being respected while redrawing.