When showing/hiding infobar, keep position
The infobar changes the size of the visible screen, so adding/removing it will shift the screen center, causing the position of onscreen objects to move up/down. This changes the sizing to pin the bottom corner position when showing/hiding the infobar Fixes https://gitlab.com/kicad/code/kicad/issues/5776
This commit is contained in:
parent
672756a018
commit
d535a4b833
|
@ -42,6 +42,8 @@
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
|
|
||||||
|
#include <widgets/infobar.h>
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
#include <profile.h>
|
#include <profile.h>
|
||||||
#endif /* PROFILE */
|
#endif /* PROFILE */
|
||||||
|
@ -262,12 +264,26 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
|
||||||
{
|
{
|
||||||
KIGFX::GAL_CONTEXT_LOCKER locker( m_gal );
|
KIGFX::GAL_CONTEXT_LOCKER locker( m_gal );
|
||||||
wxSize clientSize = GetClientSize();
|
wxSize clientSize = GetClientSize();
|
||||||
|
WX_INFOBAR* infobar = GetParentEDAFrame()->GetInfoBar();
|
||||||
|
|
||||||
|
if( VECTOR2I( clientSize ) == m_gal->GetScreenPixelSize() )
|
||||||
|
return;
|
||||||
|
|
||||||
clientSize.x = std::max( 10, clientSize.x );
|
clientSize.x = std::max( 10, clientSize.x );
|
||||||
clientSize.y = std::max( 10, clientSize.y );
|
clientSize.y = std::max( 10, clientSize.y );
|
||||||
|
|
||||||
|
VECTOR2D bottom( 0, 0 );
|
||||||
|
|
||||||
|
if( m_view )
|
||||||
|
bottom = m_view->ToWorld( m_gal->GetScreenPixelSize(), true );
|
||||||
|
|
||||||
m_gal->ResizeScreen( clientSize.GetX(), clientSize.GetY() );
|
m_gal->ResizeScreen( clientSize.GetX(), clientSize.GetY() );
|
||||||
|
|
||||||
if( m_view )
|
if( m_view )
|
||||||
{
|
{
|
||||||
|
if( infobar && infobar->IsLocked() )
|
||||||
|
m_view->SetCenter( bottom - m_view->ToWorld( clientSize, false ) / 2.0 );
|
||||||
|
|
||||||
m_view->MarkTargetDirty( KIGFX::TARGET_CACHED );
|
m_view->MarkTargetDirty( KIGFX::TARGET_CACHED );
|
||||||
m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,14 @@ public:
|
||||||
*/
|
*/
|
||||||
void QueueDismiss();
|
void QueueDismiss();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the infobar is being updated.
|
||||||
|
*/
|
||||||
|
bool IsLocked()
|
||||||
|
{
|
||||||
|
return m_updateLock;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Event handler for showing the infobar using a wxCommandEvent of the type
|
* Event handler for showing the infobar using a wxCommandEvent of the type
|
||||||
|
|
Loading…
Reference in New Issue