Cursor centering fix
This commit is contained in:
parent
2b041425e5
commit
e452992a6c
|
@ -298,8 +298,14 @@ void CURSOR::Plot( wxDC& aDC, mpWindow& aWindow )
|
||||||
wxQueueEvent( aWindow.GetParent(), new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
|
wxQueueEvent( aWindow.GetParent(), new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
m_updateRef = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_updateRef )
|
||||||
{
|
{
|
||||||
UpdateReference();
|
UpdateReference();
|
||||||
|
m_updateRef = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line length in horizontal and vertical dimensions
|
// Line length in horizontal and vertical dimensions
|
||||||
|
@ -548,8 +554,8 @@ void SIM_PLOT_PANEL::EnableCursor( const wxString& aName, bool aEnable )
|
||||||
if( aEnable )
|
if( aEnable )
|
||||||
{
|
{
|
||||||
CURSOR* c = new CURSOR( t );
|
CURSOR* c = new CURSOR( t );
|
||||||
//int plotCenter = GetMarginLeft() + ( GetXScreen() - GetMarginLeft() - GetMarginRight() ) / 2;
|
int plotCenter = GetMarginLeft() + ( GetXScreen() - GetMarginLeft() - GetMarginRight() ) / 2;
|
||||||
//c->Move( wxPoint( plotCenter, 0 ) );
|
c->SetX( plotCenter );
|
||||||
t->SetCursor( c );
|
t->SetCursor( c );
|
||||||
AddLayer( c );
|
AddLayer( c );
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,21 @@ class CURSOR : public mpInfoLayer
|
||||||
public:
|
public:
|
||||||
CURSOR( const TRACE* aTrace )
|
CURSOR( const TRACE* aTrace )
|
||||||
: mpInfoLayer( wxRect( 0, 0, DRAG_MARGIN, DRAG_MARGIN ), wxTRANSPARENT_BRUSH ),
|
: mpInfoLayer( wxRect( 0, 0, DRAG_MARGIN, DRAG_MARGIN ), wxTRANSPARENT_BRUSH ),
|
||||||
m_trace( aTrace ), m_updateRequired( true ), m_coords( 0.0, 0.0 ), m_window( nullptr )
|
m_trace( aTrace ), m_updateRequired( true ), m_updateRef( false ),
|
||||||
|
m_coords( 0.0, 0.0 ), m_window( nullptr )
|
||||||
{
|
{
|
||||||
SetDrawOutsideMargins( false );
|
SetDrawOutsideMargins( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plot( wxDC& aDC, mpWindow& aWindow ) override;
|
void Plot( wxDC& aDC, mpWindow& aWindow ) override;
|
||||||
|
|
||||||
|
void SetX( int aX )
|
||||||
|
{
|
||||||
|
m_reference.x = 0;
|
||||||
|
m_updateRef = true;
|
||||||
|
Move( wxPoint( aX, 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
m_updateRequired = true;
|
m_updateRequired = true;
|
||||||
|
@ -66,7 +74,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const TRACE* m_trace;
|
const TRACE* m_trace;
|
||||||
bool m_updateRequired;
|
bool m_updateRequired, m_updateRef;
|
||||||
wxRealPoint m_coords;
|
wxRealPoint m_coords;
|
||||||
mpWindow* m_window;
|
mpWindow* m_window;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue