View is automatically centered when a module editor or viewer are opened (GAL).
This commit is contained in:
parent
4fc4ea6147
commit
1d378cfcd1
|
@ -55,8 +55,8 @@ void CAIRO_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
|
|||
{
|
||||
clean();
|
||||
|
||||
assert( m_width > 0 );
|
||||
assert( m_height > 0 );
|
||||
assert( aWidth > 0 );
|
||||
assert( aHeight > 0 );
|
||||
|
||||
m_width = aWidth;
|
||||
m_height = aHeight;
|
||||
|
|
|
@ -696,6 +696,6 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
|
|||
void FOOTPRINT_EDIT_FRAME::updateView()
|
||||
{
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
|
||||
m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen, true );
|
||||
}
|
||||
|
|
|
@ -884,24 +884,10 @@ void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
|
||||
void FOOTPRINT_VIEWER_FRAME::updateView()
|
||||
{
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
|
||||
|
||||
m_Pcb->ComputeBoundingBox( false );
|
||||
EDA_RECT boardBbox = m_Pcb->GetBoundingBox();
|
||||
BOX2D bbox;
|
||||
|
||||
// Autozoom
|
||||
if( boardBbox.GetSize().x > 0 && boardBbox.GetSize().y > 0 )
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
bbox.SetOrigin( VECTOR2D( boardBbox.GetOrigin() ) );
|
||||
bbox.SetSize( VECTOR2D( boardBbox.GetSize() ) );
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default empty view
|
||||
bbox.SetOrigin( VECTOR2D( -1000, -1000 ) );
|
||||
bbox.SetSize( VECTOR2D( 2000, 2000 ) );
|
||||
}
|
||||
|
||||
GetGalCanvas()->GetView()->SetViewport( bbox );
|
||||
}
|
||||
|
|
|
@ -109,7 +109,9 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
|
|||
{
|
||||
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
|
||||
KIGFX::GAL* gal = m_frame->GetGalCanvas()->GetGAL();
|
||||
BOX2I boardBBox = getModel<BOARD>()->ViewBBox();
|
||||
BOARD* board = getModel<BOARD>();
|
||||
board->ComputeBoundingBox();
|
||||
BOX2I boardBBox = board->ViewBBox();
|
||||
|
||||
if( boardBBox.GetSize().x == 0 || boardBBox.GetSize().y == 0 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue